将TeX路径添加到R Studio-Ubuntu [英] Add TeX path to R Studio - Ubuntu
问题描述
我遇到的问题与这个问题:
当我打开任何.Rnw文件时,R Studio表示我没有安装TeX发行版:我正在使用带有Gnome的Ubuntu 14.04和TeXLive 2014.
When I open any .Rnw file, R Studio says that I have no TeX Distribution installed: I'm using Ubuntu 14.04 w/ Gnome and TeXLive 2014.
我在Renviron.site文件中加入了行PATH=/usr/local/texlive/2014/bin:${PATH}
,现在看起来像这样:
I include the line PATH=/usr/local/texlive/2014/bin:${PATH}
in the Renviron.site file, which now looks like:
## Emacs please make this -*- R -*-
## empty Renviron.site for R on Debian
##
## Copyright (C) 2008 Dirk Eddelbuettel and GPL'ed
##
## see help(Startup) for documentation on ~/.Renviron and Renviron.site
# ## Example ~/.Renviron on Unix
# R_LIBS=~/R/library
# PAGER=/usr/local/bin/less
# ## Example .Renviron on Windows
# R_LIBS=C:/R/library
# MY_TCLTK="c:/Program Files/Tcl/bin"
# ## Example of setting R_DEFAULT_PACKAGES (from R CMD check)
# R_DEFAULT_PACKAGES='utils,grDevices,graphics,stats'
# # this loads the packages in the order given, so they appear on
# # the search path in reverse order.
PATH=/usr/local/texlive/2014/bin:${PATH}
但是问题仍然存在.如何解决此问题并运行Sweave或knitR?
However the problem persists. How can I fix this and run Sweave or knitR?
推荐答案
如果有人遇到相同的问题,我打开R Studio并使用
If anyone faces the same problem, I opened R Studio and checked the pdflatex installation with
> Sys.which("pdflatex")
pdflatex
""
表明它实际上是空的,因此我运行命令Sys.getenv("PATH")
来检查当前PATH:
Which show that it is in fact empty, so I run the command Sys.getenv("PATH")
to check the current PATH:
Sys.getenv("PATH")
[1] "/usr/local/texlive/2014/bin:/usr/local/texlive/2014/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
要添加pdflatex路径,我必须在texlive目录中找到pdflatex
文件,该文件为/usr/local/texlive/2014/bin/x86_64-linux
,然后将其添加到当前路径中:
To add my pdflatex Path, I had to find the pdflatex
file on my texlive directory, which was /usr/local/texlive/2014/bin/x86_64-linux
, then I added this to my current Path:
> Sys.setenv(PATH=paste(Sys.getenv("PATH"),"/usr/local/texlive/2014/bin/x86_64-linux",sep=":"))
现在它可以完美运行
上面的解决方案仅适用于打开的会话,并且只是临时的,每次打开新的会话时都必须运行代码.我仍在寻找永久解决方案
the solution above works only for the open session and is only temporary, you have to run the code everytime you open a new session. I'm still trying to find a permanent solution
这篇关于将TeX路径添加到R Studio-Ubuntu的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!