4

I have this very long-table. I want to break it in two pages, specifically at Panel C - meaning that Panel C and Panel D should appear in a new page.

I have tried to delete \begin{table} and replace the \begin{tabular} with \begin{longtable}, but I get a bunch of errors regarding the captions and \toprules. Is there any easy way of breaking this table?

Thanks

\documentclass[12pt,a4paper]{article}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{natbib}
\usepackage{url}
\usepackage{float}
\usepackage{placeins}
\usepackage{bbm}
\usepackage{longtable}
\usepackage{pbox}
\usepackage[font=small,labelfont=bf,margin=\parindent,tableposition=top]{caption}

\begin{document}
\begin{table}[!htbp]                            
  \centering                            
  \caption{Title}
  \caption*{description}    

    \begin{tabular}{rccc}
    \toprule
    \multicolumn{4}{c}{\underline{Panel A}} \\
    \midrule
    \multicolumn{1}{c}{} &       & \multicolumn{2}{c}{Init} \\ \cline{3-4}
          & U     & R     & E \\
    Element 1 &       & a     & a \\
    Element 2 & a     & a     & a \\
    Element 3 & a     & a     & a \\
          & U     & R     & E \\
    Element 4 & a     & a     & a \\
    Element 5 & a     & a     & a \\
    Element 6 & a     & a     & a \\
    Element 7 & a     & a     & a \\
    Element 8 & a     &       &  \\
    Element 9 & a     & a     & a \\
    Element 10 & a     & a     & a \\
          &       &       &  \\
    \multicolumn{4}{c}{\underline{Panel B}} \\
          &       & \multicolumn{2}{c}{Init} \\ \cline{3-4}
          & U     & R     & E \\
    Element 1 &       & a     & a \\
    Element 2 & a     & a     & a \\
    Element 3 & a     & a     & a \\
          & U     & R     & E \\
    Element 4 & a     & a     & a \\
    Element 5 & a     & a     & a \\
    Element 6 & a     & a     & a \\
    Element 7 & a     & a     & a \\
    Element 8 & a     &       &  \\
    Element 9 & a     & a     & a \\
    Element 10 & a     & a     & a \\
          &       &       &  \\
    \multicolumn{4}{c}{\underline{Panel C}} \\
          &       & \multicolumn{2}{c}{Init} \\ \cline{3-4}
          & U     & R     & E \\
    Element 1 &       & a     & a \\
    Element 2 & a     & a     & a \\
    Element 3 & a     & a     & a \\
          & U     & R     & E \\
    Element 4 & a     & a     & a \\
    Element 5 & a     & a     & a \\
    Element 6 & a     & a     & a \\
    Element 7 & a     & a     & a \\
    Element 8 & a     &       &  \\
    Element 9 & a     & a     & a \\
    Element 10 & a     & a     & a \\
          &       &       &  \\
    \multicolumn{4}{c}{\underline{Panel D}} \\
          &       & \multicolumn{2}{c}{Init} \\ \cline{3-4}
          & U     & R     & E \\
    Element 1 &       & a     & a \\
    Element 2 & a     & a     & a \\
    Element 3 & a     & a     & a \\
          & U     & R     & E \\
    Element 4 & a     & a     & a \\
    Element 5 & a     & a     & a \\
    Element 6 & a     & a     & a \\
    Element 7 & a     & a     & a \\
    Element 8 & a     &       &  \\
    Element 9 & a     & a     & a \\
    Element 10 & a     & a     & a \\
    \bottomrule
    \end{tabular}%



  \label{tab:1}%                            
\end{table}%    
\end{document}

2 Answers 2

2

Here's how I would recast the table as a longtable; I've commented out the packages that aren't needed to generate the table.

\documentclass[12pt,a4paper]{article}
%\usepackage{amssymb}
%\usepackage{graphicx}
%\usepackage{amsmath}
%\usepackage{graphicx}
%\usepackage{siunitx}
\usepackage{booktabs}
%\usepackage{natbib}
%\usepackage{url}
%\usepackage{float}
%\usepackage{placeins}
%\usepackage{bbm}
\usepackage{longtable}
%\usepackage{pbox}
\usepackage[font=small,labelfont=bf,
            margin=\parindent,tableposition=top]
           {caption}

\begin{document}
\begin{longtable}{lccc}                            
  %% header and footer information                   
  \caption{Title} \label{tab:1} \\[1\baselineskip]
  \caption*{description}\\  
  \endfirsthead
  \multicolumn{4}{l}{\footnotesize\itshape(Table \ref{tab:1}, cont'd)}\\
  \addlinespace
  \endhead
  \addlinespace
  \multicolumn{4}{r}{\footnotesize\itshape(cont'd)}\\
  \endfoot
  \midrule
  \endlastfoot

  %% tabular material
    \midrule
    \multicolumn{4}{c}{Panel A} \\
    \midrule
    Element & & \multicolumn{2}{c}{Init} \\ 
    \cmidrule{3-4}
      & U     & R     & E \\
    1 &       & a     & a \\
    2 & a     & a     & a \\
    3 & a     & a     & a \\
      & U     & R     & E \\
    4 & a     & a     & a \\
    5 & a     & a     & a \\
    6 & a     & a     & a \\
    7 & a     & a     & a \\
    8 & a     &       &  \\
    9 & a     & a     & a \\
    10 & a     & a     & a \\[1ex]
    \midrule
    \multicolumn{4}{c}{Panel B} \\
    \midrule
    Element & & \multicolumn{2}{c}{Init} \\ 
    \cmidrule{3-4}
      & U     & R     & E \\
    1 &       & a     & a \\
    2 & a     & a     & a \\
    3 & a     & a     & a \\
      & U     & R     & E \\
    4 & a     & a     & a \\
    5 & a     & a     & a \\
    6 & a     & a     & a \\
    7 & a     & a     & a \\
    8 & a     &       &  \\
    9 & a     & a     & a \\
    10 & a     & a     & a \\ 
    \midrule \pagebreak

    \midrule
    \multicolumn{4}{c}{Panel C} \\
    \midrule
    Element & & \multicolumn{2}{c}{Init} \\
    \cmidrule{3-4}
      & U     & R     & E \\
    1 &       & a     & a \\
    2 & a     & a     & a \\
    3 & a     & a     & a \\
      & U     & R     & E \\
    4 & a     & a     & a \\
    5 & a     & a     & a \\
    6 & a     & a     & a \\
    7 & a     & a     & a \\
    8 & a     &       &  \\
    9 & a     & a     & a \\
    10 & a     & a     & a \\[1ex]
    \midrule
    \multicolumn{4}{c}{Panel D} \\
    \midrule
    Element & & \multicolumn{2}{c}{Init} \\ 
    \cmidrule{3-4}
      & U     & R     & E \\
    1 &       & a     & a \\
    2 & a     & a     & a \\
    3 & a     & a     & a \\
      & U     & R     & E \\
    4 & a     & a     & a \\
    5 & a     & a     & a \\
    6 & a     & a     & a \\
    7 & a     & a     & a \\
    8 & a     &       &   \\
    9 & a     & a     & a \\
    10 & a     & a     & a \\
\end{longtable}

\end{document}
1

Ok, I think I got it. I just need to add \tabularnewline after the captions.

1
  • or \\ which is the same thing (usually) Commented Apr 12, 2016 at 15:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .