生成 pdf 时 R knitr 错误 41(windows)

标签 r pdf latex knitr

我一直在尝试使用 RStudio 的“Knit PDF”功能制作一个简单的 PDF。

每次我尝试将示例文档转换为 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

我在我的 PC 上编辑了路径位置以及 PDF 的预期标题(在适当的地方用“PATH1”、“PATH2”和“DOCTITLE”更改它们。)

我已使用该链接多次将 MikTex 下载到多个位置,我已尝试使用 ProTex,因为其他一些人已成功这样做。我已经尝试将 MikTex 的 bin 添加到环境中,但无论如何,R 似乎无法找到 Tex。大多数可用的建议都是针对 OSX 的,我已经尝试将这些解决方案调整为适用于 Windows,但无济于事。

最佳答案

@Matty R,在收到该错误后我重新启动了 Rstudio,然后它要求我使用 MikTex 包管理器安装像“upquote”这样的包,在安装了三四个包后我创建了 pdf 文件。

关于生成 pdf 时 R knitr 错误 41(windows),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36833359/

相关文章:

Python 分节阅读 pdf

R/考试 : prevent page breaks between two paragraphs in exams2nops

r - 为什么R将大数视为偶数

r - 确定子组索引

r - 如何在ggplot中制作虚线、双虚线和实线

emacs - Emacs 中 LaTeX 的代码折叠

latex - 包含主 *.tex 文件的 super /子目录中的 *.sty 文件

r - R ranger 包中的预测概率

pdf - 从 Plone 内容类型生成 PDF

iphone - 如何在UIWebView中显示本地pdf文件?