2014-11-08 42 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