14

For reasons both complex and confusing, I would like to caption a longtable without incrementing the table counter in the process.

I want to have two consecutive longtable environments to be captioned with identical table numbers; i.e. one longtable captioned "Table x.y: Data Set (Part A)" and one captioned "Table x.y: Data Set (Part B)", with x.y being identical for both tables.

Apparently however, even \caption*{} command bumps table. I am a bit at a loss here.

Note: I know that the xtab package would enable me to have one long table with switches of headers and captions mid-table. However I got a (different) problem with that package, akin to this question but sadly not solved by egreg's answer there; so this question should be considered longtable-only as xtab, supertabular etc. don't float my boat right now. :-(

DevSolar
  • 7,857

3 Answers3

17

You can simply decrease the table counter after the first table, this will ensure the second table receives the same number. Simply put

\addtocounter{table}{-1}

In between the two tables you wish to show.

Roelof Spijker
  • 17,663
  • 5
  • 55
  • 63
  • It is a bit wierd how LaTeX sometimes forces you to do something, then take it back again. I still have problems wrapping my mind around it, being so intent on not doing the thing in the first place I lose sight of the end to justify the means. – DevSolar Oct 24 '11 at 13:54
  • The answer provided by Joel Purra is a cleaner solution. – Franz Zieris Aug 06 '20 at 12:24
12

Instead of using the numbered longtable environment, use the unnumbered longtable* environment; enable with \usepackage{caption}.

See Axel Sommerfeldt's answer to Longtable caption numbering .

4

A patch for longtable:

\usepackage{longtable}
\usepackage{etoolbox}
\makeatletter
\newif\ifLT@nocaption
\preto\longtable{\LT@nocaptiontrue}
\appto\endlongtable{%
  \ifLT@nocaption
    \addtocounter{table}{\m@ne}%
  \fi}
\preto\LT@caption{%
  \noalign{\global\LT@nocaptionfalse}}
\makeatother
Leo Liu
  • 77,365
  • @david-carlisle Is there any reason that the longtable package always increment the table counter, by default? – javadr Sep 03 '17 at 13:45