1

When there are multiple longtabu environments in a talbe, the numbering of table will be wrong. See the MWE below.

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

enter image description here

1
  • 6
    Don't use a longtable inside a table environment. That doesn't make sense. Aug 21, 2019 at 6:53

1 Answer 1

1

As Ulrike Fischer already mentioned in the comments, using longtabu inside of a table environment does not make sense.

If you use tabularx or a simple tabular instead of the longtabu the tables are numbered correctly, For the second longtabu in your code, I have used longtable and placed the corresponding caption in the beginning so that it is displayed above the 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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.