30

I still haven't found out how to effectively solve Overfull \hbox (0.80913pt too wide) has occurred while \output is active warnings.

For instance, this piece of latex generates such a warning and I am stumped why:

\newcommand\Header{%
\noindent\makebox[\textwidth][l]{
\parbox{0.5\textwidth}{\contactinfo}
\parbox{0.5\textwidth}{%
\hfill\includegraphics[height=25pt]{logo}}}\par\vskip1ex%
\par\ColTopRule\par}

\contactinfo is defined as follows:

\newcommand\contactinfo{\fontsize{8pt}{8}\selectfont\headerfnt Streetname 12324 \\ PostalCode City \\ +31655555555555}

Error:

*geometry detected driver: pdftex*
<logo.eps>
Overfull \hbox (0.80913pt too wide) has occurred while \output is active
 [] 
[1] <logo.eps>
Overfull \hbox (0.80913pt too wide) has occurred while \output is active
 [] 
[2] <logo.eps>
Overfull \hbox (0.80913pt too wide) has occurred while \output is active
 [] 
[3] <logo.eps>
Overfull \hbox (0.80913pt too wide) has occurred while \output is active
 [] 

Expected output is:

Streetname 12324                                       here comes
PostalCode City                                          the logo
+31655555555555                                     right aligned
-----------------------------------------------------------------

I mean, both boxes have a length of 0.5\textwidth, the text is obviously smaller than this, as is the logo. How come it still generates such a warning? And how can I found out why?

grrrbytes
  • 3,855
  • You need to escape spaces with %. E.g. \noindent\makebox[\textwidth][l]{% – Marco Daniel Apr 13 '12 at 11:50
  • did that: \newcommand\Header{% \noindent\makebox[\textwidth][l]{ \parbox{0.5\textwidth}{\contactinfo} \parbox{0.5\textwidth}{% \hfill\includegraphics[height=25pt]{logo}}}\par\vskip1ex% \par\ColTopRule\par}

    error remains

    – grrrbytes Apr 13 '12 at 11:54
  • hard to see in the comment formatting but you still have a space before each of the \parbox commands in that comment – David Carlisle Apr 13 '12 at 11:58
  • weird, I removed all spaces. To no avail – grrrbytes Apr 13 '12 at 12:01
  • 1
    \makebox[\textwidth]{...} doesn't care if you put something larger than \textwidth in it. So I doubt that the problem is from the content. I guess that you either have a additional space at the place where you use your \Header command or a non-zero \parfillskip value. Make a complete example. – Ulrike Fischer Apr 13 '12 at 12:37
  • what is the definition of \ColTopRule? a minimal working example (MWE) always helps... – David Carlisle Apr 13 '12 at 19:49
  • what's the best way to provide a concrete or MWE within a comment when comment formatting doesn't render my examples with newlines? Pastebin? – grrrbytes Apr 14 '12 at 12:45

3 Answers3

29

To answer the general question about how to debug the box warnings add

\showboxdepth=\maxdimen
\showboxbreadth=\maxdimen

or if that is too much information

\showboxdepth=5
\showboxbreadth=5

and then whenever TeX is showing box information in the log it will show you a representation of the contents of the box.

David Carlisle
  • 757,742
  • Could you please tell where should I add the above commands? – Shray Sharan Aug 19 '15 at 14:39
  • 3
    @ShraySharan anywhere before the offending code, the preamble of the document for example. – David Carlisle Aug 19 '15 at 20:40
  • Overfull \hbox (4.0pt too wide) has occurred while \output is active [] \hbox(0.0+0.0)x430.0074, glue set - 1.0 .\glue 3.0 plus 1.5 minus 1.0 .\glue 3.0 plus 1.5 minus 1.0 .\vbox(0.0+0.0)x430.0074 ..\hbox(0.0+0.0)x430.0074 ...\hbox(0.0+0.0)x0.0, glue set - 430.00739fil ....\vbox(0.0+0.0)x430.0074 .....\hbox(0.0+0.0)x430.0074, glue set 215.0037fil [] ....\glue 0.0 plus 1.0fil minus 1.0fil – Shray Sharan Aug 20 '15 at 14:28
  • I have messages as in the above comment in the log file. I dont understand their meaning. Also when I click on the warning, it doesn't redirect me the line of code that has the warning.. Could you please help me out on this? – Shray Sharan Aug 20 '15 at 14:29
  • @ShraySharan you have something (most likely in the page head) that is 4pt wider than the page. – David Carlisle Aug 20 '15 at 15:55
  • Interestingly enough, inserting this in my preamble reduced the number of bad boxes from 24 to 1. – Waldir Leoncio Dec 19 '15 at 12:49
  • @WaldirLeoncio the above commands won't change the number of warnings, just change the format of the warnings that tex gives – David Carlisle Dec 19 '15 at 13:13
  • I think package microtype solved my instance of this warning, but I not learned enoush in *TeX to provide a reasoning or proof. – tukusejssirs Apr 25 '19 at 12:53
  • @tukusejssirs microtype extends tex's justification algorithms so you will get fewer instances of bad linebreaks (usually) although that doesn't seem related to this question really. – David Carlisle Apr 25 '19 at 13:05
  • 1
    @DavidCarlisle, I had a warning that the OP described, but when I added \usepackage{microtype}, this warning disappeared. – tukusejssirs Apr 25 '19 at 13:11
  • 1
    @tukusejssirs sure that is to be expected. – David Carlisle Apr 25 '19 at 13:36
  • Is there any guide on reading the log of this command? – Minh Nghĩa Oct 16 '20 at 16:50
  • @MinhNghĩa the texbook has the full detail but is not free for a free version see texdoc texbytopic section 6.7 – David Carlisle Oct 16 '20 at 17:13
1

Some other ways:

user202729
  • 7,143
0

Another method is to look at the code and know. For example, the code presented in the question:

\makebox[\textwidth][l]{              % it is \hbox to\hsize and it starts with space here
\parbox{0.5\textwidth}{\contactinfo}  % it creates a box with 0.5\hsize width and there is second space here
\parbox{0.5\textwidth}{%              % it creates a box with 0.5\hsize width 
\hfill\includegraphics[height=25pt]{logo}}}

Two boxes with 0.5\hsize plus two spaces is more than one \hsize.

wipet
  • 74,238