LaTeX Pet peeves
Here are some of my very personal LaTeX pet peeves. Not being aware of these will probably not make any difference in your life unless you’re working with me. π
Not using the tilde (~), the “glue”
The tilde ~ is a non-breaking space, or you can think of it as a transparent ‘glue’ that occupies a little bit of space. It prevents LaTeX from inserting a line break at that position. If you don’t have a space, the citations become too close to the last word. A space without tilde can end up with citations, references, or numbers orphaned at the start of a line, which looks awkward (to me).
πββοΈ
as shown by Author\cite{author2024}.
as shown by Author \cite{author2024}.
Dr. Smith ...
see Figure \ref{fig:results}
πββοΈ
as shown by Author~\cite{author2024}.
Dr.~Smith ...
see Figure~\ref{fig:results}
When to use it
The most common usages of ~ are:
- Before
\cite{}: keeps the citation attached to the preceding word - Before
\ref{}: keeps “Figure 1” or “Table 2” together - After titles:
Dr.~Smith - With numbers and units:
100~kg
The general rule: if a line break between two elements would look wrong, use ~.
When NOT to use it
Unlike \cite{}, in most cases, footnotes should not have a tilde before them. The footnote mark is a superscript that attaches directly to the preceding word or punctuationβadding a space would create an awkward gap.
πββοΈ
This is important~\footnote{...} because ...
πββοΈ
This is important\footnote{...} and the sentence continues.
This is important.\footnote{...}
At the end of a sentence, the footnote typically goes after the period (American style). Some style guides place it before, so check your target venueβbut never with a tilde either way.
Hyphen, n-dash, m-dash, and minus sign
There are specific use cases for each of the dashes and you want to use them appropriately. You can look up how they should be used, but here’s a summary:
| Name | LaTeX | Use |
|---|---|---|
| Hyphen | - |
Compound words, line breaks |
| En-dash | -- |
Ranges, connections |
| Em-dash | --- |
Parenthetical breaks |
We don’t have to use en-dash much, so em-dash is usually my problem. Em-dash is used for parenthetical statements. The thing about em-dash is that it’s visually much more distinct than using a comma while not as abrupt as parentheses. In LaTeX, I think em-dash without any space creates just the right amount of spacing; having space around em-dash makes the phrases too far apart (all to my eyes).
πββοΈ
The results - surprising as they were - confirmed our hypothesis.
The results --- surprising as they were --- confirmed our hypothesis.
πββοΈ
The results---surprising as they were---confirmed our hypothesis.
And, while we’re at it… a hyphen is also not a minus sign.
πββοΈ
The temperature was -10 degrees.
πββοΈ
The temperature was $-10$ degrees.
Mixing these symbols is not the end of the world (and there are multiple conflicting style guides) but I think it’s still good to follow these conventions (and looks nicer).
Quotation marks
LaTeX doesn’t understand straight quotes (") natively. Some editors auto-insert curly “fancy” quotes when you type the quotes, and actually some LaTeX compilers may handle them properly (with the right encoding/font setup). But, this is not reliable π«£.
For proper typeset quotation marks, use backticks for opening and apostrophes for closing.
πββοΈ
She said "the word 'glyph' is lovely" to her friend.
πββοΈ
She said ``the word `glyph' is lovely'' to her friend.