Rmarkdown won't compile to pdf

Over the past week my rmarkdown installation won't compile .rmd files to pdf - these files worked prior to 1 December. Compiling to html and Word is fine, only pdf. The R Markdown console seems to run through the compilation normally, prints (in blue) the name of the output file (.md) and then appears to execute pandoc but it hangs. No message, no output, nothing (I let it go 45 minutes). I kill the job and then have to delete the temporary files. But no pdf is produced. I've just un- and reinstalled MikTex 2.9 and R studio, updated the R libraries and no improvement. I'm not sure where to go from here. Any help is appreciated. It does this for any .rmd file, including the template when one creates a 'new' Markdown document in RStudio. Here're the console contents

processing file: Junk-Test.Rmd
List of 1
$ include: logi FALSE

|.............................. | 43%
ordinary text without R code

|........................................ | 57%
label: cars
|.................................................. | 71%
ordinary text without R code

|............................................................ | 86%
label: pressure (with options)
List of 1
$ echo: logi FALSE

|......................................................................| 100%
ordinary text without R code

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Junk-Test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Junk-Test.tex --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --lua-filter "C:/Users/David Stevens/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/David Stevens/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in"
output file: Junk-Test.knit.md

Update:
I then open the .tex file in TeXstudio and tried to compile from there, and pandoc hangs there too. If I cancel the job, it does, with the message "Could not start Default Compiler: PdfLatex: pdflatex.exe -synctex=1 -interaction=nonstopmode "Junk-Test".tex, so I'm guessing these issues are related. I just don't know where to look to fix it.

Removing texstudio and texlive/miktex from your system and reinstalling may fix your problem.

1 Like

Thanks. This did the trick. I deleted/uninstalled all references to tex I could find, then installed the full texlive package. Once I did this, I and got the .rmd template to compile normally.

I tried to compile one of my old rmarkdown documents (compiled fine in the past) and got a bunch of tlmgr errors. I then deleted most of the yaml header from that document and the document compiled. Then I added back the yaml header line by line and the document compiled fine each time until the full header was restored. Now the document compiles without the tlmgr errors. Is there a place I can look for an explanation of this?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.