Clive Nicholas
2013-Jan-29 17:16 UTC
[R] Setting -sys.setenv()- permanently in Linux using RStudio
> sessionInfo()R version 2.15.2 (2012-10-26)Platform: i686-pc-linux-gnu (32-bit) locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 [4] LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 [7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C [10] LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.15.2 Hello. I'm trying to get -Sys.setenv()- to set the executable paths _permanently_ when I run a TeX file from inside RStudio (0.97.312), but it won't. Entering> Sys.setenv(PATH="/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/texlive/2012/bin/i386-linux")and then confirming that R picks up the TeX executables correctly by running> Sys.which("pdflatex") pdflatex"/usr/local/texlive/2012/bin/i386-linux/pdflatex" and then> Sys.getenv("PATH")[1] "/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/texlive/2012/bin/i386-linux"ensures that my TeX file runs successfully on clicking Compile PDF. But when I then close and reopen RStudio I am greeted with a yellow bar and a warning symbol with the message: "No TeX installation detected. Please install TeX before compiling." meaning that I have to run the code all over again. This is clearly undesirable! I successfully installed TeXLive 2012 on my Linux system yesterday and I have tested that all my TeX files run successfully using TeXworks, which they do (edits included). In searching the R-help archives, I could only find one post on this issue http://r.789695.n4.nabble.com/Add-permanently-environment-variable-td3670920.html which only deals with the issue in Windows. Reading the help from -??sys.setenv- provides no answers. I also tried setting a path in my terminal by $ export RPATH=$PATH:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/texlive/2012/bin/i386-linux $ sudo ~/.bashrc and then running> Sys.setenv(PATH="RPATH")in RStudio, which runs without complaint, but I then get blank output from -Sys.which("pdflatex")-> Sys.which("pdflatex")pdflatex"" > Sys.getenv("PATH")[1] "RPATH" so clearly this is incorrect. There must be a solution to this that I can't see and I've tried everything within my knowledge, so can anybody help me on this? Thanks. -- Clive Nicholas (clivenicholas.posterous.com) [Please DO NOT mail me personally here, but at <clivenicholas@hotmail.com>. Please respond to contributions I make in a list thread here. Thanks!] "My colleagues in the social sciences talk a great deal about methodology. I prefer to call it style." -- Freeman J. Dyson [[alternative HTML version deleted]]