Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
1  
Welcome to tex.sx You can use the {}button in the editor to mark up code sections so they are highlighted with lines preserved (it just indents by four spaces. You can also markup inline fragments with backticks like this \delta. I have edited your question this time:-) –  David Carlisle Jul 24 '12 at 9:49
2  
Also when posting code please always post full documehts which show all the packages needed to run your example, I think at least booktabs, lscape and longtable in this case? –  David Carlisle Jul 24 '12 at 9:52

2 Answers 2

up vote 3 down vote accepted

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}
share|improve this answer
    
Mico your answer is awesome. That's exactly what I've been looking for!!! –  Andreas Jul 24 '12 at 11:41
    
yes I noticed the column count was odd, but left it as I thought it may be an artifact of making the MWE that some data had gone AWOL:-) –  David Carlisle Jul 24 '12 at 11:54
    
@DavidCarlisle - I suspect the original column layout was attempt by the OP to insert a bit of extra space (by having empty columns) between each of the Coeff & $\Delta$Prob column groups... –  Mico Jul 24 '12 at 12:09
    
@Andreas - I'm glad my proposed solution is what you were looking for. Don't forget to upvote and/or accept answers that you find helpful. –  Mico Jul 24 '12 at 12:09
1  
@Andreas: this behavior is caused by the switch from portrait mode to landscape mode. I would counsel strongly against mixing portrait and landscape material on a single page. If you're trying to avoid having a page break somewhere in the middle of a page, you could load the afterpage package and encase the entire lscape material inside an \afterpage{...} group. That way, LaTeX won't initiate a switch from portrait to landscape mode until the next (presumably natural) page break occurs anyway. –  Mico Jul 24 '12 at 12:32

Tabular c columns are always one line, so mostly you just need to change that to use p Also your "continued" header (which doesn't show in this example) was too wide to go in 3 columns, which is why column 3 was being extended. I just increased that to 13.

enter image description here

\documentclass{article}

\usepackage{booktabs,pdflscape,array, longtable}

\begin{document}

\begin{landscape}\small
\setlength\LTcapwidth{\columnwidth} % default: 4in (rather less than \textwidth...)
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}|>{\raggedright\arraybackslash}p{2cm}|*{18}{>{\raggedright\arraybackslash}p{.7cm}|}}
\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{13}{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}

\end{document}
share|improve this answer
    
Thanks that helps a lot! But it's better to remove the vertical lines i see some entries exceed the width (on the {\delta Probs} ) –  Andreas Jul 24 '12 at 11:58
    
yes and one or two other bits would need tidying as well, but I left those for you:-) –  David Carlisle Jul 24 '12 at 12:03
    
yes ofcourse thanks :) –  Andreas Jul 24 '12 at 12:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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