[Tex/LaTex] Longtable width exceeds page

booktabslandscapelongtable

I saw these topics and sure they help a lot,

Resize longtable to width of landscape page

How to fit landscape multi-page table to textwidth

But still it does not fix my problem for some reason. I am having this table

\begin{landscape}
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}|*{19}{c|}}
\caption[Multinomial logistic regression results for daily data of the major Eurozone, the US and the UK market indices, January, 1, 2005, to 20, July, 2012]{Multinomial logistic regression results for daily data of the major Eurozone, the US and the UK market indices, January, 1, 2005, to 20, July, 2012.} \label{grid_mlmmh} \\
 &  & \multicolumn{6}{l}{Bottom tails} &  & & \multicolumn{6}{l}{Top tails} & 
\\
\cmidrule{2-9} \cmidrule{11-18} % 2 orizonties grammes aristera kai deksia
\\
& \multicolumn{3}{l}{(1)}  & \multicolumn{3}{l}{(2)} & \multicolumn{3}{l}{(3)} & \multicolumn{3}{l}{(4)} & \multicolumn{3}{l}{(5)} & \multicolumn{3}{l}{(6)}  
\\ 
\cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9} \cmidrule{11-12} \cmidrule{14-15} \cmidrule{17-18}% 2 orizonties grammes aristera kai deksia \\
 & Coeff & $\Delta$Prob  & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob & & Coeff & $\Delta$Prob  \\ 
\endfirsthead
\multicolumn{3}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
 &  & \multicolumn{6}{l}{Bottom tails} &  & & \multicolumn{6}{l}{Top tails} & 
\\
\cmidrule{2-9} \cmidrule{11-18} % 2 orizonties grammes aristera kai deksia
\\
& \multicolumn{3}{l}{(1)}  & \multicolumn{3}{l}{(2)} & \multicolumn{3}{l}{(3)} & \multicolumn{3}{l}{(4)} & \multicolumn{3}{l}{(5)} & \multicolumn{3}{l}{(6)}  
\\ 
\cmidrule{2-3} \cmidrule{5-6} \cmidrule{8-9} \cmidrule{11-12} \cmidrule{14-15} \cmidrule{17-18}% 2 orizonties grammes aristera kai deksia \\
 & & & Coeff & $\Delta$Prob  &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob &  Coeff & $\Delta$Prob  \\ 
\endhead
\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline
\endfoot
\hline \hline
\endlastfoot
 \midrule
PIIGS \\
$\beta_{01}$(constant) & 100 & 0.8  &  &  0.021  & 0.018 & & 0.043 & 0.146 & & 0.074 &  0.427 & & 0.019 & 0.427 & & 0.019 & 0.427   \\ 

Log-likelihood
\\
$Pseudo-R^{2}$ \\ \\
Non-PIIGS \\
$\beta_{01}$(constant) & 100 & 0.8    & 0.021  & 0.018 &  0.043 & 0.146 &  0.074 &  0.427 &  0.019 & 0.427 & & 0.019 & 0.427   \\ 


\\
$Pseudo-R^{2}$ \\ \\
\end{longtable}
\end{landscape}

and it gets off the page all the time. Also, the first "\delta Prob" column on the left gets bigger than the rest all the time.. Can you please help me fitting this table to page width and also ensure that all columns have the same size? I am probably doing something very wrong!

Thank you!

Best Answer

I think a source of the problem is that whereas you define the table to have 19 columns in total, you actually only have 13 columns (1 header column and 12 data columns). Fixing this issue -- mainly by getting rid of unnecessary & alignment characters -- lets the table fit into the available space just fine, without having to switch to a smaller font.

By the way, if one uses the rule-drawing commands of the booktabs package, one should not use vertical bars as well, in part because the vertical lines will not join up correctly with the horizontal rules.

(I rotated the image below 90 degrees only to make it easier to display in this space.)

enter image description here

\documentclass[a4paper]{article}
\usepackage{lscape,booktabs,longtable}
\begin{document}
\begin{landscape}
\setlength\LTcapwidth{\textwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{}l@{\extracolsep{\fill}}*{12}{c}@{}}
\caption{Multinomial logistic regression results for daily data of the major Eurozone, US, and UK market indices, January 1, 2005, to 20 July, 2012.} \label{grid_mlmmh} \\
\toprule
& \multicolumn{6}{c}{Bottom tails} & \multicolumn{6}{c}{Top tails} \\
\cmidrule(r){2-7} \cmidrule(l){8-13} 
% 2 orizonties grammes aristera kai deksia
& \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} 
& \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(6)} \\
\cmidrule(r){2-3}  \cmidrule(lr){4-5}   \cmidrule(lr){6-7} 
\cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(l){12-13}
% 2 orizonties grammes aristera kai deksia \\
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob 
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob \\ 
\midrule
\endfirsthead
\multicolumn{7}{@{}l}%
{{\bfseries \tablename\ \thetable{} --- continued from previous page}} \\
\midrule[\heavyrulewidth]
& \multicolumn{6}{c}{Bottom tails} & \multicolumn{6}{c}{Top tails} \\
\cmidrule(r){2-7} \cmidrule(l){8-13} 
% 2 orizonties grammes aristera kai deksia
& \multicolumn{2}{c}{(1)} & \multicolumn{2}{c}{(2)} & \multicolumn{2}{c}{(3)} 
& \multicolumn{2}{c}{(4)} & \multicolumn{2}{c}{(5)} & \multicolumn{2}{c}{(6)} \\
\cmidrule(r){2-3}  \cmidrule(lr){4-5}   \cmidrule(lr){6-7} 
\cmidrule(lr){8-9} \cmidrule(lr){10-11} \cmidrule(l){12-13}
% 2 orizonties grammes aristera kai deksia \\
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob 
& Coeff & $\Delta$Prob & Coeff & $\Delta$Prob & Coeff & $\Delta$Prob \\ 
\midrule
\endhead
\midrule[\heavyrulewidth]
\multicolumn{13}{r}{Continued on next page} \\ 
\endfoot
\bottomrule
\endlastfoot
PIIGS \\
$\beta_{01}$ (const.) 
& 100 & 0.8 & 0.021 & 0.018 & 0.043 & 0.146 & 0.074 & 0.427 & 0.019 & 0.427 & 0.019 & 0.427 \\ 
Log-likel. \\
Pseudo-$R^{2}$ \\[2ex]
Non-PIIGS \\
$\beta_{01}$ (const.) 
& 100 & 0.8 & 0.021 & 0.018 & 0.043 & 0.146 & 0.074 & 0.427 & 0.019 & 0.427 & 0.019 & 0.427 \\ 
Log-likel.\\
Pseudo-$R^{2}$ \\
\end{longtable}
\end{landscape}
\end{document}