With special emphasis on installing only the needful things.
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 communiting 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 typset 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.
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 here.)
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 never notice it is broken when you have to install something missing, so you can labour on for years without caring.
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 cask install basictex
On linux, the default TeXLive installation via homebrew is minimalist.
brew cask install texlive
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
tlmgr as usual
It includes build helpers, e.g.
MikTeX is inimalist per default.
Distro package maanger
One can install the
tex-full or similarly-named distribution package, which is maximalist but fairly well tested.
All this TeX wrangling seems depressing and time-wasting. You can side-step some details by running containerized TeX, and just ignore a lot 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.
Installing TeX packages
Ok, so if I have installed a possibly minimal TeX, I install things as needed, using the TeX package management system
For example, to render jupyter notebooks, I found I needed:
tlmgr install \ adjustbox \ collectbox \ collection-fontsrecommended \ enumitem \ logreq \ ucs \ xstring
There are more examples of dependency sets below.
In addition to the basic system install, on Debian/Ubuntu distro install I needed set it up via:
and possibly also:
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
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, seems to want special care, and its symlink is not correctly created by
tlmgr install biber ln -s ~/.TinyTeX/bin/x86_64-linux/biber ~/bin/biber % linux ln -s ~/Library/TinyTeX/bin/x86_64-darwin/biber /usr/local/bin/tlmgr % macos
Example minimalist TeX dependencies
To handle fancier jupyter notebook via
ipypublish, we also need
tlmgr install \ latexmk \ translations
To handle biblatex:
tlmgr install biblatex
To handle modern referencing:
tlmgr install placeins \ todonotes \ chngcntr \ doi \ mdframed \ needspace \ cleveref
To handle pandoc:
tlmgr install amsfonts \ amsmath \ lm \ unicode-math \ ifxetex \ ifluatex \ listings \ # (if the --listings option is used) fancyvrb \ longtable \ booktabs \ graphicx \ grffile \ xstring \ logreq \ biblatex \ # if biblatex is used biber \ # if biber is used fontspec \ # if xelatex or luatex polyglossia \ # if xelatex xecjk \ # if xelatex bidi # if xelatex
To handle Anki flashcard rendering:
tlmgr install bbm-macros \ dvipng
To handle latex_fragment:
tlmgr install standalone \ preview
tlmgr install epstopdf
To handle Tom Pollard’s markdown thesis:
tlmgr install truncate \ tocloft \ wallpaper \ morefloats \ sectsty \ siunitx \ threeparttable \ l3packages \ l3kernel \ l3experimental
To format orcid references:
tlmgr install academicons
For my thesis
tlmgr install \ setspace \ jknapltx \ realscripts \ xltxtra \ fancyhdr \ fancyvrb \ pdfpages \ algorithms \ biblatex \ biber \ appendices \ glossaries \ textcase \ mfirstuc \ xfor \ datatool \ rsfs
For font variety (mostly math-friendly fonts)
tlmgr install \ ebgaramond \ ebgaramond-maths \ newtx \ gfsneohellenicmath \ mathdesign \ stix2-otf \ baskervillef \ fira \ firamath-otf \ eulervm \ mathpazo \ sfmath \ psnfss \ rsfs
For more of these see the latex math fonts list, and to understand how they work check out the Free math Survey. This is outdated now but is a good conservative starting point AFAICT. tl;dr There is some complicated set of interactions between main font and math font and possibly a special greek font and typsetting engine, and which format my fonts happen to be in (which BTW changes how one must install them, which is in turn dependent upon the OS I am using) and which features I want and what my text encoding is, and if I get any one of those wrong there are weird and unhelpful errors and the whole thing is very far from my top priority so I am trying not to learn anything more about it and will do my best to be unable to advise any further. Fortunately if I copy one of their example configurations things seem to work out OK.
These seem to work: