Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

\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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.