2017-09-08 358 views
0

我正在嘗試使用R Markdown創建PDF文件。我運行時收到錯誤43。我嘗試使用R Markdown創建word文件和HTML,它工作正常。只有PDF文件不起作用。從R Markdown創建PDF文件時出錯(錯誤43失敗)

processing file: Test_New.Rmd 
    |......................           | 33% 
    ordinary text without R code 

    |...........................................      | 67% 
label: unnamed-chunk-1 (with options) 
List of 1 
$ tidy: logi TRUE 

    |.................................................................| 100% 
    ordinary text without R code 


/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS 
Test_New.utf8.md --to latex --from 
markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash -- 
output Test_New.pdf --template/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine /usr/local/bin/pdflatex --variable graphics=yes --variable 'geometry:margin=1in' 
output file: Test_New.knit.md 

dyld: Library not loaded: /usr/local/lib/libjpeg.8.dylib 
    Referenced from: /usr/local/bin/pdflatex 
    Reason: image not found 

pandoc: Error producing PDF 
Error: pandoc document conversion failed with error 43 
Execution halted 

我在R Markdown上的代碼如下。

--- 
title: "Test R Markdown" 
author: "Sam Ng" 
date: "September 1, 2017" 
output: 
    pdf_document: default 
    html_document: default 
    word_document: default 
--- 

# 1. R commands 

Testing R commands 

```{r,tidy=TRUE} 
vector=c(1,2,3) # Create a new vector with three entries 
max(vector) # Returns the maximum of a vector 
min(vector) # Returns the minimum of a vector 

``` 
+0

嘗試安裝MIKTEX? – jaySf

回答

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
    • 網址
  • 相關問題