将表格拆分为两页

将表格拆分为两页

我想将模型 VAR(2) 之后的表格拆分为两页,以显示变量 A、D。我尝试使用语法 \begin{longtable}...\end{longtable} 来修复它,但我无法解决这个问题。在此处输入图片描述

以下是其代码:

\begin{document}
\begin{landscape}

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{c|clSllllll}
    \toprule
    \multicolumn{1}{c}{\multirow{2}[2]{*}{Variable}} & \multirow{2}[2]{*}{Model} & \multicolumn{2}{c}{\multirow{2}[2]{*}{Estimated Parameters}} & \multicolumn{6}{c}{\multirow{2}[2]{*}{Details}} \\
    \multicolumn{1}{c}{} &       & \multicolumn{2}{c}{} & \multicolumn{6}{c}{} \\
    \midrule
          &       &       &       &       &       &       &       &       &  \\
    \multirow{5}[0]{*}{A} & \multirow{5}[0]{*}{AR(5)} & diff At-1  & 0.052 & \multicolumn{6}{l}{\multirow{5}[0]{*}{AR(5) in diff A with lag order 5, p determined by BIC}} \\
          &       & diff At-2  & 0.158 & \multicolumn{6}{l}{} \\
          &       & diff At-3  & 0.117 & \multicolumn{6}{l}{} \\
          &       & diff At-4  & 0.135 & \multicolumn{6}{l}{} \\
          &       & diff At-5  & 0.262 & \multicolumn{6}{l}{} \\
          &       &       &       &       &       &       &       &       &  \\
    \multirow{2}[0]{*}{A,B} & \multirow{2}[0]{*}{VAR(1)} & diff At-1 & 0.239 & \multicolumn{6}{l}{\multirow{2}[0]{*}{VAR(1) in diff A and diff B with lag order 1 determined by BIC}} \\
          &       & diff Bt-1 & 0.003 & \multicolumn{6}{l}{} \\
          &       &       &       &       &       &       &       &       &  \\
    \multirow{4}[0]{*}{A,C} & \multirow{4}[0]{*}{VAR(2)} & diff At-1 & 0.140 & \multicolumn{6}{l}{\multirow{4}[0]{*}{VAR(2) in diff A and diff C with lag order 2 determined by BIC}} \\
          &       & diff Ct-1 & 0.005 & \multicolumn{6}{l}{} \\
          &       & diff At-2 & 0.280 & \multicolumn{6}{l}{} \\
          &       & diff C2t-2 & 0.004 & \multicolumn{6}{l}{} \\
          &       &       &       &       &       &       &       &       &  \\
    \multirow{3}[0]{*}{A,B,C} & \multirow{3}[0]{*}{VAR(1)} & diff At-1 & 0.239 & \multicolumn{6}{l}{\multirow{3}[0]{*}{VAR(1) in diff A, diff B and diff C with lag order 1 determined by BIC}} \\
          &       & diff Bt-1 & 0.003 & \multicolumn{6}{l}{} \\
          &       & diff Ct-1 & 0.002 & \multicolumn{6}{l}{} \\
          &       &       &       &       &       &       &       &       &  \\
    \multirow{4}[0]{*}{A,D} & \multirow{4}[0]{*}{VAR(2)} & diff At-1 & 0.167 & \multicolumn{6}{l}{\multirow{4}[0]{*}{VAR(2) in diff A and diff D with lag order 2 determined by BIC}} \\
          &       & diff Dt-1 & 0.041 & \multicolumn{6}{l}{} \\
          &       & diff At-2 & 0.276 & \multicolumn{6}{l}{} \\
          &       & diff Dt-2 & 0.026 & \multicolumn{6}{l}{} \\
          &       &       &       &       &       &       &       &       &  \\
    \multirow{6}[0]{*}{A,E} & \multirow{6}[0]{*}{VAR(3)} & diff At-1 & 0.094 & \multicolumn{6}{l}{\multirow{6}[0]{*}{VAR(3) in diff A and diff E with lag order 3 determined by BIC}} \\
          &       & diff Et-1 & -0.009 & \multicolumn{6}{l}{} \\
          &       & diff At-2 & 0.246 & \multicolumn{6}{l}{} \\
          &       & diff Et-2 & -0.136 & \multicolumn{6}{l}{} \\
          &       & diff At-3 & 0.220 & \multicolumn{6}{l}{} \\
          &       & diff Et-3 & 0.145 & \multicolumn{6}{l}{} \\
          &       &       &       &       &       &       &       &       &  \\
    \multirow{4}[1]{*}{A,F} & \multirow{4}[1]{*}{VAR(2)} & diff At-1 & 0.151 & \multicolumn{6}{l}{\multirow{4}[1]{*}{VAR(2) in diff A and diff F with lag oder 2 determined by BIC}} \\
          &       & diff Ft-1 & -0.163 & \multicolumn{6}{l}{} \\
          &       & diff At-2 & 0.291 & \multicolumn{6}{l}{} \\
          &       & diff Ft-2 & 0.082 & \multicolumn{6}{l}{} \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

\end{landscape}
\end{document}



答案1

这是我使用该longtable包的建议。我还删除了一些不必要的列(\multicolumn{6}如果您实际上只需要 5 列,为什么还要使用所有这些命令和总共 10 列?)并使用来自\addlinespace的命令替换空行booktabs。我还删除了垂直线booktabs,因为您已经使用的规则与垂直线不兼容。我还向类型列添加了一个适当的table-format选项S以改善那里的间距。

最后,我个人不会使用垂直居中的内容,但我没有在您的表格中改变这一点。

在此处输入图片描述

\documentclass{article}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{makecell}

\begin{document}
\begin{landscape}
\begin{longtable}{cclS[table-format=-1.3]l}
    \caption{Add caption} \label{tab:addlabel}\\
    \toprule
    \multicolumn{1}{c}{Variable} &Model & \multicolumn{2}{c}{\makecell[cc]{Estimated \\ Parameters}} & Details \\
    \midrule
    \endfirsthead
        \caption{Add caption - continued}\\
    \toprule
    \multicolumn{1}{c}{Variable} &Model & \multicolumn{2}{c}{\makecell[cc]{Estimated \\ Parameters}} & Details \\
    \midrule
    \endhead
    \multirow{5}[0]{*}{A} & \multirow{5}[0]{*}{AR(5)} & diff At-1  & 0.052 & \multirow{5}[0]{*}{AR(5) in diff A with lag order 5, p determined by BIC} \\*
          &       & diff At-2  & 0.158 &  \\*
          &       & diff At-3  & 0.117 &  \\*
          &       & diff At-4  & 0.135 &  \\*
          &       & diff At-5  & 0.262 &  \\ \addlinespace
    \multirow{2}[0]{*}{A,B} & \multirow{2}[0]{*}{VAR(1)} & diff At-1 & 0.239 & \multirow{2}[0]{*}{VAR(1) in diff A and diff B with lag order 1 determined by BIC} \\*
          &       & diff Bt-1 & 0.003 &   \\ \addlinespace
    \multirow{4}[0]{*}{A,C} & \multirow{4}[0]{*}{VAR(2)} & diff At-1 & 0.140 & \multirow{4}[0]{*}{VAR(2) in diff A and diff C with lag order 2 determined by BIC} \\*
          &       & diff Ct-1 & 0.005 &    \\*
          &       & diff At-2 & 0.280 &    \\*
          &       & diff C2t-2 & 0.004 &    \\ \addlinespace
    \multirow{3}[0]{*}{A,B,C} & \multirow{3}[0]{*}{VAR(1)} & diff At-1 & 0.239 & \multirow{3}[0]{*}{VAR(1) in diff A, diff B and diff C with lag order 1 determined by BIC} \\*
          &       & diff Bt-1 & 0.003 &    \\*
          &       & diff Ct-1 & 0.002 &    \\ \addlinespace
    \multirow{4}[0]{*}{A,D} & \multirow{4}[0]{*}{VAR(2)} & diff At-1 & 0.167 & \multirow{4}[0]{*}{VAR(2) in diff A and diff D with lag order 2 determined by BIC} \\*
          &       & diff Dt-1 & 0.041 &    \\*
          &       & diff At-2 & 0.276 &    \\*
          &       & diff Dt-2 & 0.026 &    \\ \addlinespace
    \multirow{6}[0]{*}{A,E} & \multirow{6}[0]{*}{VAR(3)} & diff At-1 & 0.094 & \multirow{6}[0]{*}{VAR(3) in diff A and diff E with lag order 3 determined by BIC} \\*
          &       & diff Et-1 & -0.009 &    \\*
          &       & diff At-2 & 0.246 &    \\*
          &       & diff Et-2 & -0.136 &    \\*
          &       & diff At-3 & 0.220 &    \\*
          &       & diff Et-3 & 0.145 &    \\ \addlinespace
    \multirow{4}[1]{*}{A,F} & \multirow{4}[1]{*}{VAR(2)} & diff At-1 & 0.151 & \multirow{4}[1]{*}{VAR(2) in diff A and diff F with lag oder 2 determined by BIC} \\*
          &       & diff Ft-1 & -0.163 &    \\*
          &       & diff At-2 & 0.291 &    \\*
          &       & diff Ft-2 & 0.082 &    \\*
    \bottomrule
    \end{longtable}%
  %

\end{landscape}
\end{document}

这里还有一个关于如何将表格适合纵向页面的建议:

在此处输入图片描述

\documentclass{article}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{makecell}

\usepackage{xltabular}
\begin{document}
\begin{xltabular}{\textwidth}{cclS[table-format=1.3]X}
    \caption{Add caption} \label{tab:addlabel}\\
    \toprule
    \multicolumn{1}{c}{Variable} &Model & \multicolumn{2}{c}{\makecell[cc]{Estimated \\ Parameters}} & Details \\
    \midrule
    \endfirsthead
        \caption{Add caption - continued}\\
    \toprule
    \multicolumn{1}{c}{Variable} &Model & \multicolumn{2}{c}{\makecell[cc]{Estimated \\ Parameters}} & Details \\
    \midrule
    \endhead
    A & AR(5) & diff At-1  & 0.052 & \multirow[t]{5}[0]{=}{AR(5) in diff A with lag order 5, p determined by BIC} \\*
          &       & diff At-2  & 0.158 &  \\*
          &       & diff At-3  & 0.117 &  \\*
          &       & diff At-4  & 0.135 &  \\*
          &       & diff At-5  & 0.262 &  \\ \addlinespace
    A,B & VAR(1) & diff At-1 & 0.239 & \multirow[t]{2}[0]{=}{VAR(1) in diff A and diff B with lag order 1 determined by BIC} \\*
          &       & diff Bt-1 & 0.003 &   \\ \addlinespace
\end{xltabular}

\end{document}

相关内容