1

This question already has an answer here:

I'm using a longtable for the nomenclature produced by the nomencl package. Here, the longtable serves as a tabluar replacement. Unfortunately, the usage confuses the totalcount package resulting in an uncorrect table count.

MWE:

\documentclass{report}
\usepackage{longtable}
\usepackage[figure,table]{totalcount}

\begin{document}
\verb|\totaltables| is \totaltables, but should be 2.

\begin{table}One\caption{Table One}\end{table} % ONE
\begin{table}Two\caption{Table Two}\end{table} % TWO

\begin{longtable}{cc}
Long & Bla
\end{longtable}

\end{document}

Result:

enter image description here

marked as duplicate by David Carlisle longtable Mar 19 '15 at 16:36

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You are using three tables, so the count is correct. longtable does not have a longtable counter but uses the standard table counter. – user31729 Mar 19 '15 at 15:57
  • 1
    I don't have the totalcount package, but you can check this question. Looks like it could help you. – TonioElGringo Mar 19 '15 at 16:10
  • @TonioElGringo, thanks! That's what I was looking for. – quinmars Mar 19 '15 at 16:18
2

longtable increments the table counter and then arranges that \caption does not increment it. (So not like table which relies on \caption to increment the counter.)

This simplifies some aspects of having multiple captions for continued page heads in longtable, but it's not that brilliant a design really.

Since you know you haven't used \caption in this longtable you can set the counter back one to make up for longtable having incremented it:

\documentclass{report}
\usepackage{longtable}
\usepackage[figure,table]{totalcount}

\begin{document}
\verb|\totaltables| is \totaltables, but should be 2.

\begin{table}One\caption{Table One}\end{table} % ONE
\begin{table}Two\caption{Table Two}\end{table} % TWO

\begin{longtable}{cc}
Long & Bla
\end{longtable}
\addtocounter{table}{-1}

\end{document}
  • this appears to be a duplicate, I'll vote to close – David Carlisle Mar 19 '15 at 16:36
  • Thank you for the explanation! I'm going to use the starred longtable* environment of the caption as suggested in this answer. – quinmars Mar 19 '15 at 16:38

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