Create PDF from RMarkdown on WIndows 10 - Rstudio 1.4 and MiKTeX 21.1

I have the following setup:

  • OS: Windows 10 Home, 64-bit, build 19042
  • Rstudio 1.4
  • MiKTeX 21.1
  • R x64 4.03

I am able to create HTML documents, but when I try to knit to PDF I get the following error:

output file:

! Sorry, but C:\Users\user\AppData\Local\Programs\MiKTeX\miktex\bin\x64\pdflatex.exe did not succeed.

! The log file hopefully contains the information to get MiKTeX going again:

!   C:\Users\user\AppData\Local\MiKTeX\miktex\log\pdflatex.log

Error: LaTeX failed to compile test.tex. See for debugging tips. See test.log for more info.
Execution halted


2021-02-15 18:15:34,402+0100 INFO  pdflatex - this process (8276) started by 'Rterm' with command line: C:\Users\user\AppData\Local\Programs\MiKTeX\miktex\bin\x64\pdflatex.exe -halt-on-error -interaction=batchmode test.tex
2021-02-15 18:15:34,426+0100 INFO  pdflatex - allowing known shell commands
2021-02-15 18:15:34,475+0100 INFO  pdflatex - going to create file: pdflatex.fmt
2021-02-15 18:15:34,517+0100 INFO  pdflatex.core - start process: initexmf --dump-by-name=pdflatex --engine=pdftex
2021-02-15 18:15:40,070+0100 FATAL pdflatex.core - GUI framework cannot be initialized.
2021-02-15 18:15:40,070+0100 FATAL pdflatex.core - Data: 
2021-02-15 18:15:40,070+0100 FATAL pdflatex.core - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp:126
2021-02-15 18:15:40,070+0100 FATAL pdflatex - GUI framework cannot be initialized.
2021-02-15 18:15:40,070+0100 FATAL pdflatex - Info: 
2021-02-15 18:15:40,070+0100 FATAL pdflatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2021-02-15 18:15:40,070+0100 FATAL pdflatex - Line: 126
2021-02-15 18:15:40,071+0100 INFO  pdflatex - this process (8276) finishes with exit code 1

It is possible that you are missing a package to render you document. With MikTeX, tinytex won't be able to do an automatic installation. See

This means you need to install all the required package before rendering. Usually I believe MikTeX ask you to install them using a windows but

GUI framework cannot be initialized.

Means that this GUI can't open from RStudio during the rendering in background. You may be able to configure MikTeX to show the missing package another way.

Or you can install TinyTeX that will work well with R Markdown.

Thank you, TinyTeX worked for me.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.