[OS X TeX] creating a "smart macro"
Alex Hamann
mailinglist at alex-hamann.de
Wed Apr 22 16:37:18 EDT 2009
Am 22.04.2009 um 15:08 schrieb Alan Munn:
> At 10:58 AM +0200 4/22/09, Alex Hamann wrote:
>> Hi,
>>
>> I need to create a number of name tags for a class. The idea is to
>> create a list of the students' names and have a macro that will
>> fetch the first name, then reexecute using the second name and so on.
>> This is the layout I created. Can anybody give me a hint how to
>> make a smart macro out of this that will work its way through a
>> list of 109 students and create a pdf in which every single page
>> looks like the output of the code below while replacing \1stname
>> and \lastname with the names in the list?
>>
>> TIA,
>> Alex
>>
>> \documentclass[landscape,a5paper,pagesize,DiV=14]{scrartcl}
>> \usepackage
>> [landscape,left=2cm,top=1cm,right=3cm,bottom=1cm,nohead,nofoot]
>> {geometry}
>> \usepackage{xltxtra}
>> \setmainfont[Mapping=tex-text]{Hoefler Text}
>> \pagestyle{empty}
>> \usepackage{fix-cm}
>> \begin{document}
>> \vspace*{7,5cm}
>> \center
>> \huge{\1stname}\\
>> \fontsize{60}{70}\selectfont
>> \textbf{\lastname}
>> \vspace*{-1cm}
>> \pagebreak
>>
>> \end{document}
>
> Use the datatool package. Store your names in an Excel or
> OpenOffice csv file and then read the data in.
>
> Assuming your csv file has column headings FirstName and LastName
> and is called students.csv the following will do the trick. (You
> might want to make the first name a bit bigger, though...) -Alan
>
> \documentclass[landscape,a5paper,pagesize,DiV=14]{scrartcl}
> \usepackage
> [landscape,left=2cm,top=1cm,right=3cm,bottom=1cm,nohead,nofoot]
> {geometry}
> \usepackage{xltxtra}
> \setmainfont[Mapping=tex-text]{Hoefler Text}
> \pagestyle{empty}
> \usepackage{fix-cm}
> \usepackage{datatool}
> \begin{document}
> \DTLloaddb{students}{students.csv}
> \DTLforeach{students}{%
> \firstname=FirstName,\lastname=LastName}{%
> \vspace*{7,5cm}
> \center
> \huge{\firstname}\\
> \fontsize{60}{70}\selectfont
> \textbf{\lastname}
> \vspace*{-1cm}
> \pagebreak
> }
> \end{document}
> --
> Alan Munn
>
Alan,
this sounds really exciting!
Thank you very much, I will give it a try tomorrow or on the weekend.
Thank you VERY much,
Alex
More information about the MacOSX-TeX
mailing list