4

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

  • 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 '14 at 12:40
  • Probably datatool package provides some help – user31729 Jul 11 '14 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 '14 at 13:43
  • Related: Template for Cubicle Tags (Desk Tags) in LaTeX. – Mike Renfro Jul 11 '14 at 14:49
8
\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}
  • Thank you. It is a good start. Is there an \affiliation too?I tried but failed. – Troy Woo Jul 11 '14 at 13:21
  • 1
    @user74973 updated with two fields per name, more could be added as an exercise:-) – David Carlisle Jul 11 '14 at 13:28
  • Wow,I really need to learn such techniques...is it something written in the texbook? – Troy Woo Jul 11 '14 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 '14 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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