Installing LaTeX Packages in Local or Home Directory


A \LaTex package is a file or collection of files, which provide add-on features for \LaTex. Most of \LaTeX installations come with pre-installated packages, which are sufficient for catering the majority of our requirements.

\LaTeX packages are stored under texmf tree, i.e., in subdirectories of texmf/tex/latex named after each package. CTAN has more than 4500 pack­ages which can be downloaded from here.

I prefer to install the additional packages in home or local directory. The advantage is when you are migrating to a new computer you just need to copy your personal texmf tree.

Here are the instructions to install a \LaTeX package in the home directory (Ubuntu OS) of a user.

Package Installation in home

    • Create a personal texmf tree in home directory(Only for the first time when installing a package),
      cd ~
      mkdir -p texmf/tex/latex/
    • Download the package you want to install, from CTAN. Let’s say it is CirciTikz.
    • Unzip the package now.
       gunzip circuitikz.zip 

      Check for .sty and other files in the extracted ‘circuitikz’ folder.

    • Move the unzipped ‘circuitikz’ directory to ~/texmf/tex/latex/
      mv circuitikz ~/texmf/tex/latex/
    • Now, make LaTeX to recognize the new package:
       texhash ~/texmf

The disadvantage of installing packages in personal texmf tree is that those packages are not available to other users in a multi-user computer. Other users have to copy whole personal texmf tree to make use of these packages.

Further reading

LaTeX : Wiki Books

Leave a Comment