[Tex/LaTex] What’s the difference between \tolerance and \badness


I'm having some difficulty understanding this sentence on page 29, Chapter 6 of Knuth's TeXbook:

Run TeX again, and begin this time by

\hsize=2in \tolerance=1600 \input

so that lines with badness up to 1600
will be tolerated. Hurray! There are
no overfull boxes this time. (But you
do get a message about an underfull
box, since TeX reports all boxes whose
badness exceeds a certain threshold
called \hbadness; plain TeX sets

Best Answer

The \tolerance setting influences the paragraph breaking routine itself: changes to \tolerance (and \pretolerance) actually affects which line breaks are chosen. Higher values allow worse lines (usually meaning: with stretched inter-word spaces) to be accepted, with the value 10000 indicating a 'panic mode' where anything at all is acceptable. Normally the lower the value, the better the paragraph will look, but you run the risk of reducing the list of possible breaks so much that you end up with overfull lines.

The \hbadness setting only influences the user report (the messages you see on screen and in the log) about the actually chosen lines, it has no effect on the breaking routine itself.