帮助长桌

帮助长桌

我有一张很长的表格。我想将其分成两页,具体来说是面板 C - 这意味着面板 C 和面板 D 应该出现在新页面中。

我尝试删除\begin{table}并替换\begin{tabular}\begin{longtable},但出现一堆有关标题和 \toprules 的错误。有没有什么简单的方法可以破坏这个表格?

谢谢

\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}

答案1

以下是我将如何将其改写tablelongtable;我已经注释掉生成表不需要的包。

\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}

答案2

\tabularnewline好的,我想我明白了。我只需要在标题后面 添加。

相关内容