Graphics, Figures & TablesOverfull Box in Cell of Table with full Width

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
fboehlandt
Posts: 12
Joined: Mon Apr 15, 2013 6:28 pm

Overfull Box in Cell of Table with full Width

Post by fboehlandt »

Hi everyone,

I cannot get rid of the "Overfull \hbox" error message.

Code: Select all

\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%
\newcolumntype{L}{>{\raggedright\arraybackslash}X}%

\begin{table}[H] \footnotesize
  \centering
  \caption{A table heading}
    \begin{tabularx}{\textwidth}{@{ } l R R@{.}L R@{.}L R@{.}L R@{.}L R@{.}L R@{.}L @{ }}% 
    \toprule
          &       & \multicolumn{2}{c}{lag 1} & \multicolumn{2}{c}{lag 2} & \multicolumn{2}{c}{lag 3} & \multicolumn{2}{c}{lag 4} & \multicolumn{2}{c}{lag 5} & \multicolumn{2}{c}{lag 6} \\
    \midrule
    ABC   & 38    & 1.281 & 7.180 & 1.026 & 9.222 & 2572.5 & 89.5 & 0.106 & 86.8 \\
    DEF    & 121   & 0.879 & 3.107 & -0.564 & 9.182 & 457.0 & 95.9 & 0.122 & 94.2 \\
    \bottomrule
    \end{tabularx}%
	\caption*{Some more caption...}
\end{table}%
Looks fine in preview and the table does not appear to be wider than the text. However, the error messages make it difficult to find and address more serious issues when compiling. Any suggestions how to deal with this are greatly appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Overfull Box in Cell of Table with full Width

Post by cgnieder »

Hi again,

Sadly you did not post a Infominimal working example (MWE) although in reply to your last post I asked you to do that in your future posts :( An MWE helps you in two aspects: it let's you focus on the problem at hand and just as important increases the chances of getting help significantly: most people don't like to add missing pieces in order to get a compilable example they can test, especially if they need non-standard packages for that. As a consequence they often don't even try to answer.

I would guess that some of the cells of your table are overfull which would explain why you're getting the messages. This would be easy to verify: check if you still get the messages if you only use empty cells or ones only containing a single letter.

Regards
site moderator & package author
fboehlandt
Posts: 12
Joined: Mon Apr 15, 2013 6:28 pm

Re: Overfull Box in Cell of Table with full Width

Post by fboehlandt »

Hello,
you are right in your assumption. However, looking at the table after compiling it suggests that there is plenty of space. I guess it has to do with enforcing equal column widths, My solution was to shorten the cell contents for column 2, but that obviously doesn't help others encountering the same problem. Thanks again for your input
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: Overfull Box in Cell of Table with full Width

Post by cgnieder »

You should be able to reduce the inter-column space. I have no time to look up the right parameter right now, though. I'll try to add an answer soon.

Regards
site moderator & package author
fboehlandt
Posts: 12
Joined: Mon Apr 15, 2013 6:28 pm

Overfull Box in Cell of Table with full Width

Post by fboehlandt »

http://tex.stackexchange.com/questions/16519/adding-space-between-columns-in-a-table
this should suffice to answer questions regarding intercolumn space
Post Reply