[OS X TeX] creating a "smart macro"

Alan Munn amunn at msu.edu
Wed Apr 22 15:08:06 CEST 2009

At 10:58 AM +0200 4/22/09, Alex Hamann wrote:
>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?
>\setmainfont[Mapping=tex-text]{Hoefler Text}
>  \textbf{\lastname}

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

\setmainfont[Mapping=tex-text]{Hoefler Text}
Alan Munn						amunn at msu.edu
Department of Linguistics
and Germanic, Slavic, Asian and African Languages		Tel. 
Michigan State University, East Lansing MI 48824 USA	Fax	517-432-2736

More information about the macostex-archives mailing list