在 RStudio 中使用 knitr to PDF 生成 .pdf 时出错
Error generating .pdf using knitr to PDF in RStudio
我从 RStudio 创建了一个新文件,File / New File / R Markdown,我尝试将 .pdf 文件从 knitr / knitr 生成为 PDF,但出现了下面重现的错误,我正在开始使用 LaTeX,我不太清楚是什么东西。感谢您的帮助。
控制台 RStudio:
! Sorry, but C:\Users\JOSCAR~1\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe did not succeed.
! The log file hopefully contains the information to get MiKTeX going again:
! C:\Users\JoséCarlos\AppData\Local\MiKTeX.9\miktex\log\pdflatex.log
Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
pdflatex.log
2021-05-25 23:58:56,093+0200 INFO pdflatex - this process (4356) started by 'Rterm' with command line: C:\Users\JOSCAR~1\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe -halt-on-error -interaction=batchmode test.tex
2021-05-25 23:58:56,384+0200 INFO pdflatex - allowing known shell commands
2021-05-25 23:58:57,143+0200 INFO pdflatex - going to create file: pdflatex.fmt
2021-05-25 23:58:57,196+0200 INFO pdflatex.core - start process: initexmf --dump-by-name=pdflatex --engine=pdftex
2021-05-25 23:59:42,047+0200 FATAL pdflatex.core - GUI framework cannot be initialized.
2021-05-25 23:59:42,047+0200 FATAL pdflatex.core - Data:
2021-05-25 23:59:42,047+0200 FATAL pdflatex.core - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp:126
2021-05-25 23:59:42,265+0200 FATAL pdflatex - GUI framework cannot be initialized.
2021-05-25 23:59:42,291+0200 FATAL pdflatex - Info:
2021-05-25 23:59:42,291+0200 FATAL pdflatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2021-05-25 23:59:42,291+0200 FATAL pdflatex - Line: 126
2021-05-25 23:59:42,316+0200 INFO pdflatex - this process (4356) finishes with exit code 1
根据评论,在 https://tex.stackexchange.com/a/27141 发布的答案解决了问题。
相关部分:
Remedy: start MiKTeX Options and choose either Yes or No (but not "Ask
me first") for the option "Install missing packages on-the-fly"
我从 RStudio 创建了一个新文件,File / New File / R Markdown,我尝试将 .pdf 文件从 knitr / knitr 生成为 PDF,但出现了下面重现的错误,我正在开始使用 LaTeX,我不太清楚是什么东西。感谢您的帮助。
控制台 RStudio:
! Sorry, but C:\Users\JOSCAR~1\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe did not succeed.
! The log file hopefully contains the information to get MiKTeX going again:
! C:\Users\JoséCarlos\AppData\Local\MiKTeX.9\miktex\log\pdflatex.log
Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.
pdflatex.log
2021-05-25 23:58:56,093+0200 INFO pdflatex - this process (4356) started by 'Rterm' with command line: C:\Users\JOSCAR~1\AppData\Local\Programs\MIKTEX~1.9\miktex\bin\x64\pdflatex.exe -halt-on-error -interaction=batchmode test.tex
2021-05-25 23:58:56,384+0200 INFO pdflatex - allowing known shell commands
2021-05-25 23:58:57,143+0200 INFO pdflatex - going to create file: pdflatex.fmt
2021-05-25 23:58:57,196+0200 INFO pdflatex.core - start process: initexmf --dump-by-name=pdflatex --engine=pdftex
2021-05-25 23:59:42,047+0200 FATAL pdflatex.core - GUI framework cannot be initialized.
2021-05-25 23:59:42,047+0200 FATAL pdflatex.core - Data:
2021-05-25 23:59:42,047+0200 FATAL pdflatex.core - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp:126
2021-05-25 23:59:42,265+0200 FATAL pdflatex - GUI framework cannot be initialized.
2021-05-25 23:59:42,291+0200 FATAL pdflatex - Info:
2021-05-25 23:59:42,291+0200 FATAL pdflatex - Source: Libraries\MiKTeX\UI\Qt\mikuiqt.cpp
2021-05-25 23:59:42,291+0200 FATAL pdflatex - Line: 126
2021-05-25 23:59:42,316+0200 INFO pdflatex - this process (4356) finishes with exit code 1
根据评论,在 https://tex.stackexchange.com/a/27141 发布的答案解决了问题。
相关部分:
Remedy: start MiKTeX Options and choose either Yes or No (but not "Ask me first") for the option "Install missing packages on-the-fly"