TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to automatise the construction of my flashcards. I try with \foreach (tikz) and \forloop (forloop package), it's not working. The error is in the two case:

! LaTeX Error: There's no line here to end.
See the LaTeX manual or LaTeX Companion for explanation.

The code :





\forloop{ct}{1}{\value{ct} < 11}{ 
share|improve this question
up vote 3 down vote accepted

You have to specify some text also in the second argument. (La)TeX needs to go into horizontal mode, otherwise the error will show.

Since \null doesn't activate horizontal mode, it's useless. So


or \card{\arabic{ct}}{\ } will work.

share|improve this answer
Ha, now that is obvious now! And probably the cleanest way is to use \leavevmode in the second argument. – mbork Sep 19 '11 at 20:34
I understand my error.I tried to do short loop test just to see the result whitout the second argument. – La Raison Sep 19 '11 at 23:51

I have no idea what's going on in the \card macro (and unfortunately I don't have time to investigate it), but it seems that the empty second argument is the culprit. Interestingly enough, \card{\arabic{ct}}{\null} does not help (anyone has any idea why?), but \card{\arabic{ct}}{\ } does.

(And obviously the loop has nothing to do with that.)

share|improve this answer

Your Answer


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.