我在linux终端上使用R运行了下面的代码,它运行得很好
td <- tempdir()
tf <- file.path(td, "examplelast.tex" )
oldwd <- getwd()
setwd(td)
library(tikzDevice)
# Minimal plot
tikz(tf,standAlone = T)
plot(1,main="\\TeX")
dev.off()
# View the output
tools::texi2dvi(tf,pdf=T)
system(paste(getOption("pdfviewer"),file.path("examplelast.pdf")))
setwd(oldwd)但是,在emacs上运行会给出以下错误:
## (/home/DJJ/.emacs.d/elpa/auctex-11.87.2/latex/preview.sty
## Package: preview 2010-02-14 CVS-1.126 (AUCTeX/preview-latex)
## \pr@markerbox=\box35
## (/home/DJJ/.emacs.d/elpa/auctex-11.87.2/latex/prtightpage.def
## \PreviewBorder=\dimen148
## )
## \pr@snippet=\count107
## \pr@box=\box36
## \pr@output=\toks24
## )
## ! Missing = inserted for \ifnum.
## <to be read again>
## ...
## ! ==> Fatal error occurred, no output PDF file produced!
## Error in getMetricsFromLatex(TeXMetrics) :
## TeX was unable to calculate metrics for the following string
## or character:
## m我怀疑与preview.sty有一些冲突,但我不确定。
下面是我关于R的.emacs的一部分:
;(add-to-list 'load-path "~/R/ess-5.13/lisp")
(require 'ess-site)和我的sessioninfo()
## R version 3.1.1 (2014-07-10)
## Platform: x86_64-redhat-linux-gnu (64-bit)
## locale:
## [1] LC_CTYPE=en_US.utf8 LC_NUMERIC=C
## [3] LC_TIME=en_US.utf8 LC_COLLATE=en_US.utf8
## [5] LC_MONETARY=en_US.utf8 LC_MESSAGES=en_US.utf8
## [7] LC_PAPER=en_US.utf8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
## other attached packages:
## [1] tikzDevice_0.7.0 filehash_2.2-2
## loaded via a namespace (and not attached):
## [1] grid_3.1.1 tools_3.1.1update 这里建议从Auctex附带的preview.sty包中更新preview.sty包。怎么做呢?
发布于 2014-11-11 20:32:58
它给了我一个地狱般的时间,但我设法理解了这帖子的含义。如果你穿着软呢帽,你最好检查一下这帖子。
基本上,我从fedora存储库安装了preview.sty。
yum install tex-preview然后,我从tex-live中用preview.sty切换Auctex的preview.sty。
kpsewhere preview.sty可能会帮助您从tex(一旦安装)找到preview.sty。就我而言,它就在这里:
/usr/share/texlive/texmf-dist/tex/latex/preview/.那么从拍卖会上找到preview.sty是非常容易的:我在这个问题中粘贴的是日志。就我而言,它是:
/home/DJJ/.emacs.d/elpa/auctex-11.87.2/latex/preview.styhttps://stackoverflow.com/questions/26822998
复制相似问题