首页 > 解决方案 > 如何将 R Markdown 文件编织成 pdf

问题描述

当我尝试将 R Markdown 文件呈现为 pdf 时,出现以下错误:

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS PC_final_proj.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output PC_final_proj.tex --template /Library /Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --pdf-engine pdflatex --variable graphics=yes --variable ' geometry:margin=1in' --variable 'compact-title:yes' --include-in-header /var/folders/95/jvthp8r158q50jv8qjwy75j80000gn/T//RtmpIPFCYS/rmarkdown-str66203f066768.html 输出文件:PC_final_proj.knit.md

!包 inputenc 错误:Unicode 字符 (U+1F60E) (inputenc) 未设置为与 LaTeX 一起使用。

如果您使用的是 pdflatex,请尝试使用其他 LaTeX 引擎(例如 xelatex)。对于 R Markdown 用户,请参阅

错误:无法编译 PLSC_final_proj.tex。调试技巧见https://yihui.name/tinytex/r/#debugging。有关更多信息,请参阅 PLSC_final_proj.log。执行停止

我已尝试以下方法来解决此问题,但无法解决;

{r message=FALSE}

在所有 r 块中,并将行 latex_engine: xelatex 更改为 YAML 标头

title: "Document 6"
output:
   pdf_document:
        latex_engine: xelatex

任何帮助表示赞赏。谢谢

标签: rr-markdownknitrtinytex

解决方案


推荐阅读