rstudio/shiny-examples

pandoc document conversion failed with error 41

isaacfab opened this issue · 2 comments

If there is not a set of latex and pandoc software installed on the localhost then the pdf options will throw the error in the title. I haven't tried this on a shiny server but it is certainly the case with local host instances.

Solution:
Step 1: Download and Install MiKTeX from http://miktex.org/2.9/setup
Step 2: Run Sys.getenv("PATH") in R studio
This command returns the path where Rstudio is trying to find pdflatex.exe
In windows (64-bit) it should return C:\Program Files\MiKTeX 2.9\miktex\bin\x64\pdflatex.exe
If pdflatex.exe is not located in this location Rstudio gives this error code 41.
Step 3: To set this path variable run:
Sys.setenv(PATH=paste(Sys.getenv("PATH"),"C:/Program Files/MiKTeX 2.9/miktex/bin/x64/",sep=";"))

HI @SayaliSonawane I am also getting similar error. I tried to set the variable by using the command you wrote:

I am trying to use bookdown package to convert to pdf document. The error I am getting is as follows:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS _main.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output _main.tex --table-of-contents --toc-depth 2 --template "C:\Users\DSI\Documents\R\win-library\3.3\rmarkdown\rmd\latex\default-1.17.0.2.tex" --number-sections --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" --variable tables=yes --standalone --bibliography thrush-bibliography.bib --filter pandoc-citeproc 
Error: Failed to compile _main.tex.
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "_main.tex"' had status 1 

Any suggestions to fix this issue?