Tuesday, 11 January 2011

LateX packages on Ubuntu

To install LateX packages on Ubuntu:
- Download the package from CTAN, the Comprehensive TeX Archive Network
All files should be placed in the same directory, so it can be found by LateX. This will also allow to move everything in one go, if you want to build up a new system. To be found by LateX, the following directory tree must be respected.
- Create a folder in your home directory called texmf/tex/latex/packagefoldername (if you have multiple users on the same computer, you'll need to create a folder on every home directory):
e.g. texmf/tex/latex/listings
- If your package is a made of a single file with .sty extension, just place it in the folder and that's it. It will be accessed by LateX.
- If the package is made of several files, copy all files into the folder you've just created, or at least the file with the .ins extension, and run "latex filename.ins", this will create the filename.sty file. In my case, it was "latex listings.ins"
- Finally run "texhash ~/texmf" for LateX to recognise the new package.

You can now include your package in your .tex files in the preamble, such as:

link to documentation