[Tex/LaTex] Why does ltablex skip a number in captions

captionsfloatstablestabularx

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.

Best Answer

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}