# how to suppress “Underfull \vbox (badness 10000) … while \output is active”?

when using an inflexible document class, one is often faced with the warning

Underfull \vbox (badness 10000) has occurred while \output is active []


on pages that contain no display math.

in underfull \vbox frank mittelbach quotes from the companion (2ed) regarding page specs that are "too rigid". the recommended (and obvious) approach is to build in more flexibility.

the same suggestions, to add flexibility, are given in What are underfull hboxes and vboxes and how can I get rid of them?.

the document class in question was constructed (intentionally, if short-sightedly) with no allowance for stretch in the \parskip, between chapter title and text, and in a few other locations. furthermore, an option permits the change from [10pt] to [11pt] body text so even if the \textheight is an integral number of lines in one size, another size will not meet the criterion.

with \vfuzz one can specify a small allowance which, if not exceeded, will suppress overfull box messages. but there isn't any equivalent for a negative allowance.

i've checked the etex manual (the latest, dated 1998/03/04) and that for etextools but didn't find anything useful. i've looked into the tex.web code, but it wasn't obvious how one might work around the problem without a new primitive.

it's not a good idea to ignore these messages in the log, since the "structural" ones camouflage the ones (usually very few) that do need to be attended to. has anyone come up with a method for suppressing only those underfull vbox messages that are off by only a couple of points?

-
The amsart class is known for this "feature". :) –  egreg Jul 5 '12 at 14:12
I guess if you want to suppress one particular type of vbox warning you could use the silence package. –  Jörg Jul 5 '12 at 14:29
@egreg -- that's what i meant by "intentional but short-sighted". sigh. –  barbara beeton Jul 5 '12 at 15:23
I think that MWE would help... –  yo' Jul 5 '12 at 15:25
@jorg -- two problems: (1) this is a tex warning, not a latex one; (2) can you think of a way to discriminate between a vbox underfull by only 2 points vs. one underfull by 2 inches? –  barbara beeton Jul 5 '12 at 15:28

Adding a finite stretch on the page suppresses warnings so long as the shortfall is within this limit, so at 11pt 1pt suppresses the warning completely .7pt makes it have a "non infinite" badness and anything much less than that has infinite badness.

\documentclass[11pt]{amsart}

\makeatletter
\def\@textbottom{\vskip \z@ \@plus 1pt}
\let\@texttop\relax
\makeatother

\begin{document}

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

aa\\bb\\cc\\dd\\ee\\ff\\gg

\end{document}

-
Does it move the footer? –  yo' Jul 5 '12 at 16:26
add a few more lines, please, david. this method avoids the "overfull 10000" on the first page, but it will happen on page 2 because of the misfortune that \widowpenalty pulls an extra line over to page 3. but it's headed in the right direction. and adding a title, author, and a footnote or two for the top matter is good on the first page (which will always be true for amsart since there's stretch with the footnote rule; now to try it with amsbook). –  barbara beeton Jul 5 '12 at 16:28
ah OK so I repeated stuff so there were 8 pages, and had to make the stretch 7pt to have no warnings. principle is the same though:-) –  David Carlisle Jul 5 '12 at 16:32
@tohecz the definition is exactly the same as \raggedbottom (I just cut and pasted it from latex.ltx) except changing the glue stretch to a finite amount. –  David Carlisle Jul 5 '12 at 16:36
@DavidCarlisle -- thanks for the info that increasing the stretch to 7pt will "disappear" the warning messages. it gives me a good basis for further experimentation, and a reasonable approach to suggest to an author who is currently bedeviled with a superabundance of overfull vbox messages. –  barbara beeton Jul 5 '12 at 17:36

There is no "negative \vfuzz". The only way I see is patching the output routine to measure the actual height of the page to be output and, if the difference with the desired height is less than a threshold value, issuing \vbadness10000 when the box is actually built.

Using \raggedbottom is not an option, I believe, because it can introduce variability that perhaps is difficult to control.

A patch to amsart.cls that seems to work, in the direction of not having underfull pages, is

\textheight=\dimexpr
\ifcase\@mainsize
\or % 0
\or % 1
\or % 2
\or % 3
\or % 4
\or % 5
\or % 6
\or % 7
57\or % 8
52\or % 9
48\or % 10
44\or % 11
41\fi % 12
\baselineskip+\topskip\relax


instead of setting \textheight=584pt for all sizes. This gives the following values for \textheight:

580pt (8pt size)
582pt (9pt size)
586pt (10pt size)
582pt (11pt size)
584pt (12pt size)

It's probably similar for amsbook.

Of course this would break many existing documents. A difference of two points for the main sizes with respect to the "ideal" height is not noticeable. Of course all the objects that add unstretchable or unshrinkable spaces should occupy an integer number of lines.

-
of course two points one way or the other isn't noticeable to the human eye, but "the rules are the rules" according to management, and the tight specs applied when a pdf image is imposed onto a printing plate could result in something being cut off unless the positioning "window" is adjusted. (and all ams document classes are inflicted with this feature, as you suspect.) i'll pursue this idea though. thanks. –  barbara beeton Jul 5 '12 at 16:16

One option is to modify output routine so that it includes \vspace with some plus at the very end:

\documentclass[a4paper]{amsart}
\usepackage{lipsum}
\usepackage{showframe}

% fixed text size so that paper size has no influence.
\setlength{\textheight}{545pt}
\setlength{\textwidth}{350pt}

\begin{document}

% adjust some lengths to invoke the problem
\parskip0pt
\baselineskip30pt

% this, put at the beginning of the document, solves the problem
% adjust the plus part of the \vspace to your faviourite value
\makeatletter
\edef\orig@output{\the\output}
\output{\setbox\@cclv\vbox{\unvbox\@cclv\vspace{0pt plus 20pt}}\orig@output}
\makeatother

% the warnings for the pages that are actually full have disappeared
\lipsum

% these \vboxes are really short and the warning is there
\vbox{\lipsum[1]}\par
\vbox{\lipsum[1]}\par
\vbox{\lipsum[1]}\par
\vbox{\lipsum[1]}\par

\end{document}


The warnings for pages 2 and 4 are correct, since on page 2, one line is missing because of the widow elimination.

-
this results in 7 pages. every page after page 1 is too short by our standards (excepting the last page, of course). with plus 30pt, only pages 5 and 6 were reported as underfull; changing that to plus 5pt added page 4, but this isn't adequate. –  barbara beeton Jul 5 '12 at 16:05
With no vertical stretch, the pages cannot be not too short –  yo' Jul 5 '12 at 16:08
the problem is that there are too few lines set on all pages but the first because of the \vboxes. a copyeditor seeing those pages would send them back to the author to be rewritten, or at least unboxed. –  barbara beeton Jul 5 '12 at 16:15
Sorry, I did put \setlength{\textheight}{500pt} at a wrong place. I modified the example a bit, see the update. –  yo' Jul 5 '12 at 16:31