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 keep getting this warning

 Overfull \hbox (0.63303pt too wide) in paragraph at lines xxx--xxx`

wherever I have this line in the code

 \begin{tabular}{p{2cm}|p{4cm}|p{3cm}|p{3cm}}

It does not stop me from working on and creating documents but I was just wondering why I keep getting that.

share|improve this question
2  
I wouldn't worry about it to be honest.The difference is probably too small to see at 0.6330pt wide. What class are you using? Most classes will use an \hfuzz figure of at least 1pt to avoid such messages. –  Yiannis Lazarides Nov 30 '10 at 15:17
1  
    
@Yiannis: Right, one doesn't have to worry, but if you have lots of these messages, then the more severe ones might get lost. So I consider it a good idea to try and avoid such minor messages. –  Hendrik Vogt Nov 30 '10 at 16:33
    
Could you please add a minimal example that illustrates your problem (including the preamble). –  Martin Schröder Dec 2 '11 at 22:01

4 Answers 4

I assume you get this warning because your tabular is (a little bit) wider than your \textwidth. Solutions include:

  • enlarging the \textwidth a little
  • narrowing down the tabular by a little
  • adding \hfuzz=0.64pt somewhere in the preamble

The \hfuzz setting specifies the maximum amount of box-overflow before a warning message will be issued.

share|improve this answer

Using the new adjustbox package of Martin Scharrer, you can place your tabular inside of an adjustbox. This package will shrink your tabular to fit to the \textwidth (and to the \textheight, if that should be necessary) without distortion of the text (or any other content in the box; keepaspectratio is the key).

\begin{adjustbox}{width={\textwidth},totalheight={\textheight},keepaspectratio}%
\begin{tabular}{p{2cm}|p{4cm}|p{3cm}|p{3cm}}
    ...
\end{tabular}%
\end{adjustbox}

But because it resizes the tabular, it is better suited for cases like

 \begin{tabular}{c|c|c|c}

For columns with fixed width Herbert's solution is more appropriate, which removes horizontal space at the beginning and end of a row.

share|improve this answer
    
While that will work, it will mask the underlying problem (cf. Herbert's answer). –  Martin Schröder Dec 2 '11 at 22:05
    
@MartinSchröder: Yes, you are right. Thanks for pointing this out. I edited my answer accordingly. –  Stephen Dec 3 '11 at 19:04

use this tabular definition:

\begin{tabular}{@{} p{2cm}|p{4cm}|p{3cm}|p{3cm} @{}}

the definition of a row is

|\tabcolsep|2cm|\tabcolsep|\tabcolsep|4cm|\tabcolsep|...|\tabcolsep|

The @{} remove the \tabcolsep at the beginning and end of the tabular row.

share|improve this answer
    
Herbert, can you explain what this does? –  Ingo Oct 28 '13 at 9:42
1  
see my edited answer –  Herbert Oct 28 '13 at 9:58
    
Thank you for the additions. –  Ingo Oct 28 '13 at 11:47

One thing that might be useful is using the \resizebox command to scale your environment to the available width of the page. It saves having to manually fiddle with the sizes to make it perfect but can result in text distortion when used on an environment that is far too small/large.

In the case of your tabular environment you would uses it as such:

\resizebox{\textwidth}{!} {%
\begin{tabular}{p{2cm}|p{4cm}|p{3cm}|p{3cm}}
%Fill table with data
\end{tabular}%
}

This will scale the tabular environment to the exact width of the page, with (in this case) negligible text distortion.

share|improve this answer
    
I've added two % characters that avoid spurious spaces. –  egreg May 17 '11 at 9:29
    
Ah, thanks. I've only used the command for a report where whitespace was desirable so I didn't consider that. –  Ephphatha May 17 '11 at 9:39
    
To prevent text distortion, I would advise the use of the (new) adjustbox package instead of \resizebox (please see my answer). –  Stephen Nov 24 '11 at 18:26
    
While that will work, it will mask the underlying problem (cf. Herbert's answer). –  Martin Schröder Dec 2 '11 at 22:05

Your Answer

 
discard

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