When should I use non-breaking space?
To quote Knuth, ties should appear:
- In references to named parts of a document:
Chapter~12
Theorem~1.2
Appendix~A
Table~\hbox{B-8}
Figure~3
Lemmas 5 and~6
. - Between a person's forenames and between multiple surnames:
Donald~E. Knuth
Luis~I. Trabb~Pardo
Bartel~Leendert van~der~Waerden
Charles~XII
but be careful of names likeCharles Louis Xavier~Joseph de~la Vall\'ee~Poussin
. - Between math symbols in apposition with nouns:
dimension~$d$
width~$w$
function~$f(x)$
string~$s$ of length~$l$~
but compare with
string~$s$ of length $l$~or more
. - Between symbols in series:
1,~2, or~3
$a$,~$b$, and~$c$
1,~2, \dots,~$n$
. - When a symbol is a tightly bound object of a preposition:
of~$x$
from 0 to~1
increase $z$ by~1
in common with~$m$.
but compare
of $u$~and~$v$
. - When mathematical phrases are rendered in words:
equals~$n$
less than~$\epsilon$
(given~$X$)
mod~2
modulo~$p^e$
for all large~$n$
Compareis~15
withis 15~times the height
. - When cases are being enumerated within a paragraph:
(b)~Show that $f(x)$ is (1)~continuous; (2)~bounded.
.
In general where the break will create orphans that would distract the reader.
Some less obvious examples:
I~am
I~definitely
mod~1
The matching $(AW,BX,CY,DZ)$ is unstable, because for example
$A$ prefers~$Z$ to~$W$ and at the same time $Z$ prefers~$A$ to~$D$.
But the matching $(AZ,BW,CX,DY)$ is stable;
(we say that girl~$h$ rejects the proposal)
step~A2 stops when $P$ has nobody left to propose~to,
but step~B2 keeps making redundant proposals ad~infinitum when
The details of Algorithm~B
has local probability~${1\over n}$,
The "I am", "I definitely" etc., is a bit controversial, but personally like a lot of other people don't like "I" at the end of a line break.
In languages like German where spaced en dashes are used for sentence insertions, it is often frowned upon to place the en dash at the start of a new line. So, a non-breaking space should be placed before the dash.
Dieses Mal~-- anders als vorher~-- wurde er überrascht.
This time---unlike before---he was caught by surprise.