%%
%% This is file `labels.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% labels.dtx  (with options: `package')
%% Copyright (C) 1993-1994-1995 by Sebastian Rahtz
%% All rights reserved.
%% 
%% Permission is granted to to customize the declarations in this file to
%% serve the needs of your installation.  However, no permission is
%% granted to distribute a modified version of this file under its
%% original name.
%% 
\def\LabelsFileInfo{1998/01/24, v.11}
%% File: labels.dtx  Copyright (C) 1993-1994-1995-1998 by Sebastian Rahtz
%%   and Grant Gustafson
%% All rights reserved.
\ProvidesPackage{labels}[\LabelsFileInfo]
\NeedsTeXFormat{LaTeX2e}
\newcount\LabelCols
\newcount\LabelRows
\newdimen\LeftBorder
\newdimen\RightBorder
\newdimen\TopBorder
\newdimen\BottomBorder
\newcount\numberoflabels
\newdimen\label@width
\newdimen\label@height
\newdimen\half@label
\newdimen\area@width
\newdimen\addr@width
\newdimen\LabTmp
\newsavebox{\this@label}
\newcount\label@number
\newcount\skip@labels
\newcount\l@so@far
\newcount\LabelTotal
\newif\ifLabelGrid
\newif\iffirst@label
\newif\ifLabelInfo
\first@labeltrue
\LabelGridfalse
\LabelInfofalse
\ifdim\paperwidth=210mm\relax%
   \LabelCols=3\relax\LabelRows=8\relax% a4paper
\else
   \LabelCols=3\relax\LabelRows=7\relax% letterpaper
\fi%
\LeftBorder=8mm
\RightBorder=8mm
\TopBorder=9mm
\BottomBorder=2mm
\textwidth=\paperwidth
\textheight=\paperheight
\topmargin=-1in
\headheight=0em
\headsep=0em
\topskip=0em
\footskip=0em
\oddsidemargin=-1in
\evensidemargin=-1in
\pagestyle{empty}
\parindent=0em
\parskip=0pt
\def\@LabelSetup{%
\global\label@width\textwidth%
\global\divide\label@width by\LabelCols%
\global\label@height\textheight%
\global\advance\label@height by-\TopBorder%
\global\advance\label@height by-\BottomBorder%
\global\divide\label@height by\LabelRows%
\global\topmargin=-1in\global\advance\topmargin by\TopBorder%
\global\area@width=\label@width%
\global\advance\area@width by -\LeftBorder%
\global\advance\area@width by -\RightBorder%
\ifLabelGrid%
\global\advance\area@width by-2\fboxsep%
\global\advance\area@width by-2\fboxrule%
\fi%
\ifLabelGrid%
\global\advance\label@height by-2\fboxsep%
\global\advance\label@height by-2\fboxrule%
\fi%
\global\half@label=\label@height\divide\half@label by2\relax
\global\label@number=1\relax
}
\def\LabelSetup{\@LabelSetup%
\ifLabelInfo
   \typeout{Control sequences adjustable in the preamble:}
   \typeout{\LabelRows=\the\LabelRows}
   \typeout{\LabelCols=\the\LabelCols}
   \TypeoutBlurb{\TopBorder}{\TopBorder}
   \TypeoutBlurb{\BottomBorder}{\BottomBorder}
   \TypeoutBlurb{\LeftBorder}{\LeftBorder}
   \TypeoutBlurb{\RightBorder}{\RightBorder}
   \typeout{Computed values:}
   \TypeoutBlurb{Label Width}{\label@width}
   \TypeoutBlurb{Label Height}{\label@height}
\else
   \typeout{To print info, put `\protect\LabelInfotrue' in the preamble}
\fi
}
\numberoflabels=1%
\def\sticky@label{\l@so@far=0%
\loop\ifnum\l@so@far<\numberoflabels\advance\l@so@far by 1\make@label%
\repeat}
\def\make@label{%
\ifnum\LabelTotal=0\vfill\eject\LabelTotal=\LabelRows\relax
\multiply\LabelTotal by \LabelCols\fi
\advance\LabelTotal by -1\relax
\ifLabelGrid%
 \let\boxing@type\framebox%
\else%
 \let\boxing@type\makebox%
\fi%
\settowidth{\LabTmp}{\usebox{\this@label}}%
\ifdim\LabTmp=0cm\let\action=\relax\else\let\action=\BuildB@x\fi%
\advance\LabTmp by -\area@width%
\ifdim\LabTmp>0cm\relax%
\PkgBlurb{Label too wide}{\LabTmp}\fi%
\settoheight{\LabTmp}%
{\begin{tabular}{l}\usebox{\this@label}\end{tabular}}%
\advance\LabTmp by -\half@label%
\ifdim\LabTmp>0cm\relax%
\LabTmp=2\LabTmp\PkgBlurb{Label too tall}{\LabTmp}\fi%
\ifnum\skip@labels<\sk@pped\let\action=\BuildB@x\fi%
\action
}
\def\BuildB@x{%
\boxing@type[\label@width][c]{%
\rule{0pt}{\label@height}%
\raisebox{\half@label}[0pt][0pt]{%
\rule{\LeftBorder}{0pt}%
\usebox{\this@label}%
\rule{\RightBorder}{0pt}%
}}%
\ifnum\skip@labels<\sk@pped\message{x}\else\message{+}\fi%
\ifnum\label@number=\LabelCols%
\message{|}%
\endgraf\nointerlineskip%
\global\label@number=1\else\global\advance\label@number by 1\fi%
}%
\newcount\@Milli
\def\ToMilli#1{\@Milli=#1\advance\@Milli by93225\relax
\divide\@Milli by 186450\relax}
\def\PkgBlurb#1#2{\ToMilli{#2}%
\PackageWarning{labels}{#1 by \the\@Milli mm (\the #2)}%
}
\def\TypeoutBlurb#1#2{\ToMilli{#2}%
\typeout{#1=\the\@Milli mm (\the #2)}%
}
\newcommand{\genericlabel}[1]{%
\iffirst@label\LabelSetup\first@labelfalse\fi%
\savebox{\this@label}{#1}\sticky@label\@gobblecr}
\long\def\L@dblarg#1{\@ifnextchar[{#1}{\L@xdblarg{#1}}}
\long\def\L@xdblarg#1#2{#1[]{#2}}
\long\def\addresslabel{\L@dblarg{\@addresslabel}}
\long\def\@addresslabel[#1]#2{\genericlabel{#1%
\begin{tabular}{@{}p{\area@width}@{}}\raggedright #2\end{tabular}}}
\long\def\boxedaddresslabel{\L@dblarg{\@boxedaddresslabel}}
\long\def\@boxedaddresslabel[#1]#2{\genericlabel{#1%
\addr@width=\area@width\advance\addr@width by-2\fboxsep%
\advance\addr@width by-2\fboxrule\fbox{%
\begin{tabular}{@{}p{\addr@width}@{}}\raggedright #2\end{tabular}}}}
\long\def\labels
{\iffirst@label\LabelSetup\first@labelfalse\fi\start@@label}
\def\endlabels{\end@@label}
\def\start@@label{%
\savebox{\this@label}\bgroup\raggedright%
\begin{minipage}{\area@width}\raggedright%
\catcode `\^^M =\active\@gobblecr%
}%
\def\end@@label{%
\end{minipage}\egroup%
\sticky@label}%
\def\start@newline{\mbox{}\expandafter\newline}%
\def\new@label{\end@@label\start@@label}%
\catcode `\^^M = \active%
\def ^^M{\futurelet\nexttoken\isitapar}%
\def\isitapar{\ifx^^M\nexttoken\let\action=\new@label\else%
\let\action\start@newline\fi\action}%
\catcode `\^^M = 5\relax%
\def\labelfile#1{\begin{labels}\input#1\end{labels}}
\def\promptlabels{\typein[\labelfilename]{What is the name of the
label file?}
\labelfile{\labelfilename}}
\newcount\sk@pped
\def\skiplabels#1{\sk@pped=#1%
\savebox{\this@label}{\rule{0pt}{.5in}}%
\skip@labels=0\relax
\loop\ifnum\skip@labels<\sk@pped\make@label%
\advance\skip@labels by 1\relax\repeat}
\endinput
%%
%% End of file `labels.sty'.
