I am trying to create a series of boxes so that my students can input there id number for there final exam.
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newsavebox{\idbox}
\sbox{\idbox}{\framebox[4.5mm]{\vrule depth 1.25mm width 0pt height 2.5mm}}
\newcommand{\nidbox}[1]{%
\foreach \i in {1,...,#1}
{
\usebox{\idbox}\kern-1.5pt
}}
\begin{document}
\nidbox{5}
\end{document}
What I want is to be able to put ID Number directly aligned on top of the first framebox and to be left justified. I have been trying to use \raisebox
like:
\def\idnum#1{\raisebox{0.8\baselineskip}[1ex][2ex]{%
ID NUMBER}\kern-4cm #1}
where its implementation would be like \idnum{\nidbox{5}}
.
Sincerely I do not know if it is the best approach but I believe that I am forcing it. I know that I can probably do it using a table or with an array but am trying to find out a different approach. Any insights into the matter will be highly appreciated.
Best Answer
I prefer
expl3
totikz
for repeating things:A
tabular
environment is just the more convenient way to align objects. Atabular
free macro could beBut I don't see why one should prefer this approach to the simplicity of a
tabular
.