I'd like to add 'Sweave.sty' to my search-path, so that I don't need to copy 'Sweave.sty' to every Sweave-Document I create.
I've located 'Sweave.sty' in '/usr/share/R/share/texmf/tex/latex'. I tried to create a symlink to this folder in my package-folder, however, this didn't really work.
Anyway, I think adding this folder to TeXLive's search path would be the most elegant solution. I also found instructions on how to expand the search path in TexLive (here). Well, I seem to be too stupid to understand that 🙁 Could somebody explain in clear words how I can add the path mentioned above to my search path?
Thank you!
Best Answer
There are (at least) two parameters you may want to set, and two ways to set them (env var vs conf file) and finally you might want the setting to be system-wide or user specific. Since all this is more or less orthogonal, it makes like 8 possibilities.
First, you may change either
TEXINPUTS
orTEXMF
. The former acts only of TeX's input search path, the later is also used by other tools (imagine the tree contains fonts, bibtex or makeindex styles, etc.) WithTEXINPUTS
, you should append (or preppend, if files from the new tree should override other versions)/usr/share/R/share/texmf/tex//
, separated with a:
. ForTEXMF
, should need to insert the same path where you want inside the braces in the current definition.Second, environment vs configuration file. For the environment, adding something to
TEXINPUTS
is easy, but forTEXMF
you need to copy the full definition, so that it may look likeTEXMF='{$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,$TEXMFR,...,$TEXMFDIST}'
(with an appropriate definition of aTEXMFR
environment variable). Editing the configuration file goes the same forTEXMF
, but it's less convenient if you want to changeTEXINPUTS
since you also need to edit the variousTEXINPUTS.format
for eachformat
you intend to use. With and envvar, it is easier, since settingTEXINPUTS=:$TEXMFR/tex//
in the environment will insert the appropriateTEXINPUTS.format
from the conffile before the leading colon.Finally, user vs system. If you chose to use envvars, I refer you to your favourite shell's (and desktop environment) documentation. For configuration files, it should be noted that, system-wide, there are usually two
texmf.cnf
files which are both read. You should edit the first one returned bykpsewhich texmf.cnf
(in case of doubt, look at the comments in the file). Include only your definitions, eg:(this is my preferred option btw). Note that if you use a packaged (by Debian or other) version of TeX Live, this may change, see Sylvain's answer. If you want to proceed for a single user, it's harder, because you should place a full (edited) copy of the original
texmf.cnf
file in some place (~/.texlive2010/texmf-config/web2c
would be a ratonal choice) and defined an environment variableTEXMFCNF
pointing to that directory.I hope I didn't got you confused with too much choices, but I thought it might be interesting to explore the different options. If you have admin rights, I'd recommend editing the system-wide additional
texmf.cnf
to define aTEXMFR
and adding it to the definition ofTEXMF
, as explained above.