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've a massive sidewaystable (code below). I've been trying different combinations of longtable, supertabular, lscape, rotating, sidewaystable, table, etc, and I can't get it to be sideways and also run over 2 pages without screwing up the margins. Thanks for any help!!

http://i50.tinypic.com/2hz4ao0.png

\documentclass[a4paper,11pt]{article}
\usepackage{color,amsmath,amsfonts,amssymb}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{rotating}
\usepackage{colortbl}
\usepackage{booktabs,dcolumn,caption}
\usepackage{expdlist}  %expanded list environment
\usepackage{pdflscape} %landscape single pages
\usepackage{longtable} %multipage table

\captionsetup{labelsep=newline,singlelinecheck=false} % optional
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
\renewcommand{\ast}{{}^{\textstyle *}} % for raised "asterisks"

\oddsidemargin 0.5cm %
\evensidemargin 0.5cm %
\textwidth 15cm %
\topmargin  -0.2in  %
\textheight 23.5cm %
\headheight 15pt %


\doublerulesep2pt

\begin{document}
\renewcommand{\baselinestretch}{1.1}

\fontsize{11}{16pt} \selectfont
\definecolor{Gray}{gray}{0.9}


\begin{sidewaystable}[h]
\footnotesize
\caption{\footnotesize Table heading}
\label{turns}
\colorbox{Gray}{ \begin{tabular*}{\textwidth}{@{}l@{\extracolsep{\fill}}d{4}d{4}d{4}d{4}d{4}d{4}d{4}d{4}d{4}@{}}
\toprule
 & \multicolumn{3}{c}{AAA} & \multicolumn{3}{c}{BBB} & \multicolumn{3}{c}{CCC} \\
 & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{POLS} & \multicolumn{1}{c}{PWLS} &  \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{POLS} & \multicolumn{1}{c}{PWLS} & \multicolumn{1}{c}{OLS} & \multicolumn{1}{c}{POLS} & \multicolumn{1}{c}{PWLS}  \\
\midrule
\multicolumn{4}{l}{\emph{Heading1}} & & &  & & & \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 &     -3.837\ast \\
   & (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) &     (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 &     -0.002 & 0.465\ast \ast \\
   & (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) &     (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 &     0.009 & -0.082 \\
   & (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) &     (0.132) \\
Var4\textsuperscript{c} & -0.333\ast \ast & -0.333\ast \ast & 15.347\ast \ast &     -0.179\ast \ast & -0.180\ast \ast & -8.593\ast \ast & -0.050 & -0.013 & -3.678\ast \ast \\
   & (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) &     (1.049) \\
    Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\ast \ast & -0.066\ast \ast &     -0.035\ast & 2.166\ast \ast & -0.161\ast \ast & -0.043\ast & -0.834 \\
   & (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) &     (0.451) \\
  Var6 & \multicolumn{1}{c}{Yes\textsuperscript{**}} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} \\
  R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
  & & & & & & & & & \\

  \multicolumn{4}{l}{\emph{Heading2}} & & &  & & & \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 &     -3.837\ast \\
   & (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) &     (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\ast \ast \\
   & (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
   & (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\ast \ast & -0.333\ast \ast & 15.347\ast \ast & -0.179\ast \ast & -0.180\ast \ast & -8.593\ast \ast & -0.050 & -0.013 & -3.678\ast \ast \\
   & (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\ast \ast & -0.066\ast \ast &     -0.035\ast & 2.166\ast \ast & -0.161\ast \ast & -0.043\ast & -0.834 \\
   & (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
    Var6 & \multicolumn{1}{c}{Yes\textsuperscript{**}} & Yes^{**} & Yes^{**} &     Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} \\
    R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
   & & & & & & & & & \\

  \multicolumn{4}{l}{\emph{Heading3}} & & &  & & & \\
Var1 & -0.086 & -0.082 & -4.525 & -0.028 & -0.022 & 2.441 & -0.092 & -0.099 & -3.837\ast \\
   & (0.107) & (0.110) & (3.948) & (0.087) & (0.091) & (4.346) & (0.076) & (0.070) &     (1.505) \\
Var2\textsuperscript{a}  & 0.012 & 0.012 & -0.007 & 0.004 & 0.003 & 0.046 & 0.000 & -0.002 & 0.465\ast \ast \\
   & (0.009) & (0.009) & (0.319) & (0.007) & (0.007) & (0.351) & (0.006) & (0.006) & (0.120) \\
Var3\textsuperscript{b} & -0.006 & -0.005 & 0.452 & 0.001 & 0.003 & -0.204 & 0.003 & 0.009 & -0.082 \\
   & (0.007) & (0.007) & (0.247) & (0.005) & (0.006) & (0.272) & (0.007) & (0.006) & (0.132) \\
Var4\textsuperscript{c} & -0.333\ast \ast & -0.333\ast \ast & 15.347\ast \ast & -0.179\ast \ast & -0.180\ast \ast & -8.593\ast \ast & -0.050 & -0.013 & -3.678\ast \ast \\
   & (0.078) & (0.080) & (2.87) & (0.063) & (0.066) & (3.160) & (0.053) & (0.049) & (1.049) \\
Var5\textsuperscript{d} & -0.037 & -0.010 & -2.073\ast \ast & -0.066\ast \ast & -0.035\ast & 2.166\ast \ast & -0.161\ast \ast & -0.043\ast & -0.834 \\
   & (0.021) & (0.021) & (0.761) & (0.017) & (0.017) & (0.838) & (0.023) & (0.021) & (0.451) \\
    Var6 & \multicolumn{1}{c}{Yes\textsuperscript{**}} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} & Yes^{**} \\
    R-squared & 0.151 & 0.146 & 0.191 & 0.111 & 0.07 & 0.086 & 0.151 & 0.013 & 0.187 \\
   & & & & & & & & & \\
  No. 1 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} &     \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} &     \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
  No. 2 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} &     \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
  No. 3 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
  days 1 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
  days 2 & \multicolumn{1}{c}{219\textcolor{Gray}{ss}} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{219} & \multicolumn{1}{c}{445} & \multicolumn{1}{c}{445} & \multicolumn{1}{r}{445\textcolor{Gray}{s}} \\
\midrule[\heavyrulewidth]
\end{tabular*}}
\vspace{0.12cm}

{Dependent variables have been scaled by a factor of 10. Standard errors in parentheses. *Significant at 5\%; **Significant at 1\%.
\begin{description}\compact{
        \item[\small \textsuperscript{a}] Description 1.
    \item[\small \textsuperscript{b}] Description 1.
    \item[\small \textsuperscript{c}] Description 1.
        \item[\small \textsuperscript{d}] Description 1. }
\end{description} }
\end{sidewaystable}

\end{document}
share|improve this question
    
Have you tried getting rid of that colorbox? Because I'm quitesure colorbox can't break pages ... –  user1129682 Jul 17 '12 at 7:31

1 Answer 1

up vote 13 down vote accepted

You want lscape (or its younger sibling pdflscape) and longtable and then

\begin{landscape}
\begin{longtable}{ll}
...

don't put the table in a table or sidewaystabe environment or \colorbox command, all of which make unbreakable boxes that never split over a page.

share|improve this answer
    
Thanks for your comment. My 'theme' is actually grey tables, and I want to get a table like this: i50.tinypic.com/2hz4ao0.png I thought that they went over the page with colorbox, but I guess not. Do you know what they've done? Have they just done 2 tables with colorbox manually? –  user16208 Jul 17 '12 at 9:56
    
You could use colortbl and \rowcolor{Gray} on every row, or use (I think) something like mdframed to put a breakable background behind the table –  David Carlisle Jul 17 '12 at 10:06
    
Nice work. Thank you –  user16208 Jul 17 '12 at 10:25

Your Answer

 
discard

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