LaTeX Installation

November 20, 2019 — April 19, 2021

computers are awful
faster pussycat
Figure 1: A grad student tackles the dependencies

With special emphasis on installing only the needful things.

Per default, distributions like MacTeX or MikTex or TexLive or whatever waste your hard disk space if you install the whole gigantic thing. 5Gb for a 1980s typesetting system is cheeky, especially from people who delight in claiming that Microsoft Word is over-engineered, and that they are keeping it serious with their svelte, elegant, professional alternative. But LaTeX is not “serious typesetting”, except in the sense that driving a panzer to work is “serious commuting”. (In this commuting metaphor, Microsoft Word is some kind of polka-dotted clown car, as far as mathematics is concerned.)

Alternatively I could still use most of the LaTeX markup to typeset my mathematics but not for everything else; this is the LaTeX-free mathematics option.

For all the options, I will need to think additionally too hard about fonts.

1 Tectonic

I am trying tectonic out currently. Nothing has broken so far. It is a minimal re-imagining of the TeX distributions with modern dev tools and behaviour. It magically installs whatever I need. I quite like it.

2 Minimalist TeX distribution

However! You can install only what you need using a so-called “minimalist” distribution. (Which is still hundreds of megabytes, but we are going to have to take what breaks we can.)

A gotcha for this method is that it only works for one year, then you must start over. Then I get cut off from updates, and have to do a tedious procedure to get another year’s life out of TeX. You can avoid this with the monumental maximalist TeXes not because they do not suffer from this problem, but because they install so much stuff all at once that you rarely notice anything missing, so you can labour on for years with an increasingly obsolescent version self-contained system.

I do not have the drive space to waste on this.

2.1 Minimalist TeXLive

A generic way of doing this on macOS is to install basictex, the minimalist version of TeXLive.

On macOS at least, this command installed minimal TeX.

brew install --cask basictex

On linux, the default TeXLive installation via homebrew is minimalist.

brew install --cask texlive

2.2 TinyTeX

If you are an R user, there is tinytex, a semi-managed minimalist LaTeX distribution based on TeXLive but with better defaults, which will automatically install what given R packages need.


You install things via


or using tlmgr as usual

It includes build helpers, e.g.


Most fancy of all, if you are in the same folder as a TeX log for some failed build, you can automagically attempt to find the missing pieces


It is worth keeping an R console open just for this.

2.3 MikTeX

MikTeX is minimalist per default AFAICT. Have not used.

3 Distro package maanger

One can install the tex-full or similarly-named distribution package, which is maximalist but fairly well tested, and also fairly outdated by the time the distro ships.

4 Docker TeX

All this TeX wrangling seems depressing and time-wasting. You can side-step some details by running containerized TeX, and ignore some of the nonsense. (Not the hard disk space wastage and bloat; that is kind of built-in.) blang/latex-docker is one set of such dockerfiles with a good reputation. There are some newer ones, e.g. schickling/latex, about which I know yet less. qmcgaw/latexdevcontainer targets my IDE specifically.

5 Installing TeX packages

Ok, so if I have installed a minimal TeX, I install things as needed using the TeX package management system tlmgr.

For example, to render jupyter notebooks, I found I needed:

tlmgr install \
    adjustbox \
    collectbox \
    collection-fontsrecommended \
    enumitem \
    logreq \
    ucs \

There are more examples of dependency sets below.

In addition to the basic system install, on Debian/Ubuntu distro install I needed set up user packages via:

tlmgr init-usertree

and possibly also:

sudo apt install xzdec

If that doesn’t work you might need alternate methods such as manual install, or TinyTex, documented below.

When I am not sure precisely which TwX package I need but I do know the name of a file which is missing, e.g. times.sty, the following command will find me candidates.

tlmgr search --global --file "/times.sty"

Weird errors can arise in this manual method. When I got .fmt made by different executable version, the following magical incantation seemed to fix it.

sudo fmtutil --all


sudo fmtutil-sys --all

I keep the installation up to date using the following incantation:

tlmgr update --self --all
tlmgr path add
fmtutil-sys --all

Alone amongst all the packages I have tried, biber, the biblatex executable, and dvipng, the png backend for DVI rendering seems to want special care, and need their symlinks created manually.

tlmgr install biber
ln -s ~/.TinyTeX/bin/*/biber ~/bin/  # linux
ln -s ~/Library/TinyTeX/bin/*/biber /usr/local/bin/  # macos
tlmgr install dvipng
ln -s ~/.TinyTeX/bin/*/dvipng ~/bin/  # linux
ln -s ~/Library/TinyTeX/bin/*/dvipng /usr/local/bin/  # macos

presumably nothing bad would happen if I just linked everything:

ln -s ~/.TinyTeX/bin/*/* ~/bin/  # linux
ln -s ~/Library/TinyTeX/bin/*/* /usr/local/bin/  # macos

5.1 Example TeX dependencies

To handle fancier jupyter notebook via ipypublish, we also need

tlmgr install \
    latexmk \

To handle biblatex:

tlmgr install biblatex

To handle modern referencing:

tlmgr install placeins \
    todonotes \
    chngcntr \
    doi \
    mdframed \
    needspace \

To handle pandoc:

tlmgr install amsfonts \
    amsmath \
    lm \
    unicode-math \
    listings  \
    fancyvrb \
    booktabs \
    grffile \
    xstring \
    logreq \
    biblatex \
    biber \
    fontspec \
    polyglossia  \
    xecjk \


tlmgr install amsfonts \
    amsmath \
    pm \
    amscls \

To handle Anki flashcard rendering:

tlmgr install bbm-macros \

To handle latex_fragment:

tlmgr install standalone \

To handle .eps files.

tlmgr install epstopdf

To handle Tom Pollard’s markdown thesis:

tlmgr install truncate \
    tocloft \
    wallpaper \
    morefloats \
    sectsty \
    siunitx \
    threeparttable \
    l3packages \
    l3kernel \

To format orcid references:

tlmgr install academicons

6 Fonts

See LaTeX fonts.

7 Mirror choice

The default option of

tlmgr option repository

does not work in Australia because it will try to download from some hapless server in Indonesia.

Here we must instead set

tlmgr option repository