2014-11-08 64 views
0

我跑了在Linux端R下面的代码,它工作正常tikzDevice不工作的emacs

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) 
## \[email protected]=\box35 
## (/home/DJJ/.emacs.d/elpa/auctex-11.87.2/latex/prtightpage.def 
## \PreviewBorder=\dimen148 
##) 
## \[email protected]=\count107 
## \[email protected]=\box36 
## \[email protected]=\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有些冲突,但我不确定。

这里是我的.emacs关于R A部分:)

;(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.1 

UPDATE 溶液here建议更新preview.sty包,来自Auctex的产品。如何做呢?

+0

确实[这](http://tex.stackexchange.com/questions/137231/how-to-debug-if-knitr-quits-unexpectedly-when-composing-tikz - 图)的帮助? – 2014-11-09 19:33:37

+0

@BenBolker谢谢我缩小了问题范围,并完全修改了我的问题,但似乎我对此一alone不振。 – DJJ 2014-11-09 19:49:25

+0

我只能说,你必须通过emacs使用不同的路径/ TeX版本,而不是从控制台。我不是专家的ESS/emacs调试器... – 2014-11-09 20:28:42

回答

0

它给了我一个难以置信的时间,但我设法了解什么this帖子的意思。如果你使用的是Fedora,你可能还想检查this

基本上我安装Fedora的仓库

yum install tex-preview 

preview.sty然后切换Auctex的preview.sty从TEX-现场的preview.sty。

kpsewhere preview.sty可能会帮助您从tex-live(一旦安装它)中找到preview.sty。在我的情况下,它是在这里:

/usr/share/texlive/texmf-dist/tex/latex/preview/. 

然后找到从auctex的preview.sty是很容易的:这是我的问题,粘贴在日志中。在我的情况是:

/home/DJJ/.emacs.d/elpa/auctex-11.87.2/latex/preview.sty