3

The below example presents two tables with an tabularx environment (taken from package ltablex) and a caption. After each tabularx-table, the table counter skips one, as if both the caption and the tabularx environment increase it, while the latter shouldn't.

\documentclass{report}
\usepackage{ltablex}
\begin{document}

\begin{table}
\caption{Caption 1.} % "Table 1"
\begin{tabularx}{\linewidth}{|c|}
empty table
\end{tabularx}
\end{table}

\begin{table}
\caption{Caption 2.} % "Table 3"
\begin{tabularx}{\linewidth}{|c|}
empty table
\end{tabularx}
\end{table}

\end{document}

My reputation doesn't allow me to upload a picture, but the captions are Table 1 and Table 3 respectively.

  • 1
    Consider using the tabu package. – cacamailg Apr 22 '13 at 12:54
  • Note that the document would work as you have it if you used the standard tabularx package version of tabularx instead of the ltablex version. – David Carlisle Apr 22 '13 at 13:11
  • @DavidCarlisle: I realized that, but I needed ltablex for a different table and cannot use them side-by-side (right?). – roelandvanbeek Apr 22 '13 at 13:35
  • @roelandvanbeek ltablex includes tabularx (and then changes it) so no you can not use the original in that case., you could use my own merger of tabularx and longtable instead: ltxtable package. but Herbert's answer is the usage intended by ltablex I think. – David Carlisle Apr 22 '13 at 14:35
6

ltablex behaves like a longtable, the reason why you should use the \caption as a tabular line:

\documentclass{report}
\usepackage{ltablex}
\begin{document}

\begin{table}
\begin{tabularx}{\linewidth}{|c|}
\caption{Caption 1.}\\ % "Table 1"
empty table
\end{tabularx}
\end{table}

\begin{table}
\begin{tabularx}{\linewidth}{|c|}
\caption{Caption 2.}\\ % "Table 2"
empty table
\end{tabularx}
\end{table}

\end{document}

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.