I'd like to use the command \foo with an optional argument to step and print the counter value iterated according to the number passed.
So, for example, \foo[5] should step the counter 5 times, one by one.
(!) Note that it is not the same as \stepcounter{}{5}.
MWE
\documentclass{report}
\newcounter{mycount}
\setcounter{mycount}{0}
\newcommand{\foo}{\stepcounter{mycount}counter is \textbf{\themycount}}
\begin{document}
first use: \foo
second use: \foo
now using with option to iterate: \foo[2]
\medskip
\textit{desired output from line above should be:}
\medskip
now using with option to iterate: counter is \textbf{3,4}
\end{document}






counters are 5,6,7,8for example. – Sigur Jan 18 '19 at 23:57\NewDocumentCommandas soon as possible. Amazing and powerful. – Sigur Jan 19 '19 at 00:08