在R中为pdflatex设置miktex的路径 [英] Set path to miktex for pdflatex in R

查看:129
本文介绍了在R中为pdflatex设置miktex的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试获取pdflatex以使用正确版本的miktex,但没有成功.

I have been trying to get pdflatex to use the correct version of miktex and have not been successful.

我已将R路径设置为具有正确的Miktex 2.9位置,并验证了它可用于:

I have set the R Path to have the correct location of Miktex 2.9, and verified that it worked with:

Sys.getenv("PATH")
"C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\pdflatex;..." 

但是,当我查看pdflatex使用的miktex版本时:

However when i look at the version of miktex that pdflatex is using:

Sys.which("pdflatex")
"C:\\PROGRA~1\\MIKTEX~1.9\\miktex\\bin\\x64\\pdflatex.exe"

此1.9路径指向不再存在的miktex的旧版本.

This 1.9 path is to an old version of miktex that no longer even exists.

在命令提示符下运行哪个pdflatex返回正确的路径,所以问题就出在R中.如何让R使用正确的pdflatex路径?

Running in the command prompt which pdflatex returns the correct path, so the problem is just in R. How can I get R to use the correct path to pdflatex?

推荐答案

您可以尝试以下几种解决方案:

There are couple solutions you can try:

  1. 在工具">全局选项">编织"中禁用启用外壳转义命令"

根据此答案手动设置路径.每次重新启动RStudio时都必须运行此程序.

Set the path manually per this answer. You will have to run this every time you restart RStudio.

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

  • 将以下行放在 R_HOME/etc 文件夹的 Renviron.site 中,其中 R_HOME Sys.getenv("R_HOME").参考

  • Put the following line in Renviron.site in the folder R_HOME/etc where R_HOME is the path returned by Sys.getenv("R_HOME"). Ref

     PATH=C:/Program Files/MiKTeX 2.9/miktex/bin/x64:"${PATH}"
    

  • 安装 tinytex 软件包.请注意,您应该使用MiKTeX或 tinytex ,但不能同时使用.如果同时安装了两者,则Yihui建议您在这种情况下删除MiKTeX.参考

  • Install tinytex package. Note that you should use either MiKTeX or tinytex, but not both. If you have both installed, Yihui recommended that you remove MiKTeX in this case. Ref

    每次更改后,您可能必须重新启动R/RStudio甚至PC/笔记本电脑,以查看其是否有效

    You might have to restart R/RStudio or even your PC/laptop after each change to see if it works or not

    这篇关于在R中为pdflatex设置miktex的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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