%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                       Autoletter -- TeX Procedure
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                          Author: E. V. Bell, II
%                    Department of Physics and Astronomy
%                           University of Kansas
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                                   V1.1
%       This TeX file is designed to take a file with a list of of names
%       and a file with the text of a form letter and will process a letter
%       for each name.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\input letter_format
     
\message{+------------------------------------------+}
\message{| AutoLetter Version 1.1 -- 9 October 1986 |}
\message{+------------------------------------------+}
     
\newread\addressfile
     
\message{Enter name of file containing the addresses:}
\read-1 to\addfile
\openin\addressfile=\addfile
     
\message{Enter name of file containing the body of the letter:}
\read-1 to\letfile
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Now read in an entry containing the person to whom to send the letter
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\endlinechar=-1
\read\addressfile to\text \let\title=\text
     
\loop
    \read\addressfile to\text \let\firstname=\text
    \read\addressfile to\text \let\nickname=\text
    \read\addressfile to\text \let\middlename=\text
    \read\addressfile to\text \let\lastname=\text
    \read\addressfile to\text
        \ifx\text\blank\def\jr{}\else\def\jr{, \text}\fi
        \endlinechar='015
    \message{Now processing letter to \addressee.}
    \getaddress
    \doletter
      \endlinechar=-1
    \read\addressfile to\text \let\title=\text
    \ifeof\addressfile\endfalse\else\endtrue\fi
    \ifend
\repeat
     
\bye
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                          Author: E. V. Bell, II
%                    Department of Physics and Astronomy
%                           University of Kansas
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                                  V1.2
%      This file is to be used in the production of form letters.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\input KUBasic
     
\twelvept
     
\hsize=6.5truein
\vsize=8.0truein
\hoffset=1.0truein
\voffset=1.5truein
     
\raggedbottom
\interlinepenalty=1000
\parindent=0pt
\parskip=0pt
     
\nopagenumbers
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%      Define some stuff so that the headlines will come out the way
%      we want them to be.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\newbox\headbox
\headline={\ifnum\pageno>1
   {\twelverm
      \global\setbox\headbox=\vbox\bgroup%
         \leftline{\addressee}
         \leftline{\today}
         \leftline{Page \folio}\egroup}\copy\headbox
   \else\hfil\fi}
     
\def\makeheadline{\vbox to 0pt{\vskip-70.6pt
   \line{\vbox to30.6pt{}\the\headline}\vss}
   \nointerlineskip}
     
\newif\ifend
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Macros for reading in the address from the file.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\def\blank{}
     
\def\endletter{\endmode\vfill\eject\pageno=1}
     
\newdimen\longindentation \longindentation=10truecm
\newbox\theaddress
\newif\ifast
\def\aster{* }
\def\getaddress{{\global\setbox\theaddress=\vbox\bgroup\raggedright%
   \hsize=\longindentation
   \everypar{\hangindent2em}
      \line{\vbox to10.2pt{}\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}}}
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Macros for formatting the letter.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\def\letterbody{\beginparmode}
\def\closing{\beginlinemode\getclosing}
{\obeylines\gdef\getclosing #1
   #2
      {#1\nobreak\bigskip \leftskip=\longindentation #2
      \nobreak\bigskip\bigskip\bigskip\bigskip % space for signature
      \def
      {\endgraf\nobreak}}}
\def\annotations{\beginlinemode\def\par{\endgraf\nobreak}\obeylines\par}
\def\ps{\beginparmode\nobreak
   \interlinepenalty5000\def\par{\endgraf\penalty5000}
   P.~S.\ }
     
\def\address{\beginlinemode \copy\theaddress \endgroup}
\def\doletter{{\leftskip=\longindentation%
      \rm\today\bigskip\address\bigskip}
   \input \letfile}
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Macros for setting up forms of salutation.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\def\mr{Mr.}
\def\ms{Ms.}
\def\mrs{Mrs.}
\def\miss{Miss}
     
\def\addressee{\ifx\blank\title\else\title\space\fi%
   \firstname\space\ifx\blank\middlename\else\middlename\space\fi%
   \lastname\jr}
\def\person{\ifx\blank\title Sir or Madam\else\title\space\lastname\fi}
\def\familiar{\ifx\blank\nickname \firstname\else\nickname\fi}
\def\formal{\ifx\mr\title Sir\else{\ifx\ms\title Madam\else%
   {\ifx\mrs\title Madam\else{\ifx\miss\title Madam\else{\person}\fi}%
   \fi}\fi}\fi}




%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                          Labels -- TeX Procedure
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                          Author: E. V. Bell, II
%                    Department of Physics and Astronomy
%                           University of Kansas
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                                   V1.0
%       This TeX file is designed to take a file with a list of of names
%       process a label for each name.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\input label_format
     
\message{+----------------------------------------+}
\message{| Labels Version 1.0 -- 29 December 1986 |}
\message{+----------------------------------------+}
     
\newread\addressfile
     
\message{Enter name of file containing the addresses:}
\read-1 to\addfile
\openin\addressfile=\addfile
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Now read in an entry containing the person to whom to send the letter
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\endlinechar=-1
\read\addressfile to\text \let\title=\text
     
\loop
    \read\addressfile to\text \let\firstname=\text
    \read\addressfile to\text \let\nickname=\text
    \read\addressfile to\text \let\middlename=\text
    \read\addressfile to\text \let\lastname=\text
    \read\addressfile to\text
        \ifx\text\blank\def\jr{}\else\def\jr{, \text}\fi
        \endlinechar='015
    \message{Now processing label for \addressee.}
    \getaddress
    \dolabel
        \endlinechar=-1
    \read\addressfile to\text \let\title=\text
    \ifeof\addressfile\endfalse\else\endtrue\fi
    \ifend
\repeat
     
\bye
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                           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 33 labels per 8-1/2 x 11 inch page. (EVB II, 12/29/86)
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       This output routine does a triple column page with no headers or
%       footers. Taken from the TeXbook. (TS, 12/18/86)
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\input KUBasic
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Set up the page sizes and other dimensions.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
     
\newdimen\fullhsize
     
\hsize=2.8225truein
\fullhsize=8.5truein
\vsize=11.0truein
\hoffset=0.25truein
\voffset=-0.175truein
     
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       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{}\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{\ifx\blank\title\else\title\space\fi%
   \firstname\space\ifx\blank\middlename\else\middlename\space\fi%
   \lastname\jr}
 
 

.
