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 want to make a number of badges using LaTeX for the participants of a summer school. There are 40 or so people, so I don't want to manually change the name and compile and then print. I could think of:

  1. Making a single document with a dropdown box with 40 choices. I don't know if it is possible to automate the choosing and printing in this case.

  2. Using a script language such as python to call latex to do the job. But I have 0 experience with Python, and I didn't find a foolproof tutorial on the web (probably because of wrong search keywords).

So...I'm waiting for you guys to come up with a good solution :-).

share|improve this question
    
You should search this side for "serial letter". This will give you some examples on how people are getting data from .csv and producing mutliple pdfs from it. –  LaRiFaRi Jul 11 at 12:40
    
Probably datatool package provides some help –  Christian Hupfer Jul 11 at 12:49
1  
There's also csvsimple, which would surely be enough for this kind of task. Would take the fun out of the answer below, however.... –  jon Jul 11 at 13:43
    

1 Answer 1

up vote 8 down vote accepted
\documentclass{article}

\begin{document}


\makeatletter
\def\Name{\expandafter\@firstoftwo\name}
\def\Affiliation{\expandafter\@secondoftwo\name}
\setlength\fboxsep{10pt}

\@for \name:=%
{{David}{here}},%
{{Paulo}{There}},%
{{egreg}{Somewhere}},%
{{Werner}{Not Here}},%
{{Gonzalo}{Not There}}%
\do {
\clearpage
\fbox{\begin{minipage}[c][4cm]{6cm}
Name: \Name\\
Afilliation: \Affiliation
\end{minipage}}}

\end{document}
share|improve this answer
    
Thank you. It is a good start. Is there an \affiliation too?I tried but failed. –  Troy Woo Jul 11 at 13:21
1  
@user74973 updated with two fields per name, more could be added as an exercise:-) –  David Carlisle Jul 11 at 13:28
    
Wow,I really need to learn such techniques...is it something written in the texbook? –  Troy Woo Jul 11 at 13:30
1  
@user74973 \@for \@firstoftwo are defined in the latex format (so not in the texbook) The texbook of course describes the primitoves that define those commands. –  David Carlisle Jul 11 at 13:32

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.