子表跨越多個頁面

子表跨越多個頁面

我有一個由 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}

在此輸入影像描述

相關內容