[Tex/LaTex] Subtable spanning over several pages

subcaptiontables

I have a table composed of 2 subtables. I would like to be able to break the table to display the subtables on different pages. It seems it is not working like subfigures and \ContinuedFloat as it it presented here. It seems to me that the \longtable environment is not suited for that purpose either.

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

Best Answer

In the exact same way as https://tex.stackexchange.com/a/278748/36296 you can use \ContinuedFloat to split the subtables in two separate floats:

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

Off-topic, but I suggest to not use vertical lines in your tables and use the booktabs package instead:

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

enter image description here

Related Question