 |
Department of Engineering |
 |
 |
Configuring LaTeX
Note: unless you're a heavy LaTeX user it's very unlikely that you'll
need to know what's on this page. Proceed at your own risk!
Using non-system packages
If you use \usepackage{foo} latex will look for a file called
foo.sty
in one of several directories. It will use the first foo.sty it finds,
displaying the location on screen. If you want to use packages that aren't centrally stored,
you need to tell latex where the packages are. By default it will look in
the current directory, but you may want to keep all your extra files
elsewhere.
The list of directories searched can be controlled using the
TEXINPUTS environmental variable. If you type
echo $TEXINPUTS
on a Unix system you'll see if/how it's been set for you. Mine is
currently
TEXINPUTS=:/homes/users/g/tpl/.TeX:/usr/share/doc/.TeX:/usr/doc/.TeX
Typing
export TEXINPUTS=~/tex//:
before using latex will make latex search in your ~/tex/
directory before looking at system
files. Note that in this context
- '//' means 'search subdirectories recursively'.
- if you miss out the first or final ':' only your files will be searched
If there's a file called ls-R in any of these directories it will
contain a list of files under that directory. LaTeX will use this list rather
than search the directories, so if you have many files under ~/tex/ you can speed things up by
typing "mktexlsr ~/tex". This
creates a ~/tex/ls-R file which lists all the files
under the ~/tex/ directory so that latex doesn't have to do an
extensive file search. You still need to modify the
TEXINPUTS environmental variable as above, and you may also need to
change the TEXMFDBS environmental variable - this controls where
latex looks for ls-R files. Typing
export TEXMFDBS=~/tex//:
should be enough.
Using texmf.cnf
When latex starts it reads configuration information from a file
called texmf.cnf. You can find where that is by typing
kpsewhich texmf.cnf
You may be able to
override some of the parameters there by creating a texmf.cnf
file of your own. For more information read the file - it's commented.
Debugging
If files aren't being found or latex is slow you might want to
try debugging.
latex and associated programs make use of the same
facility to search for files. You can run the facility independently to
determine configuration details -
- kpsewhich --show-path=ls-R - shows where ls-R
files are sought.
- kpsewhich --show-path=tex - shows where .tex
files are sought.
- kpsewhich -debug=32 packagename.sty - shows which packagename.sty file is used - and why.
- kpsewhich --progname=latex packagename.sty - shows which
packagename.sty file will be used by latex
(different latex-related programs may use different paths)
Sysman notes