4

There are already a couple of questions around the topic of changing the value of \vbadness from its default value of 1000, e.g., How reduce badbox sensitivity locally? or Do I have to care about bad boxes?. Now, noting that \vbadness=0 raises a lot of undoutably unnecessary warnings, I wonder whether the choice of 1000 has a particular justification. Is it a 'good' choice (whatever this means)?

I have not found any details on how the badness is calculated, but since the maximum badness equals 10000, I suspect the badness scale is a pretty non-linear one. Probably, several components are weighed in a way that the prevalence of some effect always outweighs that of another, and then summed. Is this correct? I would also be interested in whether scaling up a complete document (say, from A4 to A3) and all margins, font sizes, glue etc. would result in the same badnesses, or whether they would change.

bers
  • 5,404

2 Answers2

5

The badness of a box (vertical or horizontal) is a measure of how much glue stretches or shrinks.

In the case of infinite glue available, the badness is zero, so let's concentrate on the case when only finite stretchability or shrinkability is available.

If the available stretch is t and the needed stretch is s, the glue set ratio is r = s/t; the badness will be 100·r3, so a badness of 1000 means, approximately, r = 2.15; however, the badness is normalized to 10000 if r3 > 100 (that is, r > 4.64).

The same is for shrinking, with the difference that TeX will output an overfull box if the amount of available shrinking is less than needed (that is, r turns out to be greater than 1).

Normally, stretching twice than the available amount is not really a problem, particularly for lines of text. It could be for pages, if the available stretching is only provided by \parskip glue. The default value of \parskip is 0pt plus 0.1pt and 0.3pt becomes to be noticeable. When the stretching comes from glue around titles the problem is much less severe.

Decreasing \vbadness from its default value of 1000 to 338, that corresponds to r = 1.5, means that you get many Underfull \vbox warnings, most of which are redundant.

Ensuring that the text height contains an integral number of lines is probably the best recipe against bad pages; it's a must when the document has many pages with just running text. The formula is easy: multiply the number of lines minus one by the \baselineskip and add the \topskip. The geometry package does it automatically if you use the heightrounded option.

Badness above 1500 (r > 2.5) is to be taken seriously; between 1000 and 1500 it's not much of a problem, in general. Better if one can remove the cause for it, but not so big that a compromise cannot be accepted.

egreg
  • 1,121,712
  • I think you should mention the \flushbottom versus \raggedbottom alternative, in the paragraph that speaks of “an integral number of lines”. This time I have been faster :-) , but, of course, your answer is much more exhaustive, so I bow and retire respectfully. – GuM Jun 11 '15 at 16:26
  • @GustavoMezzetti \raggedbottom adds small infinite stretchability, so as to make the badness of pages always 0. For a two side document it's out of question. – egreg Jun 11 '15 at 16:29
  • Yet I think you should mention that the oneside option, in almost all document classes, implies the \raggedbottom setting: sometimes users are surprised that switching from oneside to twoside alters the appearance of the pages, especially those containing a lot of (non-infinite) glue. I have answered a couple of questions of this kind on the guit forum (btw, are we going to see you there anymore?). But it’ fair enough to have this point mentioned in the comments, I guess. – GuM Jun 11 '15 at 16:39
  • @egreg The badness will be normalized to 10000 if r > 4.34 (approximately). The algorithm TeX uses to compute the badness cannot produce values between 8189 and 10000. – user227621 Aug 05 '23 at 08:04
1

The “badness” of a non-empty box is approximately equal to 100 times the cube of the “glue set ratio” of non-infinite glue (see The TeXbook, p. 97). The “glue set ratio” is “the ratio by which the glue inside the [box] must stretch or shrink to make [it] of the required size” (ibidem). Note that the glue set ratio is always nonnegative.

However, when calculating line or page breaks, other elements are considered besides the sheer badness, for example the “penalties” that the user, or TeX itself, have inserted in a horizontal or vertical list. This, however, is another topic that goes beyond the scope of your question.

So, if you scale up or down everything in a document, in theory the glue set ratio should not be affected at all (being a ratio), but in practice it would be necessary to know exactly how the scaling is performed (how fonts are going to be scaled, to begin with).

Addition

Bear in mind, however, that the value of \vbadness does not affect the typesetting in any way: it simply tells how fussy TeX should be in reporting underfull (and, to some extent, also overfull) \vboxes. Of course, the sibling parameter named \hbadness applies, in a similar way, to \hboxes. You can find the details on page 302 of The TeXbook, in the second-last paragraph (a “single dangerous bend”).

GuM
  • 21,558