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 saying

\hsize=2in \tolerance=1600 \input story

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 \hbadness=1000.)


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.

  • 1
    Could you tell me where can I find in Knuth's book what you have just said above, that is, "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".
    – bellochio
    May 27 '11 at 16:35
  • @bellochio it is implied in the quote you gave in the question. May 27 '11 at 18:14
  • I'm giving you the credit for the answer, for I have the feeling you're right, although it would be better if I had some statement in the book confirming this. Thanks anyway !
    – bellochio
    May 27 '11 at 18:26
  • 3
    @bellochio ... since TeX reports all boxes whose badness exceeds a certain threshold called \hbadness... That is your confirmation: this explains exactly what ‘\hbadness‘ does. May 27 '11 at 18:34
  • Thank you! I came here from tex.stackexchange.com/questions/138/… and this answer to set \hbadness=10000 was exactly what I wanted! (I just want to quiet the spew of warnings so I can pick out anything important.) I might go back later and adjust some wordings to improve the typography, but the spew of warnings was why I came here, and your answer is where I finally found how to quiet it down. So thanks! Oct 9 '17 at 21:03

You can think of three groups of parameters that are used by TeX when typesetting a paragraph, those that are set by the typesetter and the font designer, and those calculated by TeX internally. The \badness is calculated by TeX internally, whereas \tolerance is set by the typesetter to tell TeX what can be tolerated in terms of line and overall paragraph badness.

Tweaking these parameters is a bit of a black art.

Run the following minimal with pdfTeX.


\def\astory{Fast pace and mechanically intensive 
  facilities such as data-centers, hospitals, and 
  laboratories typically require the most intense 
  coordination efforts. Architectural and structural 
  systems are often designed first with allowances 
  for MEP systems. Tensions between the size of 
  these MEP spaces, usable floor space, 
  and ceiling height exist. }


% Second test    


In the minimal the paragraph is typeset, firstly with default values and second without. The first one produces a lot of overfull and underfull boxes. We get rid of them by suitably adjusting the \tolerance. In this particular example I set the tolerance to one higher than the hbadness value reported by TeX. This eliminated all the underfull warnings.

There is a nice surprise when you set the \hsize from 150pt to 160pt and this is where the "black art" part comes along!

  • @Yiannis Thanks for your reply. Maybe my question is silly, since I've just started reading Knuth's book, but I still don't understand what these two entities differentiate in the TeX language.
    – bellochio
    May 27 '11 at 8:56
  • For instance, in your example, what does it mean these two commands: \tolerance = 753 and \hbadness = 752 ?
    – bellochio
    May 27 '11 at 9:18
  • @bellochio \tolerance tells TeX how much badness is allowable without error. The value can range from 0 to 10000, and there are no units. The fit of the text within its specified dimensions is measured by its badness, which is a number between 0 and 10000. A badness of 0 is a perfect fit, and a badness of 10000 means that the line probably will never fit. The default value of \hbadness is 1000. If you set \hbadness to 10000, TeX does not report underfull lines. In my example since the tolerance was higher than the \hbadness no errors were reported up to that point. May 27 '11 at 10:03
  • @bellochio See also tug.org/utilities/plain/cseq.html#hbadness-rp May 27 '11 at 10:16
  • What you said above about '\tolerance' is clear to me. But I'm still struggling with '\hbadness'. It seems like, you try to eliminate the overfull warnings, increasing '\tolerance', then you increase '\hbadness' to eliminate the underfull messages. But what is the purpose of all this ?
    – bellochio
    May 27 '11 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.