问题描述
该错误显然与 Latex 有关系,我已尽力 google 并解决它,但我得到的只是更多错误。
初始错误:
! Package inputenc Error: Unicode character 锛?(U+FF0C)
(inputenc) not set up for use with LaTeX.
Try other LaTeX engines instead (e.g.,xelatex) if you are using pdflatex. See https://bookdown.org/yihui/rmarkdown-cookbook/latex-unicode.html
错误: LaTeX Failed to compile Jan-26-in-class-code.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Jan-26-in-class-code.log for more info.
此外: Warning message:
In grepl("==> Fatal error occurred",x[i],fixed = TRUE) :
输入的字符串1不适用于此语言环境
停止执行
所以我尝试了 xelatex。然后我得到了
! LaTeX Error: File `unicode-math.sty' not found.
! Emergency stop.
<read *>
! Unfortunately,the package unicode-math Could not be installed.
! Please check the log file:
! C:\Users\86188\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.log
错误: LaTeX Failed to compile Jan-26-in-class-code.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Jan-26-in-class-code.log for more info.
停止执行
我想问题是我的电脑上没有安装“unicode-math”,所以我尝试了 install.packages("unicode-math"),然后我得到了
Warning in install.packages :
package ‘unicode-math’ is not available for this version of R
我真诚地感谢任何指示或建议。谢谢!
解决方法
unicode-math 是一个 LaTeX 包而不是一个 R 包,所以它需要使用 LateX 包管理器安装;如果使用 TeX Live 发行版,则使用 tlmgr,或者将 MiKTeX 控制台与 MiKTeX(通常是 Windows 上的主要 TeX 发行版)一起使用。