Ties avoid bad line breaks
Use non-breaking spaces, also called ties, to prevent the
computer breaking lines in bad places. Now, the concept of
"badness" is subjective and so hard to code definite rules.
Consequently, apply the principles with artist taste. I
quote here, near verbatim from Donald Knuth, a list of
examples to show the range of considerations. These apply to
all typesetting, not just LaTeX.
- Use ties in cross-reference: Theorem~A; Algorithm~B;
Chapter~3; Table~4; Programs E and~F. No tie appears after
"Programs" in the last example since it is acceptable to
have "E and F" at the beginning of a
line.
- Use ties between a person's forenames and between
multiple surnames: Dr.~I.~J. Matrix; Luis~I. Trabb~Pardo;
Peter van~Emde~Boas. It is better to hyphenate a
name rather than to break it between words.
- Use ties for symbols in apposition with nouns:
base~b; dimension~d; function~f(x);
string~s of length~l. But compare the last
example with "string~s of length l~or
more".
- Use ties for symbols in series: 1,~2, or~3; a,~b, and~c;
1,~2,...,~n
- Use ties for symbols as tightly-bound objects of
prepositions: of~x; from 0 to~1; increase z
by~1; in common with~m. This rule does not apply to
compound objects: for example, consider "of u~and~v".
- Use ties to avoid breaking up mathematical phrases that
involve words: equals~n; less than~e;
mod~2; modulo~pe; (given~X); when x~grows;
if t~is... Further, "for all large~n" and "for all
n~greater than~n0". But what you
tie depends upon the context: sometimes "is~15" is correct,
but here prefer "is 15~times the height".
- Use ties when enumerating cases: "(b)~Show that
f(x) is (1)~continuous; (2)~bounded.
I took this list of examples from pp. 89--90 of Digital typography by D. E. Knuth, CSLI Publications, 1999; originally written with M. F. Plass and appearing in Software---Practice and Experience 11 (1981), 1119--1184. Also see Chapter 14 in The TeXbook by D. E. Knuth, Amer. Maths Soc. (1986).