Marius Hofert
2012-May-25 15:20 UTC
[R-sig-Debian] How to set symbolic link correctly so that LaTeX finds Sweave?
Hi, I recently switched from Mac OS X (after 7 years) to Xubuntu 12.04 and I am quite happy with it so far. I first installed R from source but I was somehow missing certain things and I thus decided (after a new Xubuntu installation which I had to make due to other reasons) to install R the "Ubuntu way": ,----[ R installation: ] | 1) sudo emacs /etc/apt/sources.list | 2) add: | deb http://stat.ethz.ch/CRAN/bin/linux/ubuntu precise/ | 3) in a terminal: | gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 | gpg -a --export E084DAB9 | sudo apt-key add - | 4) the "standard way": | sudo apt-get update | sudo apt-get install r-base | sudo apt-get install r-base-dev | sudo apt-get build-dep r-base-dev `---- ,----[ .libPaths() shows: ] | "/usr/local/lib/R/site-library" | "/usr/lib/R/site-library" | "/usr/lib/R/library" `---- I realized that the TeXLive Version which can be installed via the Ubuntu Software Center is quite outdated (2009) for my needs. I therefore installed TeXLive 2011 like this: ,----[ TeXLive 2011 installation: ] | 1) download install-tl-unx.tar.gz from http://www.tug.org/texlive/acquire-netinstall.html | 2) tar -xzf install-tl-unx.tar.gz | 3) sudo ./install-tl # see http://www.tug.org/texlive/quickinstall.html (hit "I") | 4) add the newly installed version to PATH (in .profile): | PATH=/usr/local/texlive/2011/bin/x86_64-linux:$PATH `---- So far, so good. I can easily work with R (and TeX) and I can also Sweave a .Rnw file (and obtain the .tex). However, if I apply pdflatex to the .tex file (I actually use latexmk for doing this but that doesn't matter), I obtain: ,----[ error on latexmk'ing the .tex file: ] | ERROR: LaTeX Error: File `Sweave.sty' not found. `---- Clearly, one has to tell LaTeX where Sweave can be found. I known that on the Mac on could set a symbolic link to make LaTeX aware of Sweave. I tried the same under Xubuntu: ,----[ set symbolic link: ] | cd /usr/local/texlive/2011/texmf/tex/latex | sudo ln -s /usr/share/R/share/texmf Sweave `---- However, I still obtain the above error. Some thoughts: 1) Putting Sweave.sty in the same folder as the .tex file works (of course), but I do not want to copy Sweave.sty all the time. 2) Setting the link in /usr/local/texlive/2011/bin/x86_64-linux also led to the same error. How can I set up the symbolic link so that latexmk/pdflatex finds Sweave? Cheers, Marius
Dirk Eddelbuettel
2012-May-25 15:35 UTC
[R-sig-Debian] How to set symbolic link correctly so that LaTeX finds Sweave?
On 25 May 2012 at 17:20, Marius Hofert wrote: | I recently switched from Mac OS X (after 7 years) to Xubuntu 12.04 and I am | quite happy with it so far. I first installed R from source but I was somehow | missing certain things and I thus decided (after a new Xubuntu installation | which I had to make due to other reasons) to install R the "Ubuntu way": Right. | ,----[ R installation: ] | | 1) sudo emacs /etc/apt/sources.list | | 2) add: | | deb http://stat.ethz.ch/CRAN/bin/linux/ubuntu precise/ | | 3) in a terminal: | | gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 | | gpg -a --export E084DAB9 | sudo apt-key add - | | 4) the "standard way": | | sudo apt-get update | | sudo apt-get install r-base | | sudo apt-get install r-base-dev | | sudo apt-get build-dep r-base-dev | `---- 'r-base-dev' should give you everything you need to use CRAN; the build-dep are only needed if you build R from source, which you should not have to. | I realized that the TeXLive Version which can be installed via the Ubuntu Software | Center is quite outdated (2009) for my needs. I therefore installed TeXLive 2011 | like this: "Doctor, doctor: it hurts when I do this." "Well then don't do it." Well this is your problem. On stock Debian and Ubuntu system with the disto's versions of R and TeX, Sweave "just works". If you choose to go another route, you get to pick up the pieces yourself. For the record: edd at max:~$ dpkg -L r-base-core | grep Sweave.sty /usr/share/R/share/texmf/tex/latex/Sweave.sty edd at max:~$ dpkg -L r-base-core | grep "tex/latex" /usr/share/texmf/tex/latex /usr/share/R/share/texmf/tex/latex /usr/share/R/share/texmf/tex/latex/Sweave.sty /usr/share/R/share/texmf/tex/latex/ts1aer.fd /usr/share/R/share/texmf/tex/latex/omscmtt.fd /usr/share/R/share/texmf/tex/latex/omsaett.fd /usr/share/R/share/texmf/tex/latex/ts1aett.fd /usr/share/R/share/texmf/tex/latex/omsaer.fd /usr/share/R/share/texmf/tex/latex/jss.cls /usr/share/R/share/texmf/tex/latex/Rd.sty /usr/share/R/share/texmf/tex/latex/upquote.sty /usr/share/texmf/tex/latex/R edd at max:~$ ls -l /usr/share/texmf/tex/latex total 36 drwxr-xr-x 4 root root 4096 2011-11-18 11:39 beamer drwxr-xr-x 2 root root 12288 2010-05-09 19:35 lm drwxr-xr-x 9 root root 4096 2011-11-18 11:39 pgf drwxr-xr-x 2 root root 4096 2011-05-14 09:06 preview drwxr-xr-x 2 root root 4096 2010-05-06 23:26 prosper lrwxrwxrwx 1 root root 22 2009-10-13 20:56 R -> ../../../R/share/texmf drwxr-xr-x 2 root root 4096 2010-05-06 23:34 tipa drwxr-xr-x 2 root root 4096 2010-05-06 23:26 xcolor edd at max:~$ ls -ld /usr/share/texmf/tex/latex and that symlink which places the 'R' directory into texlive's default search path is added by the R package I maintain. Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
Marius Hofert
2012-May-25 16:57 UTC
[R-sig-Debian] How to set symbolic link correctly so that LaTeX finds Sweave?
On 05/25/2012 05:35 PM, Dirk Eddelbuettel wrote:> On 25 May 2012 at 17:20, Marius Hofert wrote: > | I recently switched from Mac OS X (after 7 years) to Xubuntu 12.04 and I am > | quite happy with it so far. I first installed R from source but I was somehow > | missing certain things and I thus decided (after a new Xubuntu installation > | which I had to make due to other reasons) to install R the "Ubuntu way": > > Right.okay, good (I wasn't sure if it's the "correct" approach, that's why I mentioned it here).> > | ,----[ R installation: ] > | | 1) sudo emacs /etc/apt/sources.list > | | 2) add: > | | debhttp://stat.ethz.ch/CRAN/bin/linux/ubuntu precise/ > | | 3) in a terminal: > | | gpg --keyserver keyserver.ubuntu.com --recv-key E084DAB9 > | | gpg -a --export E084DAB9 | sudo apt-key add - > | | 4) the "standard way": > | | sudo apt-get update > | | sudo apt-get install r-base > | | sudo apt-get install r-base-dev > | | sudo apt-get build-dep r-base-dev > | `---- > > 'r-base-dev' should give you everything you need to use CRAN; the build-dep > are only needed if you build R from source, which you should not have to.Martin Maechler suggested it at some point (we develop "copula") -- not sure anymore why.> | I realized that the TeXLive Version which can be installed via the Ubuntu Software > | Center is quite outdated (2009) for my needs. I therefore installed TeXLive 2011 > | like this: > > "Doctor, doctor: it hurts when I do this." > > "Well then don't do it.":-) In principle, I agree. However, there are certain things that are simply not possible with older versions of software packages (due to org-contacts for example, I need emacs-snapshot).> Well this is your problem. > On stock Debian and Ubuntu system with the > disto's versions of R and TeX, Sweave "just works".Something I don't understand: I specified Sweave.sty (via the link) from the 2009 basic TeXLive installation and it still did not work... (that's why I wasn't sure I installed R/TeX correctly and that's why I gave the information above).> If you choose to go > another route, you get to pick up the pieces yourself. > > For the record: > > edd at max:~$ dpkg -L r-base-core | grep Sweave.sty > /usr/share/R/share/texmf/tex/latex/Sweave.sty(I didn't know this command, thanks). I have the same output.> edd at max:~$ dpkg -L r-base-core | grep "tex/latex" > /usr/share/texmf/tex/latex > /usr/share/R/share/texmf/tex/latex > /usr/share/R/share/texmf/tex/latex/Sweave.sty > /usr/share/R/share/texmf/tex/latex/ts1aer.fd > /usr/share/R/share/texmf/tex/latex/omscmtt.fd > /usr/share/R/share/texmf/tex/latex/omsaett.fd > /usr/share/R/share/texmf/tex/latex/ts1aett.fd > /usr/share/R/share/texmf/tex/latex/omsaer.fd > /usr/share/R/share/texmf/tex/latex/jss.cls > /usr/share/R/share/texmf/tex/latex/Rd.sty > /usr/share/R/share/texmf/tex/latex/upquote.sty > /usr/share/texmf/tex/latex/RAgain, same output.> edd at max:~$ ls -l /usr/share/texmf/tex/latex > total 36 > drwxr-xr-x 4 root root 4096 2011-11-18 11:39 beamer > drwxr-xr-x 2 root root 12288 2010-05-09 19:35 lm > drwxr-xr-x 9 root root 4096 2011-11-18 11:39 pgf > drwxr-xr-x 2 root root 4096 2011-05-14 09:06 preview > drwxr-xr-x 2 root root 4096 2010-05-06 23:26 prosper > lrwxrwxrwx 1 root root 22 2009-10-13 20:56 R -> ../../../R/share/texmf > drwxr-xr-x 2 root root 4096 2010-05-06 23:34 tipa > drwxr-xr-x 2 root root 4096 2010-05-06 23:26 xcolor > edd at max:~$ ls -ld /usr/share/texmf/tex/latex > > and that symlink which places the 'R' directory into texlive's default search > path is added by the R package I maintain.Okay, so I try to achieve something similar by hand: cd /usr/share/texmf/tex/latex sudo ln -s /usr/share/R/share/texmf Sweave Hmmm... still Sweave.sty not found (after texhash& reboot) -- although that's the tex tree of the 2009 TeXLive version. For the 2011 TeXLive version, I tried the command I gave before -- still without success. Unfortunately, the README of TeXLive 2011 does not tell where the tex tree is it installs to. This would be helpful to determine in which directory the symbolic link to /usr/share/R/share/texmk has to be set. Cheers, Marius> Dirk >