My document is a (scr)book and I'm talking of parts and chapters here, but I think the underlying question is pretty generic.

  • I want tables in the book to be enumerated continuously, in a chapter.table way.

  • I reset the chapter counter for each part of the book using a custom-made MyPart command, which is necessary for several other reasons not presented here.

  • However, I do not want to reset the table numbering. (I.e., the "chapter" part in the table number should keep a running total of chapters across part boundaries.)

I got it working by defining a counter tabchapter, and bumping that one manually whenever a new \chapter is declared. I wanted to avoid having to declare something like \MyChapter solely for this purpose, but I was not satisfied with my solution:



\renewcommand*{\tableformat}{Tab. \thetable}

%% Ugly hijacking of a formatting command to follow...
    {\addtocounter{tabchapter}{1}\Huge\bfseries}   %% <<----  *COUGH*...


            Nothing much.

\MyPart{Book One}
\chapter{The First}
\exampletable{Some Table}
\chapter{The Second}
\exampletable{Other Table}
\MyPart{Book Two}
\chapter{The First of the Second}
\exampletable{Yet Another Table}

Is there another way to have some counter incremented whenever a standard sectioning command is called (i.e., somehow "linking" it to the standard counter)? Other than wrapping the bump in a custom \MyChapter command?


No need of titlesec

\renewcommand*{\tableformat}{Tab. \thetable}
| improve this answer | |
  • That's it! That's exactly the thing I've been looking for! It struck me as so "unexotic" a requirement that there had to be a less hack-ish way to do it... ;-) – DevSolar Oct 5 '11 at 16:14

The chngcntr package provides \counterwithin and \counterwithout that you can use to add/remove elements that force counter resetting. You're probably after

\usepackage{chngcntr}% http://ctan.org/pkg/chngcntr
| improve this answer | |
  • This will not number tables as <globalchapter>.<table> – egreg Oct 5 '11 at 16:08
  • Yes-ish... I want the running chapter total in the table number, i.e. akin to chapter.table, with resetting of table with each chapter. What I don't want is resetting the chapter part... but only for the purpose of table numbering. So I do need a custom counter of sorts, which gets incremented with each \chapter, but not reset with a new \part (or rather, \MyPart). But this package opens up several new ways to try it, so I'll see what inspiration brings up. ;-) – DevSolar Oct 5 '11 at 16:08
  • Oh, see what's going on now - it wasn't clear to me from reading the original question text. The MWE gives a better view of what is needed. – Werner Oct 5 '11 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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