9
votes

I have search the answers in the forum, but they dont seem to work.

I am knitting a pdf document in Rstudio using the knitr package. I am using Windows 7 and 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

Thanks,

Luis

3
This is still broken for me, including when I try and knit to pdf a simple Rmd including only the output: pdf_document header (with three hyphens on the preceding and subsequent line) and, on a new line, the word test.jbaums
Same problem here on Mac OS X Mavericks and rmarkdown 0.5.1JerryWho

3 Answers

4
votes

I had the same issue but on Linux using the latest rmarkdown package and pandoc 1.13. In essence it seems like pdflatex does not work with the output generated by pandoc - you need to replace the latex-engine pdflatex with xelatex (part of TeXLive)

For rmarkdown my solution was to edit the file

rmarkdown/templates/tufte_handout/resources/tufte-common.def

and replace the line

\typeoutbool{pdfatex}{@tufte@pdf}

with

\typeoutbool{xelatex}{@tufte@pdf}

Then xelatex will be used instead of pdflatex to generate pdf's with rmarkdown

1
votes

I faced the same issue, here are the steps I took to solve the problem:

  • install devtools in Rstudio (install.packages(devtools))
  • install rmarkdown (devtools::install_github("rstudio/rmarkdown"))
  • fix the files tufte-common.def and tufte-handout.tex in ~/R/x86_64-pc-linux-gnu-library/3.2/rmarkdown/rmarkdown/templates/tufte_handout/resources/

If the rmarkdown installation did not go smoothly this way then do it like this (devtools::install_github("git://github.com/rstudio/rmarkdown"))

In tufte-common.def do the following:

  • Add this line \typeoutbool{xelatex}{@tufte@pdf}

  • uncomment this line \typeoutbool{xelatex}{@tufte@xetex} remember % is used to uncomment latex

Add the following lines in tufte-handout.tex:

% UTF encoding \usepackage[utf8]{inputenc}

When I tried to compile a document I still got the following error (! Font \XeTeXLink@font=pzdr at 0.00002pt not loadable: Metric (TFM) file or ins talled font not found.), I tackled it by installing texlive-fonts-recommended:

sudo apt-get install texlive-fonts-recommended

0
votes

I had a similar problem. Telling knitr where to find the pdf-engine was necessary even though I had it on the windows path. Here is the header of the knitr.Rmd-document, that solved the problem for me:

---
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
---