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
or TEXMF
. 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.) With TEXINPUTS
, you should append (or preppend, if files from the new tree should override other versions) /usr/share/R/share/texmf/tex//
, separated with a :
. For TEXMF
, 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 for TEXMF
you need to copy the full definition, so that it may look like TEXMF='{$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,$TEXMFR,...,$TEXMFDIST}'
(with an appropriate definition of a TEXMFR
environment variable). Editing the configuration file goes the same for TEXMF
, but it's less convenient if you want to change TEXINPUTS
since you also need to edit the various TEXINPUTS.format
for each format
you intend to use. With and envvar, it is easier, since setting TEXINPUTS=:$TEXMFR/tex//
in the environment will insert the appropriate TEXINPUTS.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 by kpsewhich texmf.cnf
(in case of doubt, look at the comments in the file). Include only your definitions, eg:
TEXMFR = /usr/share/R/share/texmf
TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFMAIN,!!$TEXMFLOCAL,$TEXMFR!!$TEXMFDIST}
(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 variable TEXMFCNF
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 a TEXMFR
and adding it to the definition of TEXMF
, as explained above.
sudo texhash
after creating the symlink?sweave
tag? Even though this is a more general problem, this might be of special interest to other sweave users.sweave
: it is about adding an additional path to TeX Live.