Ulrich Küsters
Ulrich Küsters

Reputation: 41

R Markdown via RStudio cannot generate PDFs but only HTML and Word (Pandoc generates status 43)

Even with a very simple Rmd-file generated by 'Newfile' -> 'New R Markdown' sequence selecting 'Document ' and 'PDF' as the Default Output Format I get the following error when pressing the 'Knit PDF' button in RStudio:

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS mist2.utf8.md --to latex 
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures 
--output mist2.pdf --template "D:\_Dateien_von_ulk\Dokumente\R\win-library\3.2\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango 
--latex-engine pdflatex --natbib --variable graphics=yes --variable "geometry:margin=1in" 
  output file: mist2.knit.md

  ! Incomplete \iffalse; all text was ignored after line 131.
  <inserted text> 
    \fi 
  <*> ./tex2pdf.2196/input.tex

  !  ==> Fatal error occurred, no output PDF file produced!
    Transcript written on D:/ulk/uk-uni/Uni-ab-September-1999/Lehre/Unterlagen-Lehr
  e-WS-2015-16/Lektuerekurs.VAR.ECM.COINT.WS2015.16/Pfaff.2008.RCode/RCode/tex2pd
  f.2196/input.log.

  pandoc.exe: Error producing PDF from TeX source
  Fehler: pandoc document conversion failed with error 43
  Zusätzlich: Warnmeldung:
    Ausführung von Kommando '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS mist2.utf8.md --to latex 
 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output mist2.pdf 
 --template "D:\_Dateien_von_ulk\Dokumente\R\win-library\3.2\rmarkdown\rmd\latex\default-1.14.tex"
 --highlight-style tango --latex-engine pdflatex --natbib --variable graphics=yes 
 --variable "geometry:margin=1in"' ergab Status 43 
  Ausführung angehalten

The R session info provided by sessionInfo() gives:

R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RevoUtilsMath_3.2.2

loaded via a namespace (and not attached):
[1] htmltools_0.2.6 tools_3.2.2     yaml_2.1.13     rmarkdown_0.8.2 digest_0.6.8   

Under Window 8.1. I use:

  1. MikTeX version 2.9.5721
  2. Pandoc 1.15.1.1.
  3. RStudio 0.99.489

All libraries have been updated today (17th Nov 2015). Furthermore all software has been installed using admin rights in the installation default pathes on drive C: and has been made available to all user.

Knitr the Rmd file into HTML and Word works without any problems.
Any suggestion how to solve the problem?

Upvotes: 4

Views: 2682

Answers (1)

cbeleites
cbeleites

Reputation: 14093

Just encountered the same problem. Here's what happens:

---
date: "8. Mai 2017"
---

is treated as enumeration by pandoc. TeX then finds an enumeration inside \date{}:

\date{\begin{enumerate} \def\labelenumi{\arabic{enumi}.} \setcounter{enumi}{7} \tightlist \item Mai 2017 \end{enumerate}} which it doesn't like at all.

Workarounds:

  • escape the dot: date: 8\. Mai or date: '8\. Mai 2017' or date: "8\\. Mai 2017" or

    date: '`r format(Sys.time(), "%d\\. %B %Y")`'
    
  • the treatment as enumeration is triggered by the sequence number-dot-space. The problem does not occur with 08.05.2017 (nor with the slightly mistyped 8.Mai 2017).

Upvotes: 1

Related Questions