Bloerg
       

LaTeX package installation with tex-get

If you are running a Linux system, you probably install your TeX Live distribution from you Linux distribution’s package manager. The current Ubuntu 12.04 LTS ships TeX Live 2009 which is … old and a treasure trove of TeX stackexchange questions.

A common answer to questions like “how can I install package XYZ locally?” is to install them into the local texmf tree”. The TeX Live distribution comes with its own package manager called tlmgr but Debian decided to drop it in favor of their own packaging system. So, one other option to update or install missing packages, is populating a local texmf tree.

The installation is actually quite simple except that packages litter their files all over the place; a problem that was recently solved in the Vim community by run-time managers such as Pathogen or Vundle. So, how would you do it? First, grab the zipped package from CTAN and extract it somewhere. Now you need to find out where your texmf tree is located with

kpsewhich -var-value=TEXMFHOME

and put the .sty, .bst etc. files in the respective subdirectories. The LaTeX Wikibook gives a good overview, what belongs where. Although you could place the files in the top-level directories (e.g. all .sty files in ~/texmf/tex/latex) it’s a better idea to separate things into package subdirectories. If there are no .sty files, you might need to generate them by running LaTeX on the .ind files and install the generated files. You now have fully working manually maintained packages but managing more than one package will become a real chore eventually.

To help me with all the tedious tasks, I wrote a little shell script called tex-get. It checks if any files need to be generated and places everything into their respective destination directories. While doing so, all installed filenames are recorded in a manifest file, which is then used for removal of the package. The commandline interface is similar to apt-get, hence you can install and remove packages with

tex-get install l3kernel
tex-get remove l3kernel

However, unlike a real package system, dependencies are not resolved. Moreover, no documentation is generated and no font files are (yet) installed. Anyway, suggestions and improvements are very welcome.

Discussion