我有一张由 2 个子表组成的表格。我希望能够拆分表格以在不同的页面上显示子表。它似乎不像子图那样工作,\ContinuedFloat
正如这里所展示的。我认为该\longtable
环境也不适合该目的。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{subcaption}
\begin{document}
\begin{table}[!h]
\caption{General caption. \label{tab:mytable}
\begin{subtable}{1\textwidth}
\caption{Caption subtable 1}\label{cst1}
\centering
\begin{tabular}{l|l|}
Name & Description\\
\hline
a & This is a \\
b & This is b \\
\end{tabular}
\end{subtable}
\vspace{1cm}
\begin{subtable}{1\textwidth}
\caption{Caption subtable 2}\label{cst2}
\centering
\begin{tabular}{l|l|}
Name & Description\\
\hline
c & This is c \\
d & This is d \\
\end{tabular}
\end{subtable}
\end{table}
\end{document}
答案1
和https://tex.stackexchange.com/a/278748/36296您可以使用\ContinuedFloat
将子表拆分为两个单独的浮点数:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{subcaption}
\begin{document}
test
\begin{table}[htbp]
\caption{General caption.} \label{tab:mytable}
\begin{subtable}{1\textwidth}
\caption{Caption subtable 1}\label{cst1}
\centering
\begin{tabular}{l|l|}
Name & Description\\
\hline
a & This is a \\
b & This is b \\
\end{tabular}
\end{subtable}
\end{table}
\pagebreak
\begin{table}[htbp]
\ContinuedFloat
\caption{General caption, continued.}% remove if the second subtible shall not have a general caption
\begin{subtable}{1\textwidth}
\caption{Caption subtable 2}\label{cst2}
\centering
\begin{tabular}{l|l|}
Name & Description\\
\hline
c & This is c \\
d & This is d \\
\end{tabular}
\end{subtable}
\end{table}
\end{document}
离题了,但我建议不要在表格中使用垂直线,而是使用包booktabs
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{subcaption}
\usepackage{booktabs}
\begin{document}
test
\begin{table}[htbp]
\caption{General caption.} \label{tab:mytable}
\begin{subtable}{1\textwidth}
\caption{Caption subtable 1}\label{cst1}
\centering
\begin{tabular}{ll}
\toprule
Name & Description\\
\midrule
a & This is a \\
b & This is b \\
\bottomrule
\end{tabular}
\end{subtable}
\end{table}
\pagebreak
\begin{table}[htbp]
\ContinuedFloat
\caption{General caption, continued.}% remove if the second subtible shall not have a general caption
\begin{subtable}{1\textwidth}
\caption{Caption subtable 2}\label{cst2}
\centering
\begin{tabular}{ll}
\toprule
Name & Description\\
\midrule
c & This is c \\
d & This is d \\
\bottomrule
\end{tabular}
\end{subtable}
\end{table}
\end{document}