1 %% Macros for typesetting of labels
5 % Default page parameters. You can change them before calling \setuplabels.
9 % Do we want rules around each label?
13 % Do we want cropmarks?
14 \newif\iflabelcropmarks
16 \def\labelcropm{\iflabelcropmarks\hbox to 0pt{\hss\vbox to \labelh{\crosshair{5pt}\vss\crosshair{5pt}}}\fi}
18 % Margins of each label
19 \newdimen\labelhmargin
22 \newdimen\labelvmargin
30 % Prepare of typesetting of #2 rows per #1 labels
37 \multiply\labelnum by #2
41 \rightskip=0pt plus 0.1pt
44 % Typeset one label as a box (in most cases, you want to use \label instead)
45 \long\def\labelbox#1{\hbox to \labelw{%
47 \iflabelrules\vrule\fi
50 \iflabelrules\hrule\fi
57 \advance\dimen0 by -2\labelvmargin
60 \advance\hsize by -2\labelhmargin
63 \hrule width \hsize height 0pt depth 0pt
70 \iflabelrules\hrule\fi
74 \iflabelrules\vrule\fi
78 % Typeset one label (#1 is expected to have the exact height, so it usually ends with a \vfil)
79 \long\def\label#1{\leavevmode\labelbox{#1}\penalty -100}
81 % Typeset #1 copies of label #2
83 \long\def\labels#1#2{{\leavevmode\setbox0=\labelbox{#2}%
88 \advance\labelcount by -1
89 \ifnum\labelcount>0\repeat
92 % Fill the whole page with copies of a label
93 \long\def\labelfill#1{\labels\labelnum{#1}}