I am not sure whether this is common practice, but I do feel there is a benefit from what I'm going to discuss next. If you feel otherwise about this particular good practice I tend to use in my documents, do not hesitate and tell me why :-).

Problem sketch

When typing a mathematical text you use inline mathematical formulas. When doing this without much thought, i.e., not caring about non-breakable spaces (or ties), also known as ~ you end up with nasty results.. Exercise 18.10 of the TeXbook tries to make you aware of these so-called bad line breaks.

But Knuth doesn't really describe the rules he tends to follow and my personal taste differs from what he suggests as a solution to the given exercise. My main concerns are:

  1. lines starting with a symbol
  2. line breaks inside inline mathematical formulas
  3. symbols denoting an object at the end of a line while the type of object is on the next (as in: Let C be a commutative ring)

Number 3 is something he avoids, but 1 and 2 are phenomenons that will occur when following his technique (as is shown in the typeset solution). And he advocates the usage of white spacing to denote formulas, a practice that has gotten out of use since then. Now what I want to discuss in this post are the ways how I avoid these three problems.


The first one is obvious: you just prefix each inline math formula with a non-breakable space ~. No more line breaks will happen at this point now. This same technique applies to the third one: just suffix each introduction of a symbol with a non-breakable space.

This introduces a problem that concerns the second one as well: line breaking. When TeX is offered less opportunities to break a line, the results tend to get poorer. And I want to make it even worse: I don't want any line breaks within formulas! They're ugly!

How do I avoid line breaks in inline mathematical formulas? By putting \relpenalty=10000 and \binoppenalty=10000. This prevents TeX from breaking inside formulas because it would involve infinite badness (yes, infinite is at 10000): breaks at both relationships (equal signs and the like) or binary operators are forbidden. This is kind of like the -Werror flag in gcc: all warnings (split formulas) are treated as errors (bad boxes). TeX is only allowed to break in text and if that would introduce intolerable badness I get to solve it myself. What's nice about this solution is that it is unobtrusive: one could also put \mbox{} around each formula but that would be bad.

There are two solutions to the problem of the bad boxes introduced by this practice:

  • rewriting your text, opting for a less symbolic and more prosaic writing
  • putting formulas in display style

I feel both solutions tend to improve a mathematical text when applied the correct way. When typing you get the opportunity to be more verbose: handwritten math often contains many implicit facts due to the fact that it takes more time to write, a TeX'ed manuscript can offer a bit of explicitation by adding little words and slightly redundant phrases. And in order to avoid having a densely written roman-style of mathematical manuscript, display style can break the flow in a good way.


  • use ties, the TeXbook explains how, but bear in mind your own personal taste
  • prevent line breaks inside formulas by adding

My answer to the exercise

I prefer the prose of the second suggestion more, so I've TeX'd it how I would do it.

Let~$C$ be a closed, bounded and convex subset of a Hilbert
space~$H$, and let~$T$~be a non-expansive self map of~$C$. Suppose
that as~$n\to\infty$, we have~$a_{n,k}\to 0$ for each~$k$, and
  \gamma_n=\sum_{k=0}^\infty (a_{n,k+1}-a_{n,k})^+\to 0.
Then for each~$x$ in~$C$, the infinite sum
  A_nx=\sum_{k=0}^\infty a_{n,k}T^k x
converges weakly to a fixed point of~$T$.