Wwoods/Common LaTeX formatting errors

From DPWiki
Jump to navigation Jump to search

This is a list of errors commonly made in formatting LaTeX projects.

Nonbreaking spaces

There are occasions when we wish to prevent a linebreak from occurring between two words or letters. For instance, we'd rather that "P. D. Q. Bach" weren't broken between the initials. In LaTeX, "~" is the nonbreaking space, so the way to format the name is "P.~D.~Q. Bach". If there weren't quite so many initials, we'd want to tie them to the last name: "M.~Butterfly".

Spacing after periods

LaTeX treats a period after anything except a capital letter as the full stop at the end of a sentence, and puts a bit more space after it than the space between words within a sentence. When this is wrong, e.g. after "e.g. " or in "Fig. 33", we need to add a "~" or "", depending on whether we want a regular or nonbreaking space: "e.g.\ " or "Fig.~33".

Conversely, LaTeX assumes a period following a capital letter just marks an abbreviation. When it actually does fall at the end of a sentence, e.g. "Q.E.D. Now, next..." it needs to be marked with a "\@": "Q.E.D\@. Now, next..."

Blank lines missing or present after displayed math

It's often hard to tell from the vertical spacing whether a line of text after a line of math in a displayed environment, which adds some whitespace around the math.

and thus we see that

eπi = –1.

This means that...

Look at the context. In a project in which paragraphs are indented