Adding a new package to a latex install on linux

Each time I reinstall linux or change machines, I find myself having to add a bunch of latex packages and style files. I quite often forget exactly how to do this, so here’s a quick guide to installing latex packages for anyone else struggling with the details and also for my future self, next time I upgrade.

  1. Get the package that you want from the Comprehensive Tex Archive Network CTAN; for example, if you want the remarkably useful package multibib (allows multiple bibliographies in one document) go here
  2. Download and unzip the zip file containing the entire package
  3. Run latex on the .ins file, which should create a file called .sty
    hannah@pear $ latex multibib.ins
  4. Make a directory for it to go in in your texmf tree
    hannah@pear $ sudo mkdir /usr/share/texmf/tex/latex/multibib
  5. Put it in that directory
    hannah@pear $ sudo cp multibib.sty /usr/share/texmf/tex/latex/multibib
  6. Run texhash to tell LaTeX to update itself so it finds the new package
    hannah@pear $ sudo texhash

Job done!

5 thoughts on “Adding a new package to a latex install on linux

  1. Dear Hannah,

    your routine still works great. Thanks for posting it!

    Best wishes from Germany

  2. Thank you for this post, Hannah! It was the only one on the first Googe results page that actually worked for me.

    Best regards from Chubut, Argentina.

  3. Thank you for the tip Hannah – I’m just starting out with Latex, so this was a real time saver! Just to be cautious, I chown’d my Tex dirs so that I didn’t need sudo.

Leave a Reply

Your email address will not be published. Required fields are marked *