Rstudio pdflatex.exe 没有成功

RDT*_*TJr 5 latex r miktex r-markdown

我目前正在使用 Rstudio 和 R markdown 创建 pdf。然而,每次我尝试编织这些错误消息时都会出现:

! 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
Run Code Online (Sandbox Code Playgroud)

我尝试卸载/重新安装 MiKTex 并重新启动 Rstudio,但问题仍然存在。我该如何解决这个问题?

小智 13

全新安装后MiKTeX,将文件转换RMarkdown为 PDF 所需的许多样式文件都不会安装。要允许 MiKTeX 即时安装它们,请打开 MiKTeX 控制台并转到选项Settings卡。

有一个选项说You can choose whether missing packages are to be installed automatically (on-the-fly)。确保将其设置为“始终”以允许安装必要的样式文件。