Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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. :-(

share|improve this question
    
not an option to manually decrease the counter at the end of the table? –  Roelof Spijker Oct 24 '11 at 13:32
    
@whlt3: \facepalm... sometimes I think too difficult, especially when I'm not really comfortable with the environment. I only thought about suppressing the increment, not about the manual decrement... \addtocounter{table}{-1} is all that's needed... –  DevSolar Oct 24 '11 at 13:35
    
I've added it as an answer. –  Roelof Spijker Oct 24 '11 at 13:38

2 Answers 2

up vote 8 down vote accepted

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.

share|improve this answer
    
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

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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