Sharedwww / job / ucbletter.clsOpen in CoCalc
% ucbletter.cls
% Written by Paul Vojta, 15 Sep 1995.
% To change the date use the following command:
% \def\today{November 12, 1999}

% Announce the class name and version.

\ProvidesClass{ucbletter}[1997/11/23 University of California letter class]

% wide option - make the text wider (and taller).

\let\@wide 0
\DeclareOption{wide}{\let\@wide 1}

% signed option - memo only - put a letter-style closing at the end

\let\@signed 0
\DeclareOption{signed}{\let\@signed 1}

% center option - center the text in the page automatically

  \advance\oddsidemargin-1in\relax  \advance\oddsidemargin-.5\textwidth
  \evensidemargin\oddsidemargin  \indentedwidth.5\textwidth
  \@tempdima\@oldtextheight  \advance\@tempdima-\textheight
  \advance\topmargin.25\@tempdima  \advance\headsep.25\@tempdima

% Pass other options on to the base letter class.



%    ****************************************
%    *           LETTER COMMANDS            *
%    ****************************************
% The following declarations, shown with examples, give information
% about the sender:
% \name{Dr. L. User} : to be used for the return address on the
%          envelope.
% \signature{Larry User} : goes after the closing.
% \address{3245 Foo St.\\Gnu York} : used as the return address in the
%          letter and on the envelope.  If not declared, then an
%          institutional standard address is used.  If declared, then
%          the letterhead is suppressed unless \letterheadanyway is used.
% \letterheadanyway : Causes the letterhead to appear even if the \address
%          macro is used.
% \location{Room 374} : Acts as modifier to the standard institutional
%          address.
% \telephone{(415)123-4567} : Just in case some style puts it on the
%          letter.
% \email{[email protected]} : Put into the letterhead.
% \sigspace=36pt: amount of space to allow for the signature.  The default
%          value is 36 points, which is equivalent to four typewriter line
%          spaces.  This is the standard for business letters.  I've seen more
%          space used, but not less, and recommend against decreasing it,
%          although most requests to change it seem to refer to decreasing it.
%          I should put in a nasty warning if people put in too little space.
% In all of the above, the \sfcode for '.' is set to 1000, so one never needs
% to say "Mr.\ User".
% The following modify the letterhead; default values are declared at the end
% of the file:
% \upperaddress{1234 CHANNING WAY}
% \mailcode{9876}
% N.B.:  \department erases whatever \mailcode is in effect, so the \mailcode
% must come _after_ the \department.
% In this installation, the letterhead appears as:
% --------------------------------- <logo, etc.> ----------------
% \department                           \upperaddress
% \location                             BERKELEY, CALIFORNIA  94720-\mailcode
% \email *                              \telephone
%                                       \email *
%                                       \address
%                                       date
% * By default, the \email appears on the right; this can be overridden by
%   specifying \emailatleft or \emailatright.
% The macro \adjustmargins can be used to make the margins wider--for example,
% \adjustmargins{.5in}.  This affects top and bottom margins as well, but not
% the placement of the letterhead.  This should be done before the macro
% \begin{document}.
% Another option is to set \textwidth and \textheight directly.  Again, this
% should be done before \begin{document}; you should also adjust \oddsidemargin,
% \evensidemargin, and \indentedwidth if you change \textwidth, and \topmargin,
% \headsep, and \footskip if you change \textheight.  An alternative is to
% use the center option on the \documentclass line; it will then center the
% letter automatically.
% The signature will appear on the right, aligned with the address, if one is
% given; otherwise it will appear on the left.  This can be overridden with
% \closingatright or \closingatleft.
% The \makelabels declaration causes mailing labels to be made.  It
% must go before the \begin{document} command.
% The letter environment: creates a new letter, starting from page 1.
% (The first page is unnumbered.)  It has a single argument, which
% is the addressee and his/her address, as in
%        \begin{letter}{Sam Jones \\
%                       Institute for Retarded Study\\ Princeton, N.J.}
% Local declarations, such as \address, can follow the \begin{letter}.
% For informal letters, the address of the recipient can be left out:
%        \begin{letter}{}
% Text is begun with the \opening command, whose argument generates the
% salutation, as in
%           \opening{Dear Henry,}
% The body of the letter follows, ended by a \closing command, as in
%            \closing{Yours truly,}
% The 'signature' is provided automatically.
%  After the \closing you can put arbitrary stuff, which is typeset
%  with \parindent = 0 and no page breaking.  Commands designed
%  for use after the closing are:
%  \cc{Tinker\\Evers\\Chance} -- which produces:
%        cc: Tinker
%            Evers
%            Chance
%  \encl{Foo(2)\\Bar} -- which produces:
%        encl: Foo(2)
%              Bar
% This format also implements the UC interdepartmental memo format as a "memo"
% environment.  The use is much the same as for the letter environment;
% we will give here the differences.
% The \begin macro has one argument giving the recipient(s); for example,
%       \begin{memo}{Sam Jones\\Nicolas Bourbaki}
% To declare the subject of the memo, the \begin may be followed IMMEDIATELY
% by a \subject or \re macro:
%       \re{Our recent discussion}
% The text of the memo follows; the \opening macro, if present, is ignored.
% After the memo, one can invoke the \closing macro (whose argument, in this
% case, is ignored; the macro merely serves the purpose of preventing further
% page breaks).  The usual \cc and \encl options may follow this; if they are
% not used, then there is no point in using the \closing macro, either.
% The reason for keeping the \opening and \closing macros is so that a letter
% can be converted to a memo merely by changing the name of the environment.
% The converse works as well:  the \subject or \re macros are ignored in the
% letter environment.
% However, there is an option, which allows the end of the memo to be treated
% as a signed letter.  To specify this option, just include "signed" as one
% of the options in the \documentstyle line.  In that case the \closing
% macro functions just as it does for a letter.
% The format of the top of the memo is:
%                                       BERKELEY:  \department
%                                                  \location
%                                                  \upperaddress
%                                                  \telephone
%                                                  \email
%                                                  date
%  \opening{Dear Mr. Foo:}-
%     Should produce everything up to and including the 'Dear Mr. Foo:'
%     and a \par command that follows.  Since there's a \vfil at the
%     bottom of every page, it can add vertical  fil  to position a
%     short letter. It should use the following commands:
%     \toname       : name part of 'to' address.
%                     Will be one line long.
%     \toaddress    : address part of 'to' address.
%                     Lines separated by \\.
%     \fromname     : name of sender.
%     \fromaddress  : argument of current \address declaration--
%                     null if none.  Should use standard institutional
%                     address if null.
%     \fromlocation : argument of current \location declaration--
%                     null if none.
%     \telephonenum : argument of current \telephone declaration--
%                     null if none.
%     \emailaddr    : argument of current \email declaration
%     \departmentname:argument of current \department declaration
%     \[email protected]: argument of current \aboveaddress declaration
%     \frommailcode : argument of current \mailcode declaration
%     Note that  \ifx\foo\@empty  tests for a null value of \foo.
%  \closing{TXT} : Generates the closing matter, and the signature.
%     An obvious thing to do is to use a \parbox for the closing
%     and the signature.  Should use the following:
%     \fromsig    : argument of current \signature declaration or,
%                   if null, the \fromname .
%     \stopbreaks : a macro that inhibits page breaking.
%  \cc{ARG} and \encl{ARG} : obvious use of a \parbox[t] .
%  \ps : The only thing that this needs to do is call \startbreaks,
%        which allows page breaking again.
%  \stopletter : Command called by \endletter to do the following:
%     * Add any desired  fil  or other material at the end of the
%       letter.
%     * Define \returnaddress to be the return address for the mailing
%       label.  More precisely, it is the first argument of the \mlabel
%       command described below. It should be \def'd to null if the
%       return address doesn't appear on the labels.  Any command,
%       other than \\, that should not be expanded until the \mlabel
%       command is actually executed must be preceded by \protect.
%       Whenever possible, \protect commands in the definition of
%       \returnaddress---it's much more efficient that way.  In
%       particular, when the standard return address is used, you
%       should \def \returnaddress to something like
%       \protect\standardreturnaddress .
% Commands for generating the labels are put on the .AUX file, which is
% read in and processed by the \end{document} command.  You have to
% define the following two commands:
%    \startlabels : Should reset the page layout parameters if
%        necessary.
%    \mlabel{RETURN ADDRESS}{TO ADDRESS} : Command to generate a single
%        label.

%   In return addresses, etc., periods are treated as any other character, due
%   to the preponderance of abbreviations.



%\font\uc=cmr5 at 5\[email protected]
\font\five=cmr5 at 5\[email protected]
\font\six=cmr6 at 6\[email protected]
\font\topfont=cmr12 at 12\[email protected]
\font\emailfont=cmtt8 at 8\[email protected]


\newdimen\@lhdright        \@lhdright -4.5in
\newdimen\@lhddown         \@lhddown -26\[email protected]
\newdimen\@mhdright        \@mhdright 183\[email protected]
\newdimen\@mhddown         \@mhddown -44\[email protected]
\newdimen\emailskip        \emailskip9pt% baselineskip for email address
                           \setlength\footskip{79\[email protected]}
\newdimen\sigspace         \sigspace 36\[email protected]
\newdimen\@oldtextheight   \@oldtextheight\textheight


  \ifx\@empty\@tempa\else\ifdim\footskip<20\[email protected]
    \advance\textheight\footskip \footskip 20\[email protected] \advance\textheight-\footskip

\def\adjustmargins#1{\@tempdima#1 \advance\textwidth-2\@tempdima
  \advance\oddsidemargin\@tempdima  \advance\evensidemargin\@tempdima
  \advance\topmargin.5\@tempdima  \advance\headsep.5\@tempdima

\ifx\@wide 1 \adjustmargins{-53\[email protected]}\fi

%    ****************************************
%    *        THE UCB LETTER FORMAT         *
%    ****************************************

%|% Redefine the page style for the first page, so as to include the letterhead.

%|\renewcommand{\[email protected]}{%
%|   \renewcommand{\@oddhead}{<letterhead goes here>}%
%|   \renewcommand{\@oddfoot}{<letterfoot goes here>}%

  \vskip 8\[email protected]
  \hbox{\def\dot{\lower1\[email protected]\hbox{$\cdot$}}\mathsurround2.9\[email protected]\five
    \vbox{\hrule height0.2\[email protected]
      \hbox to322\[email protected]{\vrule height9.2\[email protected] depth5.5\[email protected] width\[email protected]\
      \hrule height0.2\[email protected]}%
    \setbox0\hbox{\lower18\[email protected]\hbox{\uc C}}\ht0=26\[email protected]\dp0=30\[email protected]
    \kern-4\[email protected]\box0\kern-4\[email protected]
    \vbox{\hrule height0.2\[email protected]
      \hbox to122\[email protected]{\vrule height9.2\[email protected] depth5.5\[email protected] width\[email protected]\hss
      \hrule height0.2\[email protected]}}
  \vskip2\[email protected]}

% Mechanism for actually putting the letterhead at the top of the page

% how much to skip when letterhead is present
% \skip\letterheadins72pt (defined in environment)
\count\letterheadins=1000 % length multiplication factor (1 to 1)
\dimen\letterheadins\vsize % maximum letterhead size


\def\@letterhead{% insert letterhead
  \longindentation293\[email protected]
  \insert\letterheadins{\@tempdima\@lhddown  \advance\@tempdima-\topmargin
    \advance\@tempdima-\headheight  \advance\@tempdima-\headsep
  {\ifx\@emailcol 0\ifx\@empty\fromaddress\else\let\@emailcol l\fi\fi
    \parindent\[email protected]\parskip\[email protected]\@dotfix
    % make left column
        \typeout{No department name given; hope that's OK.}%
      \ifx\@emailcol l \emailfont\baselineskip\emailskip\emailaddr\par\fi}%
    % make right column
    \setbox2\vbox{\hsize 211\[email protected]
        \[email protected]\par
        BERKELEY, CALIFORNIA\quad 94720%
      \ifx\@emailcol l\else {\emailfont\baselineskip\emailskip\emailaddr\par}\fi
    \advance\longindentation\@lhdright  \@fixindentedwidth}

\def\@noletterhead{\insert\letterheadins{\vskip-36\[email protected]
  \parbox\indentedwidth{\parindent\[email protected]\parskip\[email protected]\@dotfix\ignorespaces


\def\@memohead{% insert memohead
    \@tempdima\@mhddown  \advance\@tempdima-\topmargin
    \advance\@tempdima-\headheight  \advance\@tempdima-\headsep
    \advance\@tempdima.5\paperwidth  \advance\@tempdima-\oddsidemargin
    \hbox to\@tempdima{\hss
        \ifx\@empty\[email protected]\else\hbox{\[email protected]}\fi
        \vspace{36\[email protected]}\hbox{\today}}}}}

% The following line modified for inclusion of ucb letterhead.


% Modify the spacing at the bottom, too, to get better spacing.

\def\@textbottom{\ifnum\[email protected]=1\vskip\[email protected] plus 216\[email protected] minus 24\[email protected]
  \else \vfil \fi}


\newif\[email protected]

    \[email protected] \ifodd\[email protected]
                \else\thispagestyle{empty} \hbox{}\newpage\fi
    \[email protected]\@ne
    \@lettertrue\skip\letterheadins72\[email protected] plus 144\[email protected] minus 54\[email protected]
    \interlinepenalty=200 % smaller than the TeXbook value
    \@processto{\leavevmode\ignorespaces #1}}
    \[email protected]
        \let\protect\@[email protected]

%    ****************************************
%    *         THE UCB MEMO FORMAT          *
%    ****************************************


% hack for gobbling spaces (some ideas from latex.ltx)
\def\@flti{\ifx\next\@sptoken\let\[email protected]\@fltii\else\let\[email protected]\@flt\fi\[email protected]}
\def\?{\@fltii}  \expandafter\def\? {\futurelet\next\@flti}% defines \@fltii

    \[email protected]\@ne
    \skip\letterheadins72\[email protected]
    \interlinepenalty=200 % smaller than the TeXbook value
    \@futureletnext\@memo} % skips spaces, too

    \ifx\next\re \let\@tempa\@re \else \let\@tempa\@memotop \fi

        \ignorespaces \sbjbody\strut}\par
      \ifx\@empty\fromsig \fromname \else \fromsig \fi\strut}\par
        \ignorespaces \sbjbody\strut}\par


\def\subject#1{\@latexerr{\string\subject\space or \string\re\space macro must
  IMMEDIATELY follow the \string\begin\space macro}{See LATEX local guide.}}

% Memo page style.

\def\[email protected]{\let\@oddhead\@empty\def\@oddfoot{\@tempdima\paperwidth
    \advance\@tempdima-2in\relax  \advance\@tempdima-\textwidth
    \advance\@tempdima-2\@themargin  \hskip\@tempdima \hss
    \six UNIVERSITY OF CALIFORNIA---(Letterhead for Interdepartmental Use)\hss}%

%    ****************************************
%    *          MORE DECLARATIVES           *
%    ****************************************



\def\upperaddress#1{\def\[email protected]{#1}}
\let\[email protected]\@empty

\let\@emailcol 0
\def\emailatleft{\let\@emailcol l}
\def\emailatright{\let\@emailcol r}
\let\loginatleft\emailatleft    % temporary compatibility fix

% The following allows use of `@' in the \email string, even with the amstex
% package.
\def\email#1{\def\emailaddr{{\[email protected]{\char64\relax}#1}}}
\let\login\email           % temporary compatibility fix
\let\emailaddress\email    % temporary compatibility fix

\newif\[email protected]  %\[email protected] (TeX default)
\let\closingatright\[email protected]
\let\closingatleft\[email protected]

% Opening and closing macros.

  \[email protected]
    \ifx\@empty\fromaddress\@letterhead \else \@noletterhead \fi
    {\@dotfix\raggedright \ifx\@empty\toname\else\toname \\\fi
  \else  % if memo

  \ifx\@signed 1%
    \ifnum\[email protected]=1%
      \@tempdima\pagegoal\advance\@tempdima18\[email protected]\pagegoal\@tempdima
    \[email protected] \hspace*{\longindentation}\fi
    \parbox{\[email protected]\indentedwidth\else\textwidth\fi}{\@dotfix
         \ignorespaces #1\\[\sigspace]%
         \else \fromsig \fi\strut}%

% Fix the spacing in the cc and encl commands.

    \@hangfrom{\normalfont\ccname: }%
    \ignorespaces #1\strut}\par}

    \@hangfrom{\normalfont\enclname: }%
    \ignorespaces #1\strut}\par}

% Redefine \stopletter to get better spacing.

\def\stopletter{\vskip\[email protected] plus 3in}
% Installation dependent options.