我在论坛中搜索了答案,但它们似乎没有用。
我正在使用knitr包在Rstudio中编写pdf文档。我使用的是Windows 7和Rstudio。
pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" PA1_template.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output PA1_template.pdf --template "C:\R\Library\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43
Execution halted
谢谢,
路易斯
答案 0 :(得分:4)
我遇到了同样的问题,但在Linux上使用最新的rmarkdown软件包和pandoc 1.13。从本质上看,pdflatex似乎不适用于pandoc生成的输出 - 您需要将xflatex替换乳胶引擎pdflatex(TeXLive的一部分)
对于rmarkdown,我的解决方案是编辑文件
rmarkdown/templates/tufte_handout/resources/tufte-common.def
并替换
行\typeoutbool{pdfatex}{@tufte@pdf}
与
\typeoutbool{xelatex}{@tufte@pdf}
然后将使用xelatex而不是pdflatex来生成带有rmarkdown的pdf
答案 1 :(得分:1)
我遇到了同样的问题,以下是我为解决问题所采取的步骤:
install.packages(devtools)
)devtools::install_github("rstudio/rmarkdown")
)~/R/x86_64-pc-linux-gnu-library/3.2/rmarkdown/rmarkdown/templates/tufte_handout/resources/
如果rmarkdown安装不顺利,那就这样做(devtools::install_github("git://github.com/rstudio/rmarkdown")
)
在tufte-common.def中执行以下操作:
添加此行
\typeoutbool{xelatex}{@tufte@pdf}
取消注释此行
\typeoutbool{xelatex}{@tufte@xetex}
记得%用于取消注释乳胶
在tufte-handout.tex中添加以下行:
% UTF encoding
\usepackage[utf8]{inputenc}
当我尝试编译文档时,我仍然遇到以下错误(! Font \XeTeXLink@font=pzdr at 0.00002pt not loadable: Metric (TFM) file or ins talled font not found.)
,我通过安装texlive-fonts-recommended
解决了这个问题:
sudo apt-get install texlive-fonts-recommended
答案 2 :(得分:0)
我有类似的问题。告诉knitr在哪里找到pdf引擎是必要的,即使我在Windows路径上有它。这是knitr.Rmd文档的标题,它解决了我的问题:
---
title: "XXX"
author: "XXX"
date: '2016-11-28'
output:
pdf_document:
keep_tex: yes
pandoc_args:
- --latex-engine
- C:/Program Files/MiKTeX 2.9/miktex/bin/x64/pdflatex.exe
toc: yes
---