Exercise 27: Name Labels Using a Data Base (Solution)
This is a solution to the data base part of Exercise 27. This document uses the dummy-logo.png sample image.\documentclass[a4paper]{article} % fonts and encodings %\usepackage{lmodern} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[cutmark]{ticket} \usepackage[margin=5mm]{geometry} \usepackage{graphicx} \usepackage{datatool} \DTLloaddb{people}{people.csv} \setlength{\unitlength}{1mm} \ticketNumbers{2}{3} \ticketSize{98}{90} \ticketDistance{4}{4} \renewcommand*{\ticketdefault}{% \put (80,82) {\includegraphics[width=12mm]{dummy-logo}}% \put (5,85) {\large\bfseries Secret Lab of Experimental Stuff} \put (5,75) {\large\scshape University of Somewhere} \put (45,30) {\makebox(0,0){\Large\itshape Culinary Experimental Research}} } \newcommand*{\myticket}[1]{% \ticket { \put (45,50) {\makebox(0,0) {\Large\bfseries #1}} }% } \begin{document} \DTLforeach*{people}% database name {\Forename=forenames,\Surname=surname}% assignment {\myticket{\Forename\ \Surname}}% loop body \end{document}
Download namelabels2.tex or namelabels2.pdf.