7

I have this many (see below) underfull warnings that are caused by using the listing package and creating \begin{lstlisting}\end{} to make code appear presentable. Is there a may to fix the warnings?

I am using IEEETran document class and the lstlisting set up (see below). Can this be adjusted to fix the issues?

\lstset
{
  breaklines=true,
  tabsize=3,
  showstringspaces=false
}


\lstdefinestyle{Common}
{
  extendedchars = \true,
  language = {Python},
  frame = single,
  % ===========================================================                      
  framesep = 3pt,%expand outward.                                                    
  framerule = 0.4pt,%expand outward.                                                 
  xleftmargin = 3.7pt,%make the frame fits in the text area.                         
  xrightmargin = 3.5pt,%make the frame fits in the text area.                        
  % ===========================================================                      
  rulecolor=\color{Red}
}

\lstdefinestyle{B}
{
  style = Common,
  backgroundcolor = \color{Black},
  basicstyle = \scriptsize\color{White}\ttfamily,
  keywordstyle = \color{Orange},
  identifierstyle = \color{Cyan},
  stringstyle = \color{Red},
  commentstyle = \color{Green}
}

Warngins:

Underfull \vbox (badness 10000) has occurred while \output is active [4]
Underfull \vbox (badness 10000) has occurred while \output is active
Underfull \vbox (badness 10000) has occurred while \output is active [5]
Underfull \vbox (badness 10000) has occurred while \output is active
Underfull \vbox (badness 10000) has occurred while \output is active [6]
Underfull \vbox (badness 10000) has occurred while \output is active [7]
Underfull \vbox (badness 10000) has occurred while \output is active
Underfull \vbox (badness 10000) has occurred while \output is active [8]
Underfull \vbox (badness 10000) has occurred while \output is active [9]
Underfull \vbox (badness 10000) has occurred while \output is active
Underfull \vbox (badness 10000) has occurred while \output is active [10]
Underfull \vbox (badness 10000) has occurred while \output is active
Underfull \vbox (badness 10000) has occurred while \output is active [11]
dustin
  • 18,617
  • 23
  • 99
  • 204
  • 2
    Please always post complete document that shows the problem \raggedbottom before the listing will probably fix it though. – David Carlisle May 08 '13 at 19:27
  • No but you could make a test file with a small page size a dozen lines of listing and one underfull box at a page break. That is the whole point of making a Minimal example to make a reproducible test case on which to test possible answers. – David Carlisle May 08 '13 at 19:32
  • @DavidCarlisle \raggedbottom worked. You should put it as an answer. – dustin May 10 '13 at 07:24

1 Answers1

6

There is no vertical flexibility between listing lines so if the text height is not an exact multiple of the line height (after taking account of the \topskip used for the first line) then you will get this warning (you would also get it in normal text if you had a full page with no paragraph break).

If you cannot change your \textheight you can add flexibility at the bottom of each page by using \raggedbottom before the listing.

David Carlisle
  • 757,742