%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%                          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.
%      Modified by Paul Schuette
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\magnification=\magstephalf

\raggedbottom
\hsize=6.25truein
\voffset=-24pt
\interlinepenalty=1000
\advance\vsize by-\voffset
\parindent=0pt
\parskip=0pt
\nopagenumbers
\headline={\ifnum\pageno>1
  \tenrm To \addressee\hfil\today\hfil Page \folio
  \else\hfil\fi}

\nopagenumbers

\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or
  December\fi \space\number\day, \number\year}

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%      This is the Letterhead Macro file
%      
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\input letheads

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%      Define some stuff so that the headlines will come out the way
%      we want them to be.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\newbox\headbox
\headline={\ifnum\pageno>1 \vfil}
\def\makeheadline{\vss}
\newif\ifend

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

\def\blank{}
\let\endmode=\par%hopefully this won't cause problems!
\def\endletter{\endmode\vfill\eject\pageno=1}

\newdimen\longindentation \longindentation=4truein
\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{
      %{\mathletterhead                  % letterhead for official letters
      {\Wmathletterhead                 % fancy letterhead for official letters
      %{\homeletterhead                 % letterhead for informal letters
      %{\noletterhead                   % informal letterhead - no return address
      \bigskip\bigskip
      \leftskip=\longindentation%
      \bigskip\rm\today \vskip .5truein
      \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{\fullname}%
\def\familiar{\nickname}% 
%\def\institute{\instname}% 

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       The macros for outputting the date and time of day.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\today{\ifcase\month\or
   January\or February\or March\or April\or May\or June\or
   July\or August\or September\or October\or November\or December\fi
   \space\number\day, \number\year}

\def\sciday{\number\day
   \space\ifcase\month\or
   January\or February\or March\or April\or May\or June\or
   July\or August\or September\or October\or November\or December\fi
   \space\number\year}

\newcount\tyme% Create some new counters for keeping track of the hour
\newcount\hour% of day, the minute of hour, etc.
\newcount\minute

\def\amorpm{a.m.}
%       "Time-of-day" macro
\def\tod{\number\hour:\ifnum\minute<10{}0\fi\number\minute\space\amorpm}

\tyme=\time% The following bunch of junk is to figure out the time.
\divide \tyme by 60% Calculate the hour of the day
\hour=\tyme
\ifnum\hour=12\gdef\amorpm{p.m.}\fi% Conform to 12 hour clock
\ifnum\hour=0 \advance \hour by  12\fi
\ifnum\hour>12\advance \hour by -12\gdef\amorpm{p.m.}\fi
\multiply \tyme by 60
\advance \time by -\tyme% Calculate the minute of the hour
\minute=\time
\advance \time by \tyme% Reset the "time" counter

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       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

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Define a decent looking underline.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\underule#1{$\setbox0=\hbox{#1} \dp0=\dp\strutbox
    \m@th \underline{\box0}$}

%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
%       Define sequences so that we can indent paragraphs regardless of
%       whether block paragraphs or paragraph indentation is specified.
%::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

\def\narrow{\advance\leftskip by3em \advance\rightskip by3em}
\def\wide{\advance\leftskip by-3em \advance\rightskip by-3em}

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

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

