2

I'm trying to get rid of the error in my Longtable

Overfull \hbox (1.19998pt too wide) in alignment at lines 6--10

This is my MWE

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{longtable}
\usepackage{array}
\begin{document}

\begin{longtable}{|>{\raggedright\arraybackslash}p{\dimexpr 0.5\textwidth -2\tabcolsep\relax}|>{\raggedright\arraybackslash}p{\dimexpr 0.5\textwidth -2\tabcolsep\relax}|}
\hline
Test & Test\\
\hline
\end{longtable}

\end{document}

Why do I get this error? In my understanding both columns of the longtable should take exactly 50% of the textwidth minus the left and right tabcolsep.

  • The message is actually not an error message, but "just" a warning message. – Mico Oct 31 at 20:13
2

In the calculation of the usable columnwidth, you are correctly substracting the whitespace padding. However, you have failed to take into account the widths of the three vertical rules that are present in the table as well. The width of these vertical rules is governed by the parameter \arrayrulewidth; its default value is 0.4pt in most document classes. Observe that 3*0.4pt=1.2pt, which is extremely close to the reported overfullness of 1.19998pt. (In fact, 1.19998 and 2 are the same up to a rounding error.)

What to do? Piece of cake! Just change both instances of

p{\dimexpr 0.5\textwidth -2\tabcolsep\relax

to

p{\dimexpr 0.5\textwidth -2\tabcolsep -1.5\arrayrulewidth\relax

Why 1.5\arrayrulewidth? Because 2*1.5 = 3 = # of vertical rules in the longtable.

  • Wow, thank your very much for your help and detailed explanation :-) – Christian Oct 31 at 12:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.