General Tips

Focus on the content and the logical format of a document. Let TeX take care of the visual formatting

A main design goal behind TeX and LaTeX is to relieve an author of the burden of having to be concerned with the visual appearance of a document. Given the basic structural elements of a document, TeX is very good at creating a professionally looking typeset output. All TeX needs to know is the logical function of a particular chunk of text, e.g., whether it is a title (indicated by "\title{...}"), a section heading ("\section{...}"), a list item (\item{...}), a theorem (\begin{thm}...\end{thm}), an inline math expression ($...$), a displayed math expression (\[...\]), or ordinary text.

Given such information about the logical structure of a document, TeX will take care of all the rest, e.g., what fonts to use, how much space to insert, where to insert linebreaks within text, whether to center a header, or whether to indent a line. TeX is very good at this, it (or rather its author, Don Knuth) knows more about typesetting conventions than almost any author, and it has very sophisticated algorithms to optimize such things as line and page breaks.

Below are some examples of visual formatting that you should avoid. [There are situations where some manual formatting may be appropriate, in e.g., non-standard (i.e., not "article/book type") documents such as exams, announcements, posters, etc., bibliographies, etc. However, for normal papers, books, and theses, such commands should be used very sparingly, if at all.]

Bottomline: If you let TeX do its job, the result will almost always look better than if you were to try to use manual formatting commands to force a particular look. On top of that, you'll save yourself quite a bit of time by not having to insert manual formatting commands and fiddling with these until the look is right.

Respect the modes of TeX: Use ordinary (text) mode for text, math mode for inline math material, and display math mode for displayed equations

The basic "modes" of TeX are text mode, inline math mode, and display math mode. The default is text mode, intended for ordinary (English) text; this is what TeX uses without any special instructions. A pair of dollar signs indicates to TeX that the enclosed chunck is a mathematical expression and is to be typeset in math mode. Similarly, a backslash-bracket pair, or an equation environment such as \begin{align} ... \end{align}, tells TeX that the enclosed material is a formula to be displayed.

There are significant differences in the typesetting of a given chunk of text depending on the mode TeX is in (e.g., the spacing rules are completely different in math mode than in text mode), and if an inappropriate mode is used, the output can look very poor. Thus, it is important to ensure that TeX is in the correct mode, e.g., by enclosing all (inline) math material in a pair of dollar signs, while leaving nonmath material outside dollar sign pairs. This might seem like an obvious rule, but it is commonly violated. Here are some examples:

Go by the book (i.e., Gratzer's book). Don't try to improvise

You probably know enough TeX that you could get by (sort of) without further consulting books and references, and it is tempting to do just that. This, however, would be a mistake that will cost you in the long run.

If you come across something you have never encountered before (say, how to put an asterisk on a summation symbol to create a "starred" sum, or how to typeset binomial coefficients), do not try to find a "solution" on your own, but instead check Gratzer's book to see if the situation is covered there. Any fixes you might come up with on your own are likely inferior to the "book solution", and while they may not cause immediate problems when compiling the code, they will probably result in poorly looking output. Moreover, by continuing to do things your own way, you will acquire bad coding habits that are hard to shed and which, aside from leading to inferior looking TeX output, will end up costing you time from using inefficient and wasteful coding techniques.

Note on other Latex books. By "the book" I mean Gratzer's "Math into Latex". This is the authoritative reference on mathematical Latex. The majority of Latex books (and online materials) don't focus on mathematical typesetting, and while they may be useful for nonmathematical Latex, many offer bad, or out-dated, advice on mathematical Latex. As an example, almost all Latex guides recommend the "eqnarray" environment for multiline equations, which has been rendered obsolete by the "align" environment provided by the amsmath package. The "align" environment produces better looking output, is more robust, easier to use, and much more flexible. Gratzer's book is the only one that fully covers this and similar environments.

Don't blindly copy other people's TeX code

Another very common mistake is to copy somebody else's TeX code. Not everybody is an expert in TeX and produces code that is worth imitating. In fact, the vast majority of papers that I have come across are deficient in some respects, and would make poor examples. If you want to write a paper in LaTeX, start from scratch, or use one of the models in Gratzer's book as a template, rather that using someone else's paper.

Back to the LaTeX Tips Page

Last modified: Tue 23 Aug 2011 05:49:44 PM CDT A.J. Hildebrand