Skip to content

LaTeX

Tex is programming language used to well formatted documents (aka: typesetting system)
Latex is a macro langauge on top of tex that allows gives you simpler functions to format text.

$ latexmk -lualatex -pvc -view=pdf -f -outdir=build document.tex

^ compiles tex file into a pdf and continuously reloads

Documentation

The official documentaiton is in LaTex pdfs and is impossible to navigate, https://www.latex-project.org/help/documentation/... so use unofficial docs...

Unofficial Documentation

Compile

On Mac, install basictex (smaller distro of MacTeX). Includes TeX, LaTeX, pdfTeX, MetaFont, dvips, MetaPost, and XeTeX.

Also, install skim pdf viewer for ability to autoreload pdf when changed.

### Install Dependencies
$ brew install --cask basictex skim
$ sudo tlmgr install latexmk # latex tool
$ echo "$pdf_previewer = 'open -a Skim';" >> ~/.latexmkrc

You can either compile using helper package latexmk or calling the compiler directly.

### Compile/Generate PDF
$ latexmk -lualatex -pvc -view=pdf -outdir=build document.tex
$ lualatex document.tex && latexmk -c

### Remove auxillary files
$ latexmk -xelatex -c 
$ latexmk -c

Compiling Engines:

Compiling Engines Year Support (Unicode/etc) Notes
latex 1990s None
pdflatex 2000s Limited
xelatex idk Yes slower
lualatex idk Yes even slower,
programming support

Package Manager

Package manager automatically added when you install basictex

$ sudo tlmgr install <package-name> # tex live manager
$ sudo tlmgr update --self

Useful packages

$ latexmk # Runs latex compiler
$ sudo tlmgr install tinos # install fonts

Example File

Minimum page to be able to compile (won't generate pdf though):

filename: document.tex

$ \documentclass{article}
$ \begin{document}
$ \end{document}

Online Editor

Overleaf software was conceived by John Hammersley and John Lees-Miller, who started developing it in 2011.

Tex Distributions

TeX Live is the standard distribution of TeX, LaTeX, and related programs produced by TeX Users Groups across the world (All offline/online Editors use this to compile tex files)

  • MiKTeX for Windows
  • TeX Live for Linux and other UNIX-like systems
  • MacTeX redistribution of TeX Live for macOS
  • teTeX for Linux and other UNIX-like systems; it is no longer actively maintained now
  • proTeXt is based on MiKTeX

Source: https://www.overleaf.com/learn/latex/Choosing_a_LaTeX_Compiler%23Other_compilers