8

I am getting overfull warning (Overfull \hbox (17.10379pt too wide) in alignment) when using longtable enviroment (See MWE below) The warnings are on \begin{longtable} and \end* lines. The pdf filellooks fine, but I would like to get rid of the warning message. Any suggestions on how to get rid of those warning by formatting the table?

\documentclass{article}

\usepackage{longtable}
\usepackage{lipsum}

\begin{document}
\begin{longtable}{*2{p{0.49\textwidth}}}
        Title & Column 2 \\
        \hline
    \endfirsthead
        Title & Column 2 \\
        \hline
    \endhead
        \multicolumn{2}{r}{Continued}\\
    \endfoot
        \hline
    \endlastfoot

    \lipsum[1] & \lipsum[2]\\
\end{longtable}
\end{document}
  • 4
    Welcome. Load the package showframe and you will see the problem. The width of a column is .49\textwidth but you forgot the tabcolsep on the left and right of every column. – Marco Daniel Jan 28 '12 at 18:12
  • thank you. I did not konw about showframe. I fixed the column width and now it works fine. – mythealias Jan 28 '12 at 18:17
10

You're not taking correctly into account the \tabcolsep, a space that is added in front and after all columns:

\begin{longtable}{*2{p{\dimexpr0.5\textwidth-2\tabcolsep\relax}}}

Or, with the calc package,

\begin{longtable}{*2{p{0.5\textwidth-2\tabcolsep}}}

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.