R Sweave:未检测到TeX安装 [英] R Sweave: NO TeX installation detected

查看:474
本文介绍了R Sweave:未检测到TeX安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试在Google上进行搜索以解决此问题,而使用的解决方案却很少.

I've tried searching on google to fix this, with very minimal helpful solutions.

我已经安装了Miktex,R和R工作室.我想使用Sweave在Miktex中创建PDF文档.每次打开.Rnw文件时,它的顶部都会显示一条警告,提示未检测到TeX安装.请在编译前安装TeX"

I have installed, Miktex, R and R studio. I would like to use Sweave to create PDF documents in Miktex. Everytime I open my .Rnw file, it gives a warning at the top which reads "No TeX installation detected. Please install TeX before compiling"

当我使用以下命令在系统上寻找pdflatex时 Sys.which("pdflatex")它返回"

When I look for pdflatex on my system with the command Sys.which("pdflatex") it returns ""

有人知道如何解决此问题吗?此时一切都将是有用的.

Does anyone know how to fix this? ANYTHING at all at this point would be useful.

推荐答案

通常,Rstudio会自动找到正确的Latex安装路径.在您的情况下似乎并非如此.确保正确安装了Miktex(是否已打开它并编译了一个简单的文件?)之后,可以手动设置pdflatex路径:

Usually Rstudio finds the correct path to your Latex installation automatically. In your case that doesn't seem to be the case. After making sure Miktex is installed correctly (have you opened it and compiled a simple file?) you can set the pdflatex path manually:

Sys.setenv(PATH = paste(Sys.getenv("PATH"), "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64", sep=.Platform$path.sep))

这是我pdflatex.exe文件的路径,您的文件可能位于其他地方.

This is the path to my pdflatex.exe file, yours might live somewhere else.

每次重新启动RStudio时都必须运行此程序.在Windows中将pdflatex.exe的路径添加到您的PATH变量中应该可以使它永久存在,但我尚未对此进行测试.转到系统属性,单击环境变量,然后单击路径,然后单击编辑.然后只需输入pdflatex.exe的路径即可:

You will have to run this every time you restart RStudio. Adding the path to pdflatex.exe to your PATH variable in Windows should make this permanent but I haven't tested that. Go to System Properties, click on Environment Variables, then on Path and then Edit. Then just enter the path to your pdflatex.exe:

这篇关于R Sweave:未检测到TeX安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆