2016-04-25 276 views
3

我一直在試圖用RStudio的「Knit PDF」功能來製作一個簡單的PDF。R knitr生成pdf時出錯41(windows)

每次我試圖將樣本文檔轉換爲PDF我得到以下信息:

|............. | 20%

ordinary text without R code

|.......................... | 40%

label: unnamed-chunk-1

|....................................... | 60%

ordinary text without R code

|.................................................... | 80%

label: unnamed-chunk-2 (with options)

List of 1

$ echo: logi FALSE

|.................................................................| 100%

ordinary text without R code

"PATH1" +RTS -K512m -RTS ECON_404_HW_4.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output DOCTITLE.pdf --template "PATH2" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" output file: DOCTITLE.knit.md

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 '"PATH1" +RTS -K512m -RTS DOCTITLE.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output DOCTITLE.pdf --template "PATH2" --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

我編輯了我的電腦上的路徑位置以及PDF的所要的標題(改變他們在適當的地方使用「PATH1」,「PATH2」和「DOCTITLE」。)

我已經使用該鏈接多次下載MikTex到多個位置,我曾嘗試使用ProTex,因爲其他一些成功的做法。我曾嘗試將MikTex的bin添加到環境中,但無論如何,似乎R無法找到Tex。大多數可用的建議都是針對OSX的,並且我已嘗試將這些解決方案適用於Windows,但無濟於事。

+0

請打開'cmd.exe'並輸入'pdflatex'。你看到'This is pdfTeX ...'還是錯誤信息? –

+0

您是否安裝了MikTex,完成版本? 32位:http://mirrors.ctan.org/systems/win32/miktex/setup/setup-2.9.5870.exe 64位:http://mirrors.ctan.org/systems/win32/miktex/setup/setup-2.9 .5870-x64.exe然後重新啓動R-studio – NangSaigon

+0

CL,當我輸入pdflatex時,我得到的迴應是:'This is pdfTex,Version 3.14159265-2.6-1.40.16​​' –

回答

0

@Matty R,在得到那個錯誤之後,我重新啓動了Rstudio,然後它在我安裝了三個或四個軟件包後,要求我使用MikTex軟件包管理器進行類似「upquote」的打包。