Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I got some strange "underfull \vbox (badness 10000) detected at line ..." warnings, obviously at each of my "longtable"s. Is there a way to fix them (I actually don't see the cause) or do I have to ignore them?

Minimal working example (PdfLaTeX tells these warnings triply for each run on compiling with longtable [2000/10/22 v4.10 Multi-page Table package (DPC)]; each \demounderfullvbox might be replaced by the full example code or the source may be reduced to one longtable, what doesn't change behavior):

\documentclass[english,11pt,a4paper]{article}
\usepackage{longtable}

\newcommand{\demounderfullvbox}{%
    \begin{longtable}{|l|p{2in}|}
    %
    \endfirsthead
    %
    \hline\multicolumn{2}{|l|}{\textsl{\ldots continued from previous page}}\\*
    \endhead
    %
    \multicolumn{2}{|l|}{\textsl{will be continued on next page\ldots}}\\*
    \hline
    \endfoot
    %
    \hline
    \endlastfoot
    %
    \hline%
    aa: & 4711\\
    \hline%
    aaa: & 2\\
    \hline%
    aaaa: & 4711-2\\
    \end{longtable}
}

\begin{document}
\newpage
%
\demounderfullvbox
\demounderfullvbox
\demounderfullvbox

\end{document}

If tabular is used instead of longtable, no warnings occur, but that doesn't solve the problem, as much more rows can be placed in the tables.

Removing the trailing \\ in the aaaa: line has no effect either.

The "underfull \vbox" warnings seem to specify a source line that looks ok to me (this is more clearly when \demounderfullvbox is replaced by the example code), think the warning is provocated on computation of first LTchunk?

Thanks for help and suggestions in advance!

share|improve this question

2 Answers 2

up vote 7 down vote accepted

The underfull box is in fact the \hline at the start of the table (entered just after \endlastfoot)

If instead you remove it from there and put it at the end of the first head, as below, it all works out.

The reason for this eludes me at present but I'm sure it is all explained in detail in the package documentation......

\documentclass[english,11pt,a4paper]{article}
\usepackage{longtable}
\showboxdepth10
\showboxbreadth10

\newcommand{\demounderfullvbox}{%
    \begin{longtable}{|l|p{2in}|}
        \hline%
    \endfirsthead
    %
    \hline
    \multicolumn{2}{|l|}{\textsl{\ldots continued from previous page}}
    \endhead
    %
    \multicolumn{2}{|l|}{\textsl{will be continued on next page\ldots}}\\
    \hline
    \endfoot
    %
    \hline
    \endlastfoot
    %
    aa: & 4711\\
    \hline%
    aaa: & 2\\
    \hline%
    aaaa: & 4711-2
    \end{longtable}%
}

\begin{document}
\newpage
%
\demounderfullvbox
\demounderfullvbox
\demounderfullvbox

\end{document}
share|improve this answer
    
Oops - that simple \hline position was it... I must have moved it some days ago with the intent to have all "data" rows with the same source layout, but haven't recognized the side effect... Thank you very much for answering so quickly! –  tueftl Sep 11 '12 at 12:52

The example can be simplified to

\showboxdepth=\maxdimen
\showboxbreadth=\maxdimen

\documentclass{article}
\usepackage{longtable}[2004/02/01]
\begin{document}
  \begin{longtable}{l}
    \hline
    x
  \end{longtable}
\end{document}

The .log file contains:

Package: longtable 2004/02/01 v4.11 Multi-page Table package (DPC)
[...]
Underfull \vbox (badness 10000) detected at line 10

\vbox(8.39996+0.0)x345.0
.\penalty 10000
.\hbox(0.4+0.0)x345.0, glue set 163.8611fill
..\glue(\tabskip) 0.0 plus 1.0fill
..\hbox(0.4+0.0)x17.27782, glue set 17.27782fill
...\leaders 0.0 plus 1.0fill
....\rule(0.4+0.0)x*
..\glue(\tabskip) 0.0 plus 1.0fill

Package longtable splits its contens in chunks (in \LT@start):

\dimen@ii\vfuzz
\vfuzz\maxdimen
  \setbox\tw@\copy\z@
  \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
  \setbox\tw@\vbox{\unvbox\tw@}%
\vfuzz\dimen@ii

Because of \unvbox\tw@ it does not matter if the splitted box by \vsplit is too large or too small. \setbox\tw@\vbox{\unvbox\tw@} sets the box in its natural size. Overfull boxes are catched by \vfuzz. If \hline starts the table, then \hline and the next line is too large for \ht\@arstrutbox. But the line itself is too small for \ht\@arstrutbox and generates the underfull \vbox.

BTW, the documentation says:

Also \hline may be used, as in tabular.

Therefore I consider this behavior as bug that can be fixed by setting \vbadness to 10000, see lines marked with (added):

\makeatletter
\def\LT@start{%
  \let\LT@start\endgraf
  \endgraf\penalty\z@\vskip\LTpre
  \dimen@\pagetotal
  \advance\dimen@ \ht\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
  \advance\dimen@ \dp\ifvoid\LT@firsthead\LT@head\else\LT@firsthead\fi
  \advance\dimen@ \ht\LT@foot
  \edef\restore@vbadness{\vbadness\the\vbadness\relax}% (added)
  \vbadness=\@M % (added)
  \dimen@ii\vfuzz
  \vfuzz\maxdimen
    \setbox\tw@\copy\z@
    \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
    \setbox\tw@\vbox{\unvbox\tw@}%
  \vfuzz\dimen@ii
  \restore@vbadness % (added)
  \advance\dimen@ \ht
        \ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi
  \advance\dimen@\dp
        \ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi
  \advance\dimen@ -\pagegoal
  \ifdim \dimen@>\z@\vfil\break\fi
      \global\@colroom\@colht
  \ifvoid\LT@foot\else
    \advance\vsize-\ht\LT@foot
    \global\advance\@colroom-\ht\LT@foot
    \dimen@\pagegoal\advance\dimen@-\ht\LT@foot\pagegoal\dimen@
    \maxdepth\z@
  \fi
  \ifvoid\LT@firsthead\copy\LT@head\else\box\LT@firsthead\fi\nobreak
  \output{\LT@output}%
}
\makeatother
share|improve this answer
    
Thanks, I'd spotted the first bit but ran out of time checking if it would be safe just to silence the warning. I guess an update is called for... –  David Carlisle Sep 11 '12 at 14:41
    
@DavidCarlisle Agreed. Also feel free to consider Caption at foot of long tables as feature request :-) –  Heiko Oberdiek Sep 11 '12 at 15:04
    
@DavidCarlisle: maybe I've found another problem in the apart from that brilliant longtable. –  tueftl Sep 18 '12 at 12:29
    
Yes saw that, been too busy to look this week, may have to be the weekend, or if you are lucky @HeikoOberdiek may fix it for you:-) –  David Carlisle Sep 18 '12 at 12:32
    
@DavidCarlisle: could you find some time to add Heiko's patch please? –  Ulrike Fischer Oct 28 at 15:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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