Graphics, Figures & TablesLongtable makes column width unneccesarily large

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Jeremie Choquette
Posts: 2
Joined: Thu May 12, 2011 7:05 pm

Longtable makes column width unneccesarily large

Post by Jeremie Choquette »

Hi everyone, I am writing a program that ouputs to LaTeX and have been having a problem with the width of one of my columns. I cannot figure out why, but the last column becomes much wider than is needed based on the values entered into it. I originally thought to put the last \hrulefill in a parbox (thinking it was stretching out the last column), but this did not solve the problem.

Here is the table:

Code: Select all

\begin{longtable}{lll}
\multicolumn{2}{l}{E(level)}&J$^{\pi}^{\dagger }$\\[-.2cm]
\multicolumn{2}{c}{\hrulefill}&\hrulefill\\
\endfirsthead
\multicolumn{3}{c}{\underline{\ensuremath{^{182}}Hf Levels (continued)}}\\
\multicolumn{3}{c}{~}\\
\multicolumn{2}{l}{E(level)}&J$^{\pi}^{\dagger }$\\[-.2cm]
\multicolumn{2}{c}{\hrulefill}&\hrulefill\\
\endhead
\multicolumn{3}{c}{~}\\
\multicolumn{3}{c}{Continued on next page (footnotes at end of table)} \\
\endfoot
 \endlastfoot
\multicolumn{1}{r@{}}{0}&\multicolumn{1}{@{.}l}{0}&\multicolumn{1}{c}{0+}\\
\multicolumn{1}{r@{}}{97}&\multicolumn{1}{@{.}l}{77 \emph{20}}&\multicolumn{1}{c}{2+}\\
\multicolumn{1}{r@{}}{321}&\multicolumn{1}{@{.}l}{8 \emph{6}}&\multicolumn{1}{c}{(4+)}\\
\multicolumn{1}{r@{}}{818}&\multicolumn{1}{@{.}l}{4 \emph{4}}&\multicolumn{1}{c}{(1,2+)}\\
\multicolumn{1}{r@{}}{905}&\multicolumn{1}{@{.}l}{9 \emph{6}}&\\
\end{longtable}
Sorry if it is messy, it is created by a program so I lose some flexibility in formatting.

Any ideas?

-Jeremie

Recommended reading 2024:

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

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

demac
Posts: 6
Joined: Thu Jun 17, 2010 9:27 pm

Re: Longtable makes column width unneccesarily large

Post by demac »

Jeremie,

I have the same problem when one of my multicolumn headers is longer than the width of the table body. longtable will increase the width of the last column in the header part to accommodate the extra text

Hope this helps
Jeff
Jeremie Choquette
Posts: 2
Joined: Thu May 12, 2011 7:05 pm

Re: Longtable makes column width unneccesarily large

Post by Jeremie Choquette »

Thank you Jeff. I have resolved the problem now. It turns out that even though LaTeX was not printing the footnotes (the samples I was looking at did not extend beyond one page), they were still being used to calculate the column width.
Post Reply