将具有不同表格功能的表格横跨多页

将具有不同表格功能的表格横跨多页

我有一个带有不同表格环境的表格环境,我想知道如何强制分页。longtable由于不同表格的列数不同,因此不起作用,\pagebreak也没有帮助。

那么,如何创建包含多个面板并跨越多页的表格?

\begin{table}
    \centering
    \caption{An interesting table}
    \subcaption*{Panel A: Some stuff}
    \begin{tabular}{lcr}
        First name & Last name  & Product \\
        Bubba & Gump & Shrimp \\
        Steve & Jobs & Happiness
    \end{tabular}
   \pagebreak
    \bigskip
    \subcaption*{Panel B: Other stuff}
    \begin{tabular}{ll}
        School & State \\
        Harvard & MA \\
        Yale & CT \\
        Brown & RI
    \end{tabular}
\end{table}

编辑(基于@koleygr 的评论) 分页符的工作原理是

\documentclass{article}
\usepackage{caption}
\usepackage{longtable}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{caption}

\begin{document}

\centering
\captionof{table}{My caption}
\begin{tabular}{lcr}
First name & Last name  & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness
\end{tabular}
\bigskip
\pagebreak
\captionof{table}{My caption}
\begin{tabular}{ll}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI
\end{tabular}

\结束{文档}

然而,这会造成字幕编号不一致。

答案1

尝试这样做:

\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{lipsum}
\begin{document}
\lipsum[1-4]

{\begin{center}
\captionof{table}{My caption}
    \captionof{subtable}{Panel A: Some stuff}
    \begin{tabular}{lcr}
        First name & Last name  & Product \\
        Bubba & Gump & Shrimp \\
        Steve & Jobs & Happiness
    \end{tabular}
    \pagebreak

    \captionof{subtable}{Panel B: Other stuff}

    \begin{tabular}{ll}
        School & State \\
        Harvard & MA \\
        Yale & CT \\
        Brown & RI
    \end{tabular}
    \end{center}}
\end{document}

相关内容