Ties avoid bad line breaks

Use non-breaking spaces, also called ties, to prevent the computer breaking lines in bad places: the concept of "badness" is subjective and so hard to code definite rules; apply the principles with artist taste. I quote here, virtually verbatim from Donald Knuth, a list of examples to show the range of considerations. These apply to all typesetting, not just LaTeX.

  1. 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 would be quite all right to have "E and F" at the beginning of a line.

  2. Use ties between a person's forenames and between multiple surnames: Dr.~I.~J. Matrix; Luis~I. Trabb~Pardo; Peter van~Emde~Boas. Notice that it is better to hyphenate a name rather than to break it between words.

  3. 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".

  4. Use ties for symbols in series: 1,~2, or~3; a,~b, and~c; 1,~2,...,~n

  5. 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".

  6. Use ties to avoid breaking up mathematical phrases that are rendered in words: equals~n; less than~e; mod~2; modulo~pe; (given~X); when x~grows; if t~is... Compare "is~15" with "is 15~times the height"; and compare "for all large~n" with "for all n~greater than~n0.

  7. 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.