# flacards and forloop is working but not with tikz foreach

My flashcard with \forloop is working after your help. I try it with \foreach (tikz) but it's not working. The pdf files contain only one flash card in the bottom right corner, the 24th card and the 48th,...

The minimal non-working example is :

    \documentclass{flacards}
\usepackage[frenchb]{babel}
\usepackage{tikz}
\begin{document}

\foreach \x in {1,2,...,50}{\card{a}{b}}

\end{document}


but the \forloop version is working :

    \documentclass{flacards}
\usepackage[frenchb]{babel}
\usepackage{forloop}
\begin{document}

\newcounter{compteura}
\forloop{compteura}{1}{\value{compteura} < 11}{\card{a}{b}}

\end{document}


I prefer use tikz for the math possibility. Until such time I use package calc for doing math on counter.

I believe that the problem is in the fact that \foreach does everything inside a group and this, for some reason, conflicts with the card production of flacards; indeed just the last card in each page is actually printed.

In order to see if my assertion is right, I ran the following test:

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\foreach \x in {1}{\def\pippo{X}}
\show\pippo
\stop


and TeX prompted

> \pippo=undefined.
l.5 \show\pippo

Unfortunately, also removing the group started by \foreach seems to do nothing (it's quite possible that other groups are used).

If you need the \foreach function only in cases such as {1,2,...,50} it's easy to replace it with other loops, as you already know. If the "list" processing is needed, please update your question. With etoolbox it's quite handy to process lists of values.

• thank, I understand the point. Your explications are very clear.I will try to use the other package flashcards.cls, or forloop with flacard.cls. – La Raison Sep 25 '11 at 0:21