I work on XUbuntu 12.04 and I have installed R 2.15
. Since the package manager only provides TeX Live 2009, I use the following to install TeX Live 2011 on XUbuntu:
- download
install-tl-unx.tar.gz
from Installing TeX Live over the Internet tar -xzf install-tl-unx.tar.gz
sudo ./install-tl
# see TeX Live - Quick install (hit "I")add the newly installed version to
PATH
(in.profile
):PATH=/usr/local/texlive/2011/bin/x86_64-linux:$PATH
Whenever I compile a .tex
document containing \usepackage{Sweave}
, I obtain
ERROR: LaTeX Error: File 'Sweave.sty' not found.
Typically, one uses a symbolic link to teach (pdf)latex
(actually, latexmk
in my case) where to find Sweave.sty
. I did the following:
cd /usr/local/texlive/2011/texmf/tex/latex # that's the tex tree obtained by kpsewhich -var-value TEXMFMAIN
sudo ln -s /usr/share/R/share/texmf Sweave
I also created a link named Sweave
in /usr/share/texmf/tex/latex
(via sudo ln -s /usr/share/R/share/texmf Sweave
). In both cases, I still obtain that Sweave.sty
was not found (even after a reboot/texhash
...).
How can I tell pdflatex
where to find Sweave.sty
?
If you need more information about my setup of R
etc., just let me know.
FINAL SOLUTION
Alan's answer below is completely correct. The reason why Sweave.sty
was not found in /usr/local/texlive/texmf-local/tex/latex
is that I installed TeXLive 2011 via sudo
and so I also had to execute mktexlsr
via sudo
. The problem is (see sudo which mktexlsr
vs which mktexlsr
) that sudo mktexlsr
updates only the old (2009) TeXLive tex tree. I found two posts that precisely address this (http://compgroups.net/comp.text.tex/texlive-not-searching-texmflocal/266185 and http://ubuntuforums.org/showthread.php?t=1843563). The final solution is to sudo chown -R myuser:myuser /usr/local/texlive
. Then one can simply use mktexlsr
(without sudo
) to update the new (2011) TeXLive tex tree. Then, Sweave.sty
is found as Alan described.