My LaTeX Workflow – LaTeX Installation

Published on
This post is part of my series on my LaTeX workflow. In it, I explain how you can install LaTeX and keep it up-to-date. Similarly, LaTeX packages can be installed and updated. Finally I describe a usefull trick how you can import arbitrary LaTeX files like installed packages.

Installing and updating LaTeX can be rather confusing at first, as it works a little different from most software you are used to. But if you stick to the following recommendations, you should be fine.

  1. There is a new LaTeX release once every year. Install it once it becomes available.
    LaTeX is actively developed and some packages cannot support old LaTeX versions. To use these packages, a current LaTeX installation is a must. Besides that, new releases bring bug fixes and new features.
  2. Don't try to update LaTeX, but install a new version.
    Install the new version as if you don't have LaTeX installed at all. Don't try to somehow update your existing LaTeX installation. A complete reinstallation is a lot easier.
  3. You can and should update the LaTeX packages throughout the year.
    A package fixed a bug and you don't want to wait several months for the new LaTeX release? Update the package itself!

So how do you install LaTeX and keep it up-to-date? Read on!

Installing LaTeX

To use LaTeX we have to install it first. If you are on a Mac use MacTex which is a wrapper around TeX Live and if you are on Windows or Linux use TeX Live directly.

And while we are on the topic, please open a terminal now and run tex -version, which prints your current TeX Live version. If it is outdated, i.e., the displayed year is not the current or last year, you might want to consider reinstalling a newer TeX Live version.

There are two versions of TeX Live:

  • the full one that contains all LaTeX packages ever written
  • and the basic (much smaller) version that installs only the most commonly used packages.

While the basic version needs only a fraction of the storage space of the full version, installing every additional package is annoying. Especially because when you update LaTeX each year, you have to install the additional packages again by hand. So my recommendation is to only use the basic version if you really have storage problems and cannot install LaTeX otherwise.

Installing and Updating Packages

Sometimes you have to install new LaTeX packages, either because you choose the basic LaTeX installation or because the package you want to use is very new. You encounter this situation usually if an error of the following form appears during the compilation:

! LaTeX Error: File `packagename.sty' not found.

Here you have to install the LaTeX package with the name packagename. To do so, open the TeX Live Utility application (Mac only) which comes preinstalled with LaTeX, go to the Packages-tab and search for the name of the package. Right-click on the package and choose Install Selected Packages.

If the TeX Live Utility does not show a package with the correct name, it might be that the packagename.sty file is included in a package with a different name. To find the correct package name go to CTAN, search for packagename.sty and the correct package should appear.

Updating the LaTeX packages is equally simple: open the TeX Live Utility, go to the Updates-tab, right-click and choose Update All Packages. I do this approximately once per month.

Using Files as Packages

Imagine you want to use LaTeX projects like kaobook, quiver, ... that are not yet released on CTAN, or have a few of your own commands that you want to use in all of your projects. You could put the commands in a file that you copy from project to project. However, this means updating the file will be a nightmare.

A better alternative would be to put this file at a special location such that you can import it like a normal LaTeX package. This way you only have to modify a single file and all your projects benefit from the updates.

On a Mac, this special directory is

/Users/<user_name>/Library/texmf/tex/latex/

On other operating systems, you can find the correct folder by opening a terminal and running

kpsewhich -var-value=TEXMFHOME

and adding the subfolders /tex/latex.

In this folder you can create files in the following folder structure:

/Users/<user_name>/Library/texmf/tex/latex/
  ├─ kaobook
  │  ├─ kao.sty
  │  ├─ kaobiblio.sty
  │  ├─ kaobook.cls
  │  ├─ kaohandt.cls
  │  ├─ kaorefs.sty
  │  └─ kaotheorems.sty
  └─ quiver
     └─ quiver.sty

You can even put git-repositories in these folders. Once you've added the files to this folder, you can use kaobook and quiver like normal packages:

\documentclass{kaobook}
\usepackage{quiver}

\begin{document}
kaobook document with quiver loaded
\end{document}

This post is part of my series on my LaTeX workflow.