,

Reverse counting in LaTeX

LaTeX has ability to integrate many standard and user-defined counters that count from a, b, …, roman and arabic numbers and many more. Even counting backwards are relatively straightforward if you set a static number from which LaTeX can count downwards. Dynamically setting the value from which LaTeX is, however, slightly more difficult: To do…

LaTeX has ability to integrate many standard and user-defined counters that count from a, b, …, roman and arabic numbers and many more. Even counting backwards are relatively straightforward if you set a static number from which LaTeX can count downwards. Dynamically setting the value from which LaTeX is, however, slightly more difficult:

To do so, you first need to load the usepackage

\usepackage{totcount}

You then need to specify two sets of counters in the preamble, say, mycounter and mycounterD:

\newcounter{mycounterD}
\newtotcounter{mycounter}

Where mycounterD will be the counter that counts reverse (and mycounter counts the total number of items). Just after the \begin{document}, you will then need to initialize the counters by writing:

\setcounter{mycounterD}{\totvalue{mycounter}}
\addtocounter{mycounter}{1}

And wherever you want to decrement the counter, add the following code (can be shortened with a \newcommand environment):

\addtocounter{mycounter}{1}
\addtocounter{mycounterD}{-1}

I hope this works for you!