What is the right way to use of non-breakable space before math expressions?

See chapter~14 of the TeXbook, where Knuth suggests the following ties:

  • Chapter~12
  • Theorem~1.2
  • Appendix~A
  • Figure~3
  • Table~\hbox{B-8}
  • Lemmas 5 and~6
  • Donald~E. Knuth
  • Luis~I. Trabb~Pardo
  • Bartel~Lendert van~der~Waerden
  • Charles~XII
  • Charles Louis Xavier~Joseph de~la Vall\'ee~Poussin
  • dimension~$d$
  • width~$w$
  • function~$f(x)$
  • string~$s$ of length~$l$
  • string~$s$ of length $l$~or more
  • 1,~2, or~3
  • $a$,~$b$, and~$c$.
  • 1,~2, \dots,~$n$.
  • of~$x$
  • from 0 to~1
  • increase $z$ by~1
  • in common with~$m$
  • of $u$~and~$v$.
  • equals~$n$
  • less than~$\epsilon$
  • (given~$X$)
  • mod~2
  • modulo~$p^e$
  • for all large~$n$
  • is~15
  • is 15~times the height
  • (b)~Show that $f(x)$ is (1)~continuous; (2)~bounded

There are even more examples in the exercises, but that covers most cases...


The physical effect you would get from a line break at some point is a small pause / distraction in reading, so what I do is use a mental trick: imagine how the sentence sounds with a small pause in the trouble spot(s) when read out loud. Some cases are clearer than others, but in general that works fairly well for me.

Occasionally I see something in the typeset output that looks bad visually even though it sounds OK, then I correct the ties in the input to fix that one break.

As the problem is related to the actual language you are using, you could also ask this question on english.stackexchange.com