Installing a Latex Package
Installing a Latex Package for your own use.
You may wish to download the package you will be using in any subdirectory of your home directory, but if you wish to have several packages installed we recommend you to install them in the same folder, as bellow. If it is your first time you may choose to follow the following steps, if you already have some packages installed, you can repeat the steps presented bellow, and then move your packages into the new created directory.
Open a terminal and create the following folder in your home directory
mkdir -p $HOME/texmf/dist $HOME/texmf/tex/latex
Decide now what package you wish to have installed and find out where you can get it from. Places to have a look are, among others,
ftp://ftp.tex.ac.uk/tex-archive/ ftp://tug.ctan.org/pub/tex-archive/
Let us choose an example of a package, vita, for creating CVs. It can be found at
ftp://cam.ctan.org/tex-archive/macros/latex/contrib/vita.zip
We would then to the following for installing this package
cd $HOME/texmf/dist wget ftp://cam.ctan.org/tex-archive/macros/latex/contrib/vita.zip cd $HOME/texmf/tex/latex/ unzip $HOME/texmf/dist/vita.zip
Now we need to tell tex/latex to look into $HOME/texmf/tex subdirectories when compiling tex files. This is done by runing, if you use bash,
export TEXINPUTS=".:$HOME/texmf/tex//::" export LATEXINPUTS=".:$HOME/texmf/tex/latex//::"
This tells tex and latex to look for class/style files into the several paths separated by ":". First it will look in the same directory as the file being compile (.); then into ~/texmf/tex/ and ~/texmf/tex/latex/ and their subdirectories (this is set by using double slashes at the end '//'), finaly it will look into the central tex repository (::). You can put these two lines in your ~/.bashrc file so you have these variables set everytime you open a terminal. If you use cshell or variants, the syntax changes to
setenv TEXINPUTS ".:$HOME/texmf/tex//::" setenv LATEXINPUTS ".:$HOME/texmf/tex/latex//::"
again, you can add these to your .cshrc or .tcshrc. Some of the packages you are installing might require other variables to be setup. Examples are BSTINPUTS, BIBINPUTS for bibtex packages, TEXPSHEADERS, DVIPSHEADERS for dvips and so on. The syntax is similar as to the one for TEXINPUTS. Remeber to alway add at the end the "::" for having the DAMTP default added.
All these variables are not setup from start. If you wish to know what the default values are, you can use the command
kpsewhich -expand-var VARNAME
with VARNAME replaced by the variable you wish to see, for instance
kpsewhich -expand-var TEXINPUTS