我想知道如何在onchange
中设置pdflatex路径以使用R
。因为我有两个不同的MikTeX安装,一个正常工作。请考虑我在sweave
中使用R(RStudio)。但是,我发现了一些针对Linux或Unix用户的建议。
提前致谢
答案 0 :(得分:10)
If you have multiple installs of LaTeX (i.e. MikTeX) and you want to use a specific one of these, then you need to make sure that R finds the one you need first. This means that you have to add the location of your preferred version of pdfLaTeX at the front of your PATH system environment variable.
If you do not have administrator rights in Windows, then you can use R's environment file to change the PATH variable for R only. See ?Startup
in R for details on this process. Follow the following steps:
Sys.getenv("R_ENVIRON")
. This will return the full path to an existing environment file, but will be empty in most cases. If a file exists, skip to step 3 below.PATH=C:\\full\\path\\to\\the\\folder\\with\\pdflatex;"${PATH}"
(the quotations marks are important)Sys.getenv("PATH")
and Sys.which("pdflatex")
returns the correct paths.If you do not have rights to create a Renviron.site file in R_HOME\etc, then you can also create a .Renviron file in HOME (Sys.getenv("HOME")
).