我最近开始在 Rstudio 中使用 knitr。我遇到了“未检测到 tex 安装。请在编译前安装 TeX。”我的 Ubuntu 和 Windows 操作系统中的错误。
经过一些研究,我能够通过将我的 tex 安装目录添加到 来修正 Ubuntu 中的问题。路径 .我通过在 Renviron.site 中包含以下行来做到这一点
PATH=/usr/local/texlive/2013/bin:${PATH}
但是,问题仍然存在于我的 Windows 安装中。我找不到 Renviron.site 文件,所以我在 Renviron 的同一目录中创建了一个,并在 windows 中添加了我的 tex 安装位置:
PATH=C:\texlive\2013\bin\win32:${PATH}
然而,这并不能解决我的问题,Rstudio 仍然无法找到我的 tex 包,这样
file.exists(Sys.which('texi2dvi'))
返回 错误 .
我应该如何进行?
最佳答案
R will always source the Rprofile.site file first. On Windows, the file is in the C:\Program Files\R\R-n.n.n\etc directory.
看这里:Add TeX path to R Studio - Ubuntu在这里:Customizing Startup
关于r - 将 tex 分布添加到 R studio 的 PATH,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22118827/