home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Education Sampler 1992 [NeXTSTEP]
/
Education_1992_Sampler.iso
/
Mathematics
/
TeX
/
TeXsis-2.15
/
TXSletr.tex
< prev
next >
Wrap
Text File
|
1992-08-04
|
11KB
|
246 lines
% file: TXSletr.tex TeXsis version 2.15
% $Revision: 15.2 $ : $Date: 92/06/18 13:15:13 $ : $Author: paige $
%======================================================================*
% LETTER FORMAT E. Myers and F.E. Paige
%
% Format for typing simple business letters. Taken almost verbatim
% from The TeXbook, but modified to be a TeXsis "layout".
%
%-----------------------------------------------------------------------
% The following format is appropriate for use with TeXsis and BNL
% stationary. It can easily be adopted for other stationary or even for
% use outside of TeXsis; simply replace the \letter command with the
% proper initialization followed by \LetterFormat and use \letterhead or
% \phoneletterhead.
%
% \letter % initialize TeXsis and letter format
% \letterhead{xxxx} % xxxx is BNL extension
% \address % get address in box
% <name and address> % line endings are respected
% \body % begin text of letter
% Dear whoever,
%
% <text of your letter>
%
% \closing % begin closing
% Sincerely yours, % or whatever, indented
% Your Name % indented, followed by a space
% Your Title % optional additional line(s)
% \annotations % initials, enclosures, etc.
% <text> % can also use \ps
% \cc <name> % carbon copies
% <name> % to more than one person
% \bye % end of letter
%
% -----------------------------------------------------------------------
\message{Letter Format.}
% dimensions, counters, and boxes: \hdimphone and \vdimphone are the
% positions relative to the page edge -- not the print boundaries -- of the
% telephone number in \phoneletterhead. They are correct here for BNL
% stationary. Similarly, \hdimdate and \vdimdate are the positions for the
% date. These can be changed in TXSsite.tex to fit other stationary with
% a generally similar format.
\newdimen\headlineoffset \headlineoffset = 0.25 truein
\newdimen\longindent \longindent = 3.5 truein
\newdimen\hdimphone \hdimphone = 6.2truein
\newdimen\vdimphone \vdimphone = 1.9truein
\newdimen\hdimdate \hdimdate = 5.5truein
\newdimen\vdimdate \vdimdate = 2.15truein
\newskip\bigletterskip
\bigletterskip=1.0truein plus 1.0truein minus .75truein
\newbox\theaddress % to collect the address in
% -----------------------------------------------------------------------
% Initialization. \LetterFormat is called by \letter but can also be
% called separately.
\def\LetterFormat{% %
\nopagenumbers % kill page numbers
\singlespaced % letters always begin \singlespaced
\quoteon % automatic open/close quotes
\longindent=3.5truein % indentation for signature
\headline={\LetterHeadline}% % running headline has addressee
\let\endmode=\par % start with this for \endmode
\let\body=\letterbody % \body begins text of letter
\let\text=\letterbody % \text is synonym
\let\date=\letterdate % \date puts date on top of letter
\let\cc=\ccletr % carbon copy for letter
\def\addressee{\relax}% % start with no addressee
}
\def\Letter{% document format for letters
\ContentsSwitchfalse % no table of contents
\refswitchfalse % no reference list
\auxswitchfalse % no forward references
\texsis % initialize
\singlespaced % single space default
\LetterFormat} % Setup using \LetterFormat
\def\letter{\Letter} % synonym
\def\LetterHeadline{% % headline for extra pages
\ifnum\pageno>1 % headline placement and spacing
\ifx\addressee\relax\relax % no addressee, so
{\tenrm\today\hfil Page \folio}% date and page
\else % otherwise addressee, date, page
{\tenrm\addressee\hfil\today\hfil Page \folio}%
\fi
\else\hfil\fi} % but nothing on page 1
% \LetterWidth adjusts the width of the letter to allow long or
% short letters to be fit nicely on the page.
\def\LetterWidth#1{% % set width for letter
\hsize=#1 % set \hsize
\dimen0=#1 % calculate horizontal shift ...
\advance \dimen0 by -6.5truein % subtract default
\divide \dimen0 by 2 %
\advance \hoffset by -\dimen0 % center letter
\advance \longindent by \dimen0 % adjust closing
}
\def\letterwidth{\LetterWidth} % synonym
\def\endletter{%\obsolete\endletter\bye %
\endmode\vfil\eject\end} % to end a letter
%-----------------------------------------------------------------------
% \today gives today's date. This is redundant in TeXsis but is
% included for completeness.
\def\today{\number\day\
\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\
\number\year}
%-----------------------------------------------------------------------
% \beginlinemode ends the previous mode and starts a mode where
% \obeylines is in effect.
\def\beginlinemode{\endmode\begingroup\parindent=0pt\parskip=0pt
\obeylines\def\endmode{\par\endgroup}}
% \beginparmode ends the previous mode and starts a mode where lines
% are concatenated.
\def\beginparmode{\endmode\begingroup\parskip=\medskipamount
\def\endmode{\par\endgroup}}
%-----------------------------------------------------------------------
% \address gets the address in a box, as well as printing it at the
% top of the letter. Line endings are respected here. The first line after
% \address is the \addressee, which is used in the heading on all pages
% after the first.
\def\address{% %
\vskip\bigletterskip % skip down for address
\beginlinemode % look for line ends in address
\getaddress} % and get address
{\obeylines\gdef\getaddress #1
#2
{#1\gdef\addressee{#2}%
\global\setbox\theaddress=\vbox\bgroup
%%%NOT \longindent \hsize=\longindent
\parskip=0pt
#2
\def\endmode{\egroup\endgroup \copy\theaddress}
}% end \gdef
}% end \obeylines for
%-----------------------------------------------------------------------
% Use \body before typing the body of the letter. This is defined
% to be \letterbody. \text is a synonym.
\def\letterbody{\bigskip % skip some
\beginparmode % paragraph mode
\raggedright\tolerance=2500 % letters are not justified
\noindent} % don't indent salutation
% Use \closing at the end of the letter. It automatically puts a
% space for a signature between the 1st and 2nd lines after \closing.
\def\closing{\beginlinemode\getclosing}
{\obeylines\gdef\getclosing #1
#2
{#1\nobreak\bigskip\nobreak\bigskip \leftskip=\longindent #2
\nobreak\vskip .5truein
\def
{\endgraf\nobreak}}}
% \annotations and \ps are used at the end of the letter. \annotations
% respects lines while \ps gives paragraph mode.
\def\annotations{\beginlinemode\nobreak\bigskip % skip down some
\def\par{\endgraf\nobreak}\obeylines\par}
\def\ps{\beginparmode\nobreak\bigskip % skip down some
\interlinepenalty 5000\def\par{\endgraf\penalty 5000}}
% \ccletr does \cc for a letter.
\def\ccletr{\beginlinemode%
\nobreak \bigskip% % skip down
\def\par{\endgraf\nobreak}% % as for \annotations
\obeylines\par% % obey lines
\ccitem{cc:\ }} % print cc:
\def\cc{\ccletr}
\def\CC{\cc}
\def\Encl{\beginlinemode%
\nobreak \bigskip% % skip down
\def\par{\endgraf\nobreak}% % as for \annotations
\obeylines\par% % obey lines
\ccitem{Encl:\ }} % print cc:
\def\encl{\Encl} % synonym
% \ccitem does the work for \cc and \Encl
\def\ccitem#1{\setbox0\hbox{#1\quad}% % box0 = argument
\parindent=\wd0 % get its width
\hang % hanging indentation
\rlap{\copy0}% % and write it
\nobreak% % forbid break
\vskip-\baselineskip\relax} % kill the skip
\def\newpage{\vfill\eject}
%-----------------------------------------------------------------------
% \letterhead just spaces down and puts the date at the top of the
% page. \phoneletterhead puts in a phone number and the date at positions
% given by \hdimphone, \vdimphone and \hdimdate, \vdimdate relative to
% the true page boundaries.
\def\letterhead#1{% %
\vbox{\vskip 0.5 truein}% % skip down for the date
\line{\hfil\today}% % right justify date
\vskip\bigletterskip}% % space down to the address
\def\phoneletterhead#1{% % #1 is phone number
\vbox{\vskip-\voffset\vskip-\headlineoffset % skip down to position
\vskip\vdimphone} % of phone number
\hbox{\hskip-\hoffset\hskip\hdimphone #1}% % skip over to number
\vskip-\vdimphone\vskip\vdimdate % skip down to date
\hbox{\hskip-\hoffset\hskip\hdimdate \today} % date
} %
\def\letterdate{% % \letterdate just puts date on letters
\vbox{\vskip 0.5 truein}% % skip down for the date
\line{\hfil\today}% % right justify date
\bigskip} % space down to the address
% >>> EOF TXSletr.tex <<<