Rmd输出pdf报错

复现

! Package inputenc Error: Unicode character 娉?(U+6CF0)
(inputenc) not set up for use with LaTeX.
Try other LaTeX engines instead (e.g., xelatex) if you are using pdflatex. For R Markdown users, see https://bookdown.org/yihui/rmarkdown/pdf-document.html
错误: Failed to compile 泰坦尼克号乘客生存率.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See 泰坦尼克号乘客生存率.log for more info.
此外: Warning message:
In grepl("==> Fatal error occurred", x[i], fixed = TRUE) :
输入的字符串1不适用于此语言环境
停止执行

解决

在文件头部pdf输出上配置下列文件

 output:
     pdf_document:
         latex_engine: xelatex

参考

  1. https://stackoverflow.com/questions/32794157/package-inputenc-error-unicode-char-u8-in-rstudio
  2. https://github.com/rstudio/rmarkdown/issues/1450

你可能感兴趣的:(BUG记录)