Longtable confuses totalcount package [duplicate]

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:

marked as duplicate by David Carlisle longtable StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 19 '15 at 16:36

• 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
• 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

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}

• 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