%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                           TeX Master: E. V. Bell, II
%                       Department of Physics and Astronomy
%                              University of Kansas
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                                     V1.2
%       This file contains the formatting macros for the LABELS procedure.
%       The macros in this file are based on some provided from a TeXhax
%       submission by Ted Shapin, Beckman Instruments, Fullerton, CA, on
%       December 18, 1986. They can be used to produce mailing labels from
%       a name and address file of the form that AUTOLetter uses. The format
%       is 30 labels per 8-1/2 x 11 inch page. (EVB II, 12/29/86) (3x10)
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       This output routine does a triple column page with no headers or
%       footers. Taken from the TeXbook. (TS, 12/18/86)
%	The margins were revised to print perfectly on sticky label paper
%       with 3 columns, 10 rows of labels (30 labels/page)
%       December, 1989 Revised by Yvonne Nagel to assume the entire name is
%       on a single line rather than broken up into components.  See the 
%       file add.tex for the correct formatting of addresses.  The first 
%	line is \familiar, the second line is \fullname
%	October 30, 1991 Revised to print labels left justified, 10 rows
%	Jan 10, 1996 revised to print on label 3x10 paper (30 labels/page)
%
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

%\input KUBasic  (the section below is all we need from KUBasic)

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Define what "Line" and "Paragraph" mode mean.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\beginlinemode{\endmode\parskip=0pt\parindent=0pt
   \begingroup\obeylines\def\endmode{\par\endgroup}}

\def\beginparmode{\endmode
   \begingroup\parskip=\medskipamount\def\endmode{\par\endgroup}}

\let\endmode=\par


%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Set up the page sizes and other dimensions.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\newdimen\fullhsize

\hsize=2.8225truein
\fullhsize=8.5truein
\vsize=10.0truein
\hoffset=-.75truein
\voffset=-.55truein
%\voffset=-1.1truein

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Select fonts
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\font\hlvb=cmbx9 at 9pt
\font\hvn=cmr9 at  9pt
 \hvn

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Set up output routine.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\fulline{\hbox to \fullhsize}
\let\lr=L
\def\columnbox{\leftline{\pagebody}}
\newbox\leftcolumn
\newbox\midcolumn

\output={\if L\lr
   \global\setbox\leftcolumn=\columnbox
      \global\let\lr=M \else
         {\if M\lr \global\setbox\midcolumn=\columnbox
            \global\let\lr=R \else
               \tripleformat \global\let\lr=L\fi}\fi
   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}

\def\tripleformat{\shipout\vbox to\vsize{
   \fulline{\box\leftcolumn\hfil\box\midcolumn\hfil\columnbox}}
   \advancepageno}

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Set up stuff so that there is no top offsets, offsets between lines,
%       paragraphs, etc.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\parindent=0pt\topskip=0pt\lineskip=0pt plus .4pt\parskip=0pt

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Macros for reading in the address from the file.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\blank{}

\newbox\theaddress

\newif\ifast
\def\aster{* }

\newif\ifend

\def\getaddress{{\global\setbox\theaddress=\vbox\bgroup\raggedright%
   \everypar{\hangindent2em}
      \line{\vbox to10.2pt{}\hlvb\addressee\hss}\egroup%
   {\loop{\read\addressfile to\text
      \ifx\text\aster\astfalse\else\asttrue\fi
      \ifast\global\setbox\theaddress=\vbox\bgroup\unvbox\theaddress
         \line{\vbox to 10.2pt{}\text\hss}\egroup}\repeat}}}

\def\address{\beginlinemode \copy\theaddress \endgroup}
\def\dolabel{\vbox to1.0truein{\vfil\hbox to\hsize{\hfil\address\hfil}\vfil}}

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Macros for setting up the addressee's name.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\addressee{\fullname}

