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 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 :

\documentclass{flacards}

\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}

\usepackage[frenchb]{babel}

\usepackage{forloop} 

\begin{document}
\newcounter{ct}
\forloop{ct}{1}{\value{ct} < 11}{ 
  \card{\arabic{ct}}{}
}
\end{document}
share|improve this question
add comment

2 Answers 2

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

\card{\arabic{ct}}{~}

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
add comment

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
add comment

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.