如何有效地调试过满的 \hbox 警告?

如何有效地调试过满的 \hbox 警告?

我还没有找到如何有效地解决Overfull \hbox (0.80913pt too wide) has occurred while \output is active警告。

例如,这块乳胶会产生这样的警告,而我很困惑为什么:

\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定义如下:

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

错误:

*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
 [] 

预期输出为:

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

我的意思是,两个框的长度都是0.5\textwidth,文本显然比这个要小,徽标也是如此。为什么它仍然会产生这样的警告?我该如何找出原因?

答案1

要回答关于如何调试框警告的一般问题,请添加

\showboxdepth=\maxdimen
\showboxbreadth=\maxdimen

或者如果信息太多

\showboxdepth=5
\showboxbreadth=5

然后,每当 TeX 在日志中显示盒子信息时,它都会显示盒子内容的表示。

答案2

其他一些方法:

答案3

还有一个方法就是看代码就知道了。比如题目中给出的代码:

\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}}}

两个盒子加 0.5\hsize加上两个空格大于一个\hsize

相关内容