I have several counters in my document, defined as follows:

\newcounter{koala} \newcommand*\koala[1][]{\refstepcounter{koala}\textbf{\thekoala #1} } \setcounter{koala}{0}

I know that I can start the counter at any number I like by using the \setcounter command.

However, in my document I need to skip a series of numbers. For example I will start with 1, 2, 3, 4, but then need to jump to 23, 24, 25 etc.

Is there a simple command(s) that will add a specific number to the counter so this can be achieved?

  • 1
    Use \seccounter again when you want to start from a new number. This may "cost as much as" what you want actually.
    – M. Logic
    May 3 '18 at 4:35
  • Thanks. However, I wish to add a specific number. For example if my numbering was 1, 2, 3, 23, 24, 25, if I then added in '4', I would like the numbering to become 1, 2, 3, 4, 24, 25, 26.
    – C. de Haer
    May 3 '18 at 4:58
  • use more times!
    – M. Logic
    May 3 '18 at 5:00
  • @HeikoOberdiek’s answer is, perhaps, even too elaborate: the short answer is: yes, there is a simple command that adds a specific number to counter, and it is named \addtocounter… ;-)
    – GuM
    May 3 '18 at 14:48

If the counter is only incremented by macro \koala, then the skipping can be put there:

  \textbf{\thekoala #1}%

An alternative approach is to manipulate the counter at the formatting level:

  \ifnum\value{koala}>4 %
    \@arabic{\numexpr\value{koala} + 18\relax}%

With this approach, \value{koala} is incremented continuously, but \thekoala jumps.

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.