[Tex/LaTex] How to fix the Underfull \vbox badness has occurred while \output is active on the memoir chapter style

badnessmemoirpage-breakingprimitiveswarnings

After some hours studying the warning Underfull \vbox (badness 2573) has occurred while \output is active on the question how to suppress "Underfull \vbox (badness 10000) … while \output is active"? I learned and fixed several of these warnings across my document, except this one.

On next follows a minimal example I extracted which reproduce the problem I am having on my real document. After analyzing this example I noticed the warning is happening when this distance is big as on the following image:

enter image description here

If I fill with more text as follows:

enter image description here

This is a minimal code which generates the warning:

\documentclass[11pt,a4paper]{memoir}

\makeatletter
% how to suppress “Underfull \vbox (badness 10000) … while \output is active”?
% https://tex.stackexchange.com/questions/62296/how-to-suppress-underfull
\def\@textbottom{\vskip \z@ \@plus 1pt}
\let\@texttop\relax

\newcommand\thickhrulefill{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\makechapterstyle{VZ14}
{
    % \thispagestyle{empty}
    \setlength\beforechapskip{50pt}
    \setlength\midchapskip{20pt}
    \setlength\afterchapskip{20pt}
    \renewcommand\chapternamenum{}
    \renewcommand\printchaptername{}
    \renewcommand\chapnamefont{\Huge\scshape}
    \renewcommand\printchapternum
    {%
        \chapnamefont\null\thickhrulefill\quad
        \@chapapp\space\thechapter\quad\thickhrulefill
    }
    \renewcommand\printchapternonum
    {%
        \par\thickhrulefill\par\vskip\midchapskip
        \hrule\vskip\midchapskip
    }
    \renewcommand\chaptitlefont{\huge\scshape\centering}
    \renewcommand\afterchapternum
    {%
        \par\nobreak\vskip\midchapskip\hrule\vskip\midchapskip
    }
    \renewcommand\afterchaptertitle
    {%
        \par\vskip\midchapskip\hrule\nobreak\vskip\afterchapskip
    }
}
\makeatother

% Memoir: Warnings “The material used in the headers is too large” w/ accented titles
% https://tex.stackexchange.com/questions/387293/how-to-change-the-page-layout-with-memoir
\setheadfoot{30.0pt}{\footskip}
\checkandfixthelayout

\usepackage[showframe,pass]{geometry}
\chapterstyle{VZ14}

\makeatletter
\newcommand{\showfont}
{%
    (encoding: \f@encoding{},
    family: \f@family{},
    series: \f@series{},
    shape: \f@shape{},
    size: \f@size{},
    baseline: \f@baselineskip{})
    %tfsize: \tf@size{},
    %sfsize: \sf@size{},
    %sssize: \ssf@size{}
}
\makeatother

\setcounter{secnumdepth}{5}
\newcommand{\subsubsubsection}{\paragraph}

\begin{document}

% ----------------------------------------------------------
\chapter[Nullam elementum urna vel imperdiet sodales elit ipsum]{Nullam
    elementum urna vel imperdiet sodales elit ipsum pharetra ligula
    ac pretium ante justo a nulla curabitur tristique arcu eu metus}
% ----------------------------------------------------------
1. How to display the font size in use in the final output,
2. How to display the font size in use in the final output,
3. How to display the font size in use in the final output,
4. How to display the font size in use in the final output,
5. How to display the font size in use in the final output,
6. How to display the font size in use in the final output,
7. How to display the font size in use in the final output,
8. How to display the font size in use in the final output,
9. How to display the font size in use in the final output,

\begin{verbatim}
\makeatletter
original: \f@size
\verb+\small+ \small \f@size
\verb+\normalsize+ \normalsize \f@size
\verb+\large+ \large \f@size
\verb+\Huge+ \Huge \f@size
\makeatother
\end{verbatim}

\section[Some encoding tests]{showfont}
\subsection{showfont}
\subsubsection{showfont}
\subsubsubsection{showfont}

\end{document}

Also there is no warning if I fit everything in one page by removing the filler text:

enter image description here

This is a picture from the real document, showing how it is generating the warning:

enter image description here

This is the code on my document, which generated the above image:

% ----------------------------------------------------------
\chapter[Nullam elementum urna vel imperdiet sodales elit ipsum]{Nullam 
    elementum urna vel imperdiet sodales elit ipsum pharetra ligula
    ac pretium ante justo a nulla curabitur tristique arcu eu metus}
% ----------------------------------------------------------

1. How to display the font size in use in the final output,
2. How to display the font size in use in the final output,
3. How to display the font size in use in the final output,
4. How to display the font size in use in the final output,
5. How to display the font size in use in the final output,
6. How to display the font size in use in the final output,


\section[Some encoding tests]{\showfont}
\subsection{\showfont}
\subsubsection{\showfont}
\subsubsubsection{\showfont}



Lipsum me [55-57]

The \showfont command used is this:

\makeatletter
\newcommand{\showfont}
{%
    (encoding: \f@encoding{},
    family: \f@family{},
    series: \f@series{},
    shape: \f@shape{},
    size: \f@size{},
    baseline: \f@baselineskip{})
    %tfsize: \tf@size{},
    %sfsize: \sf@size{},
    %sssize: \ssf@size{}
}
\makeatother

If you make all the text fit in one page, the warnings is gone. However we do not want to fit all the chapter text in one page, a.k.a. chapter's cover.

What can I do do fix the warning on this page? I am already using this fix from how to suppress "Underfull \vbox (badness 10000) … while \output is active"? to fix the others Underfull \vbox (badness) has occurred while \output is active on my document. However this seem different from the others.

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

Best Answer

Thanks to @Bernard comment, adding \raggedbottom fixed this warning. While searching it, I found the questions:

  1. \flushbottom vs \raggedbottom)
  2. Do I have to care about bad boxes?
  3. badness messages when changing from report to book class
  4. \raggedbottom in book. Is it right way?
  5. Restore default \raggedbottom footnote behaviour when using one of the Koma script classes

Also filling that specific page with text fixed the warning. Basically somehow the contents of the page where being pushed to the next page letting a big whole on the original page.

On this version the warning is fixed by filling up text:

% ----------------------------------------------------------
\chapter[Nullam elementum urna vel imperdiet sodales elit ipsum]{Nullam elementum urna vel imperdiet sodales elit ipsum pharetra ligula
    ac pretium ante justo a nulla curabitur tristique arcu eu metus}
% ----------------------------------------------------------

\showfont
\section[Some encoding tests]{\showfont}

1. How to display the font size in use in the final output,
2. How to display the font size in use in the final output,
3. How to display the font size in use in the final output,
4. How to display the font size in use in the final output,
5. How to display the font size in use in the final output,
6. How to display the font size in use in the final output,

7. How to display the font size in use in the final output,
8. How to display the font size in use in the final output,
9. How to display the font size in use in the final output,
10. How to display the font size in use in the final output,
11. How to display the font size in use in the final output,
12. How to display the font size in use in the final output,

\subsection{\showfont}

1. How to display the font size in use in the final output,
2. How to display the font size in use in the final output,
3. How to display the font size in use in the final output,
4. How to display the font size in use in the final output,
5. How to display the font size in use in the final output,
6. How to display the font size in use in the final output,

7. How to display the font size in use in the final output,
8. How to display the font size in use in the final output,
9. How to display the font size in use in the final output,
10. How to display the font size in use in the final output,
11. How to display the font size in use in the final output,
12. How to display the font size in use in the final output,

\subsubsection{\showfont}

1. How to display the font size in use in the final output,
2. How to display the font size in use in the final output,
3. How to display the font size in use in the final output,
4. How to display the font size in use in the final output,
5. How to display the font size in use in the final output,
6. How to display the font size in use in the final output,

7. How to display the font size in use in the final output,
8. How to display the font size in use in the final output,
9. How to display the font size in use in the final output,
10. How to display the font size in use in the final output,
11. How to display the font size in use in the final output,
12. How to display the font size in use in the final output,

\subsubsubsection{\showfont}

1. How to display the font size in use in the final output,
2. How to display the font size in use in the final output,
3. How to display the font size in use in the final output,
4. How to display the font size in use in the final output,
5. How to display the font size in use in the final output,
6. How to display the font size in use in the final output,
7. How to display the font size in use in the final output,

8. How to display the font size in use in the final output,
9. How to display the font size in use in the final output,
10. How to display the font size in use in the final output,
11. How to display the font size in use in the final output,
12. How to display the font size in use in the final output,


Lipsum me [55-57]

enter image description here

I would prefer this alternative over disabling the pages bottom justifications with \raggedbottom. I believe the problem was caused by pilling up empty of sections as showed on question end, which somehow pushed all the empty sections to the next page creating the whole at the first page bottom:

% ----------------------------------------------------------
\chapter[Nullam elementum urna vel imperdiet sodales elit ipsum]{Nullam 
    elementum urna vel imperdiet sodales elit ipsum pharetra ligula
    ac pretium ante justo a nulla curabitur tristique arcu eu metus}
% ----------------------------------------------------------

\showfont
\section[Some encoding tests]{\showfont}
\subsection{\showfont}
\subsubsection{\showfont}
\subsubsubsection{\showfont}

enter image description here

The solution to the above case is to manually insert a \newpage command, on the page which is issuing the warning. On this case the document would be like:

% ----------------------------------------------------------
\chapter[Nullam elementum urna vel imperdiet sodales elit ipsum]{Nullam 
    elementum urna vel imperdiet sodales elit ipsum pharetra ligula
    ac pretium ante justo a nulla curabitur tristique arcu eu metus}
% ----------------------------------------------------------

\showfont
\newpage

\section[Some encoding tests]{\showfont}
\subsection{\showfont}
\subsubsection{\showfont}
\subsubsubsection{\showfont}

Just notice this last example only works if attached to my main document. When this is reproduced alone, no empty page is throw down:

enter image description here

This is probably due some other setting somewhere embedded on my main document class.