Is there a way to avoid linebreaks before all numbers without explicitly using the tilde? It would be nice if it worked both for explicit numbers, as in Sample~1 as well as when a number is implied, as in Figure~\ref{fig:label}.

If not, I think I could write a macro in emacs that uses regex to find and fix all the instances of a number or \ref{} that should have a tilde.

  • 2
    have you looked at the cleveref package? it might be useful here (for the \ref part of your question)...
    – cmhughes
    Sep 23, 2012 at 22:49
  • I looked it up, and cleveref seems to solve the problem, and more. As far as explicit numbers go, egreg makes some good points about cases where a linebreak before a number is fine. I think I'll use something like grep ' [0-9]' doc.tex to review these on a case by case basis, since they don't show up as often as references, at least in my writings.
    – Anthony
    Sep 24, 2012 at 1:45

1 Answer 1


There's no practical way. One might think to make the digits active and define them as


and similarly for the others. But this would prevent writing innocuos things such as


and so this is ruled out.

Besides, ties are not always required in front of numbers:

as we have seen in cases 1~and~2

is better than cases~1 and~2.

Conversely one might redefine \ref so that it does the \unskip~ operation, but again this is not always the best way of writing by the same reason as before.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .