-
Notifications
You must be signed in to change notification settings - Fork 15
LaTeX Tips
- If there are two instances of latexmk running, kill all but one (remember, Vim has these running too).
- Run make nuke, make clean, make clean2 (yes, I need to merge these). Make sure that biber's clean didn't kill nuke too (fix this)
- rerun latemk
- Comment out .bib and repeat 1-3
- Repeat, doing bisectional search of commenting out each document
- If you haven't found the bug yet, go outside and drink a beer. then make a new directory, move one file at a time over, and start at 1. again.
I'm trying BasicTeX so I have to download all 47 terabytes of shitty MacTex. However, while it downloads quickly, any pain and suffering is merely delayed as vital packages need to be installed through the utter abomination (it requires sudo
FFS!) that is tlmgr
(oh, and you probably need to call texhash
after run of tlmgr
). Here are packages I needed to get a recent PDF to build:
$ brew install ghostscript # or else your images won't show up at all, with no
# warning or anything (or maybe there was a warning in the 50,000 pages
# of text that scrolled by your screen in two milliseconds)
$ sudo tlmgr collection-fontsrecommended
$ tlmgr install bbm
$ tlmgr install bbm-macros
$ sudo tlmgr install latexmk
$ sudo tlmgr install preprint # for fullpage
$ sudo tlmgr install biblatex
$ sudo tlmgr install biber
$ sudo tlmgr install units # for nicefrac
$ sudo tlmgr install wasysym # for gender symbols
VimTeX makes is such good software it makes LaTeX someone less crappy. Here are some useful keys:
-
tse
toggle starred environment. -
tsd
toggle(
and\left
.
Below is a catalog of frustrations I've encountered with LaTeX. I hope this helps poor souls navigate the utter disaster that is LaTeX. Good-looking technical documentation shouldn't rely on software this shitty—especially in the 21st Century. LaTeX is to GCC as _______ is to clang—we desperately need to find that blank.
Nuke everything; this helps sometimes. Throw it in a makefile.
$ rm -f *.aux *.bbl *.blg *.bcf # fuck you LaTeX and your shitty cache bullshit
Sometimes you need:
$ rm -rf `biber --cache` # biber: as shitty as the Canadian singer.
see this post
Add the following to fix the bug \MakeTextLowercase has an extra }.
:
\RequirePackage{fontspec}
\renewcommand\allcapsspacing[1]{{\addfontfeature{LetterSpace=15}#1}}
\renewcommand\smallcapsspacing[1]{{\addfontfeature{LetterSpace=10}#1}}
Here's an issue report.
For some reason, todonotes
broke everything. Purging the cache didn't do anything. It was only until I removed the RequirePackage
statement and the \todo{}
statements. I think this was caused by a \cite
statement in the \todo
.
Summary: LaTeX is trash software that we shouldn't have to put up with, but by some great misfortunate events, it's the best way to create technical documents.
Lots of mysterious errors can be (after a ridiculous amount of work and good luck) traced to issues in .bib
files. Issues in bib files are best confirmed by commenting out the \bibliography{}
line and regenerating. Here are some common causes:
- UTF-8 isn't supported with bibtex (use biber/biblatex, but journals don't always like this)
I've noticed that sometimes corrupt EPS images can interfere in builds (giving mysterious errors that change each time, looking like bibtex errors). Regenerate images and try again.
Random Error messages like "Undefined control sequence", "File ended while scanning use of", and "! Extra }, or forgotten \endgroup" on different re-runs
This is almost certainly due to a .bib
error, typically as there are special LaTeX escapes in the file (e.g. as output by the program Papers. For example, I once had some entries like:
journal = {Trends in Ecology {\&} Evolution},
and others like:
journal = {Trends in Ecology \{\&\} Evolution},
this lead to these different errors, seemingly at random (a giant headache to debug).