Rstudio pdflatex.exe did not succeed

Viewed 4805

I'm currently using Rstudio and R markdown to create a pdf. However, every time I attempt to knit these error messages show up:

! Sorry, but C:\Users\AP\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\AP\AppData\Local\MiKTeX\miktex\log\pdflatex.log

Error: LaTeX failed to compile new-report.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See c2089682-report.log for more info.
In addition: Warning message:
In has_crop_tools() : 
Tool(s) not installed or not in PATH: ghostcript
-> As a result, figure cropping will be disabled.
Execution halted

I've attempted to uninstall/re-install MiKTex and restarting Rstudio but the problem persists. How can I solve this issue?

2 Answers

With a new installation of MiKTeX, many style files needed to knit an RMarkdown file to PDF are not installed. To allow MiKTeX to install them on the fly, open the MiKTeX console and go to the Settings tab.

There is an option that says You can choose whether missing packages are to be installed automatically (on-the-fly). Make sure that this is set to Always to allow the necessary style files to be installed.

For me I just went to MiKTeX console setting and choose ALWAYS missing packages to be installed automatically.

Related