当表中有多个longtabu
环境时,表的编号会错误。请参阅下面的 MWE。
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{longtable}
\begin{document}
\begin{table}
\centering
\caption{An interesting table}
\subcaption*{Panel A: Some stuff}
\begin{longtabu}{XXX}
First name & Last name & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness \\
\end{longtabu}
\bigskip
\subcaption*{Panel B: Other stuff}
\begin{longtabu}{XX}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI \\
\end{longtabu}
\end{table}
\begin{longtabu}{ll}
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
\caption{This is a caption}
\end{longtabu}
\end{document}
答案1
正如 Ulrike Fischer 所说评论中提到,在环境longtabu
内部使用table
是没有意义的。
如果您使用tabularx
或简单的tabular
代替,则longtabu
表格编号正确,对于longtabu
代码中的第二个,我已使用longtable
并将相应的标题放在开头,以便它显示在上方longtable
:
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{longtable}
\begin{document}
\begin{table}
\centering
\caption{An interesting table using tabularx}
\begin{subtable}{\textwidth}
\subcaption*{Panel A: Some stuff}
\begin{tabularx}{\textwidth}{XXX}
First name & Last name & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness \\
\end{tabularx}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\subcaption*{Panel B: Other stuff}
\begin{tabularx}{\textwidth}{XX}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI \\
\end{tabularx}
\end{subtable}
\end{table}
\begin{longtable}{ll}
\caption{This is a caption of a longtable}\\
\endhead
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
Longtable & Longtable \\
\end{longtable}
\begin{table}[htbp]
\caption{An interesting table using tabular}
\begin{subtable}{\textwidth}
\centering
\subcaption*{Panel A: Some stuff}
\begin{tabular}{lll}
First name & Last name & Product \\
Bubba & Gump & Shrimp \\
Steve & Jobs & Happiness \\
\end{tabular}
\end{subtable}
\bigskip
\begin{subtable}{\textwidth}
\centering
\subcaption*{Panel B: Other stuff}
\begin{tabular}{ll}
School & State \\
Harvard & MA \\
Yale & CT \\
Brown & RI \\
\end{tabular}
\end{subtable}
\end{table}
\end{document}