About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-12-13: Ebook sale (12th December 2024 – 1st January 2025): cybercrime fiction short stories Unsocial Media and Smile for the Camera free; crime fiction short story The Briefcase free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

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.

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs