繁体   English   中英

从R Markdown创建PDF文件时出错(失败,错误43)

[英]Error in creating PDF file from R Markdown (Failed with error 43)

我正在尝试使用R Markdown创建PDF文件。 我在运行时收到错误43。 我尝试使用R Markdown创建Word文件和HTML,效果很好。 仅PDF文件不起作用。

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

```

我花了几个小时试图解决这个问题。 我安装了Miktex,但是由于正坐在防火墙后面而无法直接从软件包管理器中获取软件包。 我终于能够使用以下步骤解决此问题:

  1. 安装Miktex
  2. 创建一个文件夹来安装Miktex软件包,例如“ C:\\ miktex_pkgs”
  3. 转到CTAN软件包存档并下载以下.tar.lzma文件:

-fancyvrb
-framed
-microtype
-miktex-zzdb1-2.9
-miktex-zzdb2-2.9
-mptopdf
-titling
-upquote
-url

  1. 将上面的.tar.lzma文件移动到“ C:\\ miktex_pkgs”文件夹中
  2. 设置软件包以从本地存储库下载:“ C:\\ miktex_pkgs”。 为此,请转到:

    • “ Miktex设置”-这是一个应用程序
    • 点击套餐
    • 将软件包存储库更改为“ C:\\ miktex_pkgs”
  3. 转到“ Miktex软件包管理器”应用程序,然后通过右键单击安装以下软件包:

    • 项目清单
    • fancyvrb
    • 陷害
    • microtype
    • mptopdf
    • 所有权
    • upquote
    • 网址

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM