# LaΤeΧ

### ...and ΤΕΧ, and ConTeXt and XeTeX and TeXleMeElmo, and other ways of peacocking legacy media

The least worst mathematical typesetting system. A crunchy chunk in the academic writing workflow. De facto standard for mathematicians, especially those who are not so impertinent as to insist in writing in non-English languages, or are so shallow as to not not take simple delight in the painstaking and noble handicraft of manually setting line breaks, or have grad students who will deal with the corner cases for free. That is, a tool that meets the needs of the Tenured Academic admirably, and that the rest of us live with.

Other alternatives include

1. using MS Word, and
2. stabbing your eyeballs with a pencil

… each of which I regard as similarly undesirable, and, to be clear, both marginally less desirable than LaTeX itself, despite my qualms.

Addendum: Yes, I am aware there are differences between ConTeXT and LaTeX and TeX, and that they are all refreshingly different in their choices of pain-points in formatting, interoperation, character set handling, compatibility, and community support. However, standards lock-in being what it is, I believe I can avoid arranging the deckchairs on this sinking boat by waiting for incremental improvements to make a difference. I will discretely wait over here, near the HTML lifeboats, for some amped-up scholarly version of Markdown to come save me.

## History

Eddie Smith, From boiling lead and black art: An essay on the history of mathematical typography; the only thing on this page you might conceivably read for pleasure.

Robert Kosara has an excellent rant:

The tools of the trade for academics and others who write research papers are among the worst software has to offer. Whether it’s writing or citation management, there are countless issues and annoyances. How is it possible that this fairly straightforward category of software is so outdated and awful?

Grad students, Robert. Grad student labour. The same labour undervaluation that keeps slave economies from developing the steam engine.

## Documentation I frequently need to find

### Include LaTeX in python

Including arbitrary LaTeX in python scripts, jupyter notebooks, Pweave literate documents, using an ingenious script using latex_fragment. It was written by that paragon of coding cleanliness, by that tireless crusader for not-dicking-around, me.

from IPython.display import display_latex, display
import latex_fragment
l = latex_fragment.LatexFragment(r'$x=y$')
display(l)


### Make TeX run like a normal unix program

As opposed to the default pointless-error-interaction-mode-that-thought-it-would-be-hip-briefly-in-the-80s.

pdflatex -interaction=nonstopmode -halt-on-error


Bloody-minded compile-my-document-at-all-costs-I-don’t-care-how-it-is-broken:

pdflatex -interaction=batchmode


### Death-or-macro definition

Death-or-macro that force macro definition redefinition even if there is no definition to be redefined - handy if you are rendering latex from some tricky source such as jupyter or where you don’t have much control over the document, but don’t care because latex is merely some nondescript obstacle between you and publication and you are don’t wish to waste attentin upon it.

\providecommand{\foo}{}
\renewcommand{\foo}[1]{bar: #1}


### Algorithms/pseudocode

Confusing profusion of options.

tl;dr: use * a hip markup such as

• algorithmicx + algpseudocode (a nice default syntax that comes with algorithmicx), or
• program
• inside an algorithm float.

Are you running minimalist TeX? You’ll need

tlmgr install algorithmicx algorithms


## Minimalist TeX

MacTeX wastes 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 real with their svelte little elegant alternative. That’s not “serious typesetting”, any more than driving a Panzer to work is “serious commuting”. It might be hand-made, but that ain’t artisinal stuff, that’s tin hat survivalist type prepper bullshit, with serious collateral damage.

However! You can install what you need via the package manager tlmgr using the minimal distribution, basictex. Which is still hundreds of megabytes, but we are going to have to take what we can get here.

Then you install the extra things you need.

For example, to render jupyter notebooks, you’ll need:

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


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 biblatex \
biber \
xstring \
logreq


To handle Anki flashcard rendering:

tlmgr install bbm-macros \
dvipng


To handle latex_fragment:

tlmgr install standalone \
preview


You keep it up to date in a similar way:

tlmgr update --self
tlmgr update --all


## No TeX at all

You just want equations? You don’t need TeX-the-software, just TeX-the-markup. Lots of things can render TeX math.

## Editors

• Mathematica can export mathematics to TeX and is a good, if collossally overengineered, editor
• TeXStudio has image drag-n-drop support
• atom-latex and the atom latex package both bring LaTeX support to the Atom editor though I haven’t yet worked out the difference. The latter supports literate coding so is morally superior.
• texshop is the open-source stalwart editor on e.g. OSX.
• TeXmacs - if you want to integrate a beautiful but obscure and poorly maintained notebook-style interface with your typesetting. Many do. I’d rather use knitr etc for integrating my diagrams and keep the GUIs separate, but this is personal preference.