2017-06-01 36 views
0

代碼錯誤時,PDF

```{r, eval=TRUE} 
library(caret) 

plot(iris$Sepal.Length) 
``` 

報告的錯誤

pandoc.exe: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41 In addition: Warning message: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS t4.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output t4.pdf --template "C:\Users\15235330\Documents\R\R-3.3.0\library\rmarkdown\rmd\latex\default-1.15.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in"' had status 41 Execution halted No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform: Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup (NOTE: Be sure to download the Complete rather than Basic installation) Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome _strongly_ recommended) Linux: Use system package manager

+5

錯誤消息是關於什麼錯誤很清楚,你怎麼能修理它。消息表明您是否安裝了MiKTeX? – Marius

+0

我已經安裝了MikeTex和pandoc,但它不起作用 – Tuyen

回答

-1

我花了幾個小時試圖解決這個問題。我安裝了Miktex,但由於坐在工作中的防火牆後面,無法直接從軟件包管理器獲取軟件包。我終於能這樣使用以下步驟來解決:

  1. 安裝MIKTEX
  2. 創建一個文件夾中安裝MIKTEX包,例如「C:\ miktex_pkgs」
  3. 轉到CTAN package archive和下載以下文件.tar.lzma:

-fancyvrb
-framed
-microtype
-miktex,zzdb1-2.9
-miktex-zzdb2-2.9
-mptopdf
-titling
-upquote
-u RL

  • 上述.tar.lzma文件移動到 「C:\ miktex_pkgs」 文件夾
  • 設置你的包從本地存儲庫下載:「C:\ miktex_pkgs 」。要做到這一點,請訪問:

    • 「MIKTEX設置」 - 這是一個應用
    • 點擊套餐
    • 更改包庫爲 「C:\ miktex_pkgs」
  • 轉到「 Miktex Package Manager「應用程序並通過右鍵單擊安裝以下軟件包,請安裝:

    • 列表項目
    • fancyvrb
    • 陷害
    • microtype
    • mptopdf
    • 所有權
    • upquote
    • 網址