Looping with LaTeX — Generating Name Cards

Today I had to generate a few name cards, LaTeX and the pgffor command came very handy doing that. I am not entirely satisfied with this solution, since the margins are hardwired, so if you have a better way just tell me.

\documentclass[45pt,ngerman]{scrartcl}
\usepackage[left=1cm,right=1cm,top=1.5cm,bottom=0.5cm,a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{pgffor}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{lmodern}
\usetikzlibrary{positioning}
\pagestyle{empty}
\setlength{\parskip}{0pt}
\begin{document}
\centering

\foreach \x in {Manfred Mustermann, Gabi Mustermann, Manuela Mustermann}{
\begin{tikzpicture}
[mybox/.style={rectangle,black,xshift=0cm,yshift=0cm,minimum width=0.975\textwidth,font=\bfseries,draw=black,very thick,align=center, minimum height=0.475\textheight}]
\node at (0,0) [mybox] {\x};
\node at (0,0.475\textheight) [mybox] {};
\end{tikzpicture}\clearpage}

\end{document}

dann

Uwe

Uwe Ziegenhagen likes LaTeX and Python, sometimes even combined. Do you like my content and would like to thank me for it? Consider making a small donation to my local fablab, the Dingfabrik Köln. Details on how to donate can be found here Spenden für die Dingfabrik.

More Posts - Website