Adding a new package to a latex install on linux

January 5, 2012 - Geekiness

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 http://ctan.org/; for example, if you want the remarkably useful package multibib (allows multiple bibliographies in one document) go here http://ctan.org/tex-archive/macros/latex/contrib/multibib.
  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!

Comments

  1. Benedikt says:

    Dear Hannah,

    your routine still works great. Thanks for posting it!

    Best wishes from Germany
    /Benedikt

  2. Luciano says:

    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.
    Luciano.

  3. Andy says:

    Thank you so much. This is going in the bookmarks.

  4. Christopher says:

    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.

  5. Rizel says:

    <3 Thanks!
    As Andy, this goes to my bookmarks.

  6. Zishaan says:

    Worked like a charm :-) Thank you so much

Leave a Reply

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