4

I try to use \forLoop for a countdown sequence:

\documentclass{minimal}

\usepackage{forloop}
\usepackage{fmtcount}

\begin{document}
\newcounter{idx}
\forLoop[-1]{10}{1}{idx}{\numberstring{idx}\\}
\end{document}

But this simply does not do anything. If the step is positive, everything is fine. I looked up the documentation for forloop and in the implementation \addtocounter was used to increment/decrement the counter. \addtocounter accepts negative values and effectively adds them to a specified counter.

So my question is: what am I doing wrong here?

5

\forLoop does \addtocounter only if the condition \value{idx}<1, with your settings, is satisfied, which is never. The package documentation tells that \forLoop is deprecated. So

\forloop[-1]{idx}{10}{\value{idx}>0}{\arabic{idx}}

should be your choice.

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.