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.
Best Answer
The reason why your link isn't found is that additions to the main texmf tree require the ls-R databases to be updated using
mktexlsr
. However, the usual place for local additions on a Linux system is~/texmf
. If you put your symbolic link in~/texmf/tex/latex
, then you won't need do anything else for it to be found.You should never place files in any of the
.../texlive/<year>
directories, since they are for the actual distribution files and can be overwritten by updates.If you truly need system-wide local additions (for multiple users) you can put them in
/usr/local/texlive/texmf-local
. If you put things here, you must runsudo mktexlsr
to rebuild the ls-R databases.