Computing a value inside \setcounter

I am using an enumerate list. I often want to decrement the counter of a list, to get output like this:

1. Some text here
2. Some more text here
2. This is a re-use of the number
3. The counter increments
3. Decrement the counter just before this \item


I hoped to do \setcounter{enumi}{\value{enumi}+1}, but it doesn't do the arithmetic, it simply writes +1 in the PDF output.

You may want to use the \addtocounter instruction -- specifically, \addtocounter{enumi}{-1} -- to achieve your objective. The following MWE shows how this may be done.

\documentclass{article}
\begin{document}
\begin{enumerate}
\item Some text here
\item Some more text here
\item This is a re-use of the number
\item The counter increments
\item Decrement the counter just before this \texttt{\textbackslash item}
\end{enumerate}
\end{document}


If you find yourself executing \addtocounter{enumi}{-1} frequently, you may want to create a shortcut macro called, say, \decri (short for "decrement item counter") in your document's preamble:

\makeatletter

The advantage of this definition is that \decri will work automatically on enumi, enumii, etc. as necessary, depending on the depth of the current enumeration list. I.e., it's not necessary to provide separate macros to decrement LaTeX's first-level, second-level, etc enumeration counters. Acknowledgment: I owe this point about working on @enumctr to @egreg.
• If you use \@enumctr instead of enumi for defining \decri, then the command will work at any level of enumerate. – egreg Sep 29 '13 at 9:43