[R-sig-Debian] How to set symbolic link correctly so that LaTeX finds Sweave?

Marius Hofert marius.hofert at math.ethz.ch
Fri May 25 17:20:11 CEST 2012


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



More information about the R-SIG-Debian mailing list