% Letter2 document style
%    Richard Hughey, July 1992, add \re
%    Richard Hughey, Ocy 1991, modified to UCSC 
%      Header etc based on Kevin Karplus' ucscletter.sty, modified for
%      more correct spacing of scool names etc. to match printed
%      letterhead. 
%     Richard Hughey, Jan 1991, add commands for letterhead tray.
%                     titles, brown CS address, and \letterbreak.
%         With much help from Rob Ravenscroft
%     Keiji Kanazawa, March 1989, use updated letter.sty.
%     Keiji Kanazawa, May 88, modified from
%     Jean-Francois Lamy, Feb 86
%     revised July 86
%
% LETTER is an extension to the basic "letter" style documented in the
% LaTeX user's guide and reference manual (book form).
%
% The "letter" environment is redefined to provide options. It is now
% possible to emulate letterheadand to choose the margins and the
% presentation of the letter.  In addition, envelopes or mailing labels
% can be produced automatically.
%
% 
% INVOKING LETTER
%
% To use the facilities described below you must use
%   \documentstyle{letter}
%
% A document may contain many letters, each of the form
%   \begin{letter}[optional-list-of-keywords]
%     ...
%   \end{letter}
%
% \begin{letter} is equivalent to \begin{letter}[long,Letterhead,block]
%
%
% OPTIONS
%
% Stationery style can be selected using the following keywords
%  
%   Letterhead  First page of letter will be adjusted to fit CS
%               department letterhead.  Suitable for use with the real
%               watermarked paper.  Default.
%
%   PlainPaper  
%
%
% Margins: short letters look better with wider margins. The following
% keywords alter the margins.
%
%   short       selects wide margins.
%   
%   long        gives margins similar to those in the other "ut"
%               formats, and is the default
%
%
% Letter styles:
%
%   block       Will yield a letter in block format,
%               i.e. in which return address and signature are 
%               indented by the same amount
%
%   full        Full-block format: everything is lined up with the
%               left margin
%
%   pushfrom    The return address is pushed against the right margin
%
% COMMANDS FOR THE PEAMBLE
%%    The default commands are for my own address -- please change
%%    them in your document (not in this file).  They are:
%%
%%    \board{Computer Engineering Board of Studies}
%%    \email{rph@ce.ucsc.edu}
%%    \telephone{(408) 459-2939
%%    \fax{FAX (408) 459-4829}
%%    \underletterhead{\boardname\sep Santa Cruz, California 95064
%%    \sep\emailaddress\sep\telephonenum\sep\faxnum}
%%    \signature{}
%%
%%    You can include any of these in your letter as commands to set
%%    the above parameters.  The \sep directive is a vertically
%%    centered dot with fill space on both sides.  The \board command
%%    above, for example, defines \boardname for use in the
%%    \underletterhead command.  As with ucscletter.sty, document
%%    styles are available for other campuses as well, which place,
%%    for example, University of California Riverside on the top left,
%%    and UCR on the top right.
%%
%%   \makelabels:  Letter2 will create labels from the \address
%%   commands in your letters.  If you have multiple letters, all the
%%   addresses appear on the final page (or pages), after all the
%%   letters, to save paper.  They can then be cut up with scissors
%%   and taped to the envelopes.  The labels do not include return
%%   addresses as the default LaTeX labels do. 
%%
%% After a \begin{letter}, you may wish to place a
%%    \re{Re: Important Matter} before the \opening{Dear Important
%%    Person:} command.  As with the standard letter style, use
%%    \address{} for the person you are sending this to.  You can also
%%    use the \cc and \encl commands documented in the LaTeX manual
%%    for cc: and encl:.  Note that unlike the \re command, these
%%    include the characteristic letters.  It was felt that this would
%%    not provide enough control over the re: line to be include in
%%    the \re command.
%%
%
% GETTING THE LAST WORD IN A FIGHT WITH "LETTER"
%
% By default, the addresses on the envelope are identical to those in the 
% letter, which is not always ideal.
%
% If you define \toname, \toaddress, \fromname or \fromaddress after the
% \opening and before the end of the letter, then these values will be used on
% the envelope. This makes it easy to leave out your postal address in the
% letter but to have it on the envelope, or to use a shorter address for the
% correspondant in the opening while having the P.O.box, postal code, country
% and planet on the envelope.
%
% If you want to change the way the return address looks, you can redefine
% \returnaddress.  You can still use \fromname and \fromaddress in the 
% redefinition. To omit the return address altogether, use
%     \renewcommand{\returnaddress}{} .

% include original letter style here

% letter.sty 20-Sep-88

%\typeout{Document Style `letter' <20 Sep 88>.} modified kgk
%\typeout{Document Style `letter' <15 Apr 89>.} modified rph
\typeout{Document Style `Letter2' <8 Oct 91>.}
\def\fromcity{}\def\campusname{}\def\campusabbrev{}
\@namedef{ds@ucb}{
    \def\fromcity{Berkeley, CA\ \ 94720 USA}
    \def\campusname{, BERKELEY}
    \def\campusabbrev{UCB}
    }
\@namedef{ds@ucd}{
    \def\fromcity{Davis, CA\ \ 95616 USA}
    \def\campusname{, DAVIS}
    \def\campusabbrev{UCD}
    }
\@namedef{ds@uci}{
    \def\fromcity{Irvine, CA\ \ 92717 USA}
    \def\campusname{, IRVINE}
    \def\campusabbrev{UCI}
    }
\@namedef{ds@ucla}{
    \def\fromcity{Los Angeles, CA\ \ 90024 USA}
    \def\campusname{, LOS ANGELES}
    \def\campusabbrev{UCLA}
    }
\@namedef{ds@ucr}{
    \def\fromcity{Riverside, CA\ \ 92521 USA}
    \def\campusname{, RIVERSIDE}
    \def\campusabbrev{UCR}
    }
\@namedef{ds@ucsd}{
    \def\fromcity{La Jolla, CA\ \ 92093 USA}
    \def\campusname{, SAN DIEGO}
    \def\campusabbrev{UCSD}
    }
\@namedef{ds@ucsf}{
    \def\fromcity{San Francisco, CA\ \ 94142 USA}
    \def\campusname{, SAN FRANCISCO}
    \def\campusabbrev{UCSF}
    }
\@namedef{ds@ucsb}{
    \def\fromcity{Santa Barbara, CA\ \ 93106 USA}
    \def\campusname{, SANTA BARBARA}
    \def\campusabbrev{UCSB}
    }
\@namedef{ds@ucsc}{
    \def\fromcity{Santa Cruz, CA\ \ 95064 USA}
    \def\campusname{, SANTA CRUZ}
    \def\campusabbrev{UCSC}
    }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% newout.sty:  a redefinition of the output routine for
% sane treatment of the footer, from rob ravenscroft.
%Date: Tue, 8 Oct 91 12:03:34 -0400
%From: Robert Ravenscroft <raravens@daisy.waterloo.edu>
%
%It was in the \@outputpage routine. To build the output,
%they set all line spacing to 0, The page body is already in a box
%of the correct height. They build a header box of the correct height,
%add the \headsep glue and then the box with the page body.
%To get the \footerskip glue, they set \baselineskip=\footerskip (OUCH)!
%I put it back to 0 and added a \vskip\footerskip (HOORAY)!
%Also, they did not usse a \cbox for the footer. Thus footerheight
%was never checked. Well, I added that too so it is checked.
%You'll want to set it to an appropriate value to get rid of the
%underfull \vbox warning (ditto for the header).
%Here's the correct code, and as usual, create a.sty file for this puppy.
%
\def\@outputpage{\begingroup\catcode`\ =10
     \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii
    \if@specialpage
     \global\@specialpagefalse\@nameuse{ps@\@specialstyle}\fi
     \if@twoside
       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
            \let\@themargin\oddsidemargin
          \else \let\@thehead\@evenhead
                \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
     \fi\fi
     \shipout
     \vbox{\normalsize \baselineskip\z@ \lineskip\z@
           \let\par\@@par %% 15 Sep 87
           \vskip \topmargin \moveright\@themargin
           \vbox{\setbox\@tempboxa
                   \vbox to\headheight{\vfil \hbox to\textwidth
                                       {\let\label\@gobble \let\index\@gobble
                                         \@thehead}} %% 22 Feb 87
                 \dp\@tempboxa\z@
                 \box\@tempboxa
                 \vskip \headsep
                 \box\@outputbox
                  \vskip\footskip   % added so \baselineskip is 0 in footer
%                 \baselineskip\footskip
              \vbox to\footheight{       % added for consistancy
                 \hbox to\textwidth{\let\label\@gobble
                           \let\index\@gobble  %% 22 Feb 87
                           \@thefoot}\vfil}}} % added \vfil and } for \vbox
\global\@colht\textheight
           \endgroup\stepcounter{page}\let\firstmark\botmark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@ptsize{0} \@namedef{ds@11pt}{\def\@ptsize{1}}
\@namedef{ds@12pt}{\def\@ptsize{2}} 
\@twosidefalse
\def\ds@draft{\overfullrule 5pt} 
\@options
\lineskip 1pt \normallineskip 1pt
\def\baselinestretch{1}

\ifcase \@ptsize\relax 
\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt 
\abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt
minus3pt\let\@listi\@listI} 
\def\small{\@setsize\small{11pt}\ixpt\@ixpt
\abovedisplayskip 8.5pt plus 3pt minus 4pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2pt\belowdisplayshortskip 4pt plus2pt minus
2pt\def\@listi{\leftmargin\leftmargini \topsep 4pt plus 2pt minus 2pt\parsep
2pt plus 1pt minus 1pt
\itemsep \parsep}}
\def\footnotesize{\@setsize\footnotesize{9.5pt}\viiipt\@viiipt
\abovedisplayskip 6pt plus 2pt minus 4pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus 1pt\belowdisplayshortskip 3pt plus 1pt minus
2pt\def\@listi{\leftmargin\leftmargini \topsep 3pt plus 1pt minus 1pt\parsep
2pt plus 1pt minus 1pt
\itemsep \parsep}}
\def\scriptsize{\@setsize\scriptsize{8pt}\viipt\@viipt}
\def\tiny{\@setsize\tiny{6pt}\vpt\@vpt}
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}
\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt}
\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt}
\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt}
\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt}
\or 
\def\@normalsize{\@setsize\normalsize{13.6pt}\xipt\@xipt
\abovedisplayskip 11pt plus3pt minus6pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6.5pt plus3.5pt
minus3pt\let\@listi\@listI} 
\def\small{\@setsize\small{12pt}\xpt\@xpt
\abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt
minus3pt\def\@listi{\leftmargin\leftmargini \topsep 6pt plus 2pt minus
2pt\parsep 3pt plus 2pt minus 1pt
\itemsep \parsep}}
\def\footnotesize{\@setsize\footnotesize{11pt}\ixpt\@ixpt
\abovedisplayskip 8pt plus 2pt minus 4pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus 1pt\belowdisplayshortskip 4pt plus 2pt minus
2pt\def\@listi{\leftmargin\leftmargini \topsep 4pt plus 2pt minus 2pt\parsep
2pt plus 1pt minus 1pt
\itemsep \parsep}}
\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt}
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}
\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt}
\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt}
\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt}
\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt}
\or 
\def\@normalsize{\@setsize\normalsize{15pt}\xiipt\@xiipt
\abovedisplayskip 12pt plus3pt minus7pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6.5pt plus3.5pt
minus3pt\let\@listi\@listI} 
\def\small{\@setsize\small{13.6pt}\xipt\@xipt
\abovedisplayskip 11pt plus3pt minus6pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6.5pt plus3.5pt
minus3pt\def\@listi{\leftmargin\leftmargini \parsep 4.5pt plus 2pt minus 1pt
 \itemsep \parsep
 \topsep 9pt plus 3pt minus 5pt}}
\def\footnotesize{\@setsize\footnotesize{12pt}\xpt\@xpt
\abovedisplayskip 10pt plus2pt minus5pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt
minus3pt\def\@listi{\leftmargin\leftmargini \topsep 6pt plus 2pt minus
2pt\parsep 3pt plus 2pt minus 1pt
\itemsep \parsep}}
\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt}
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
\def\large{\@setsize\large{18pt}\xivpt\@xivpt}
\def\Large{\@setsize\Large{22pt}\xviipt\@xviipt}
\def\LARGE{\@setsize\LARGE{25pt}\xxpt\@xxpt}
\def\huge{\@setsize\huge{30pt}\xxvpt\@xxvpt}
\let\Huge=\huge
\fi
\normalsize 

\oddsidemargin 53pt \evensidemargin 53pt \marginparwidth 90pt \marginparsep
11pt \marginparpush 5pt 
 \topmargin 27pt \headheight 12pt \headsep 45pt \footheight 12pt \footskip
25pt 
\textheight 505pt \textwidth 365pt \columnsep 10pt \columnseprule 0pt 
\raggedbottom 
\footnotesep 12pt \skip\footins 10pt plus 2pt minus 4pt 
\floatsep 12pt plus 2pt minus 2pt
\textfloatsep 20pt plus 2pt minus 4pt
\intextsep 12pt plus 2pt minus 2pt
\dblfloatsep 12pt plus 2pt minus 2pt
\dbltextfloatsep 20pt plus 2pt minus 4pt
\@maxsep 20pt
\@dblmaxsep 20pt
\@fptop 0pt plus 1fil
\@fpsep 8pt plus 2fil
\@fpbot 0pt plus 1fil
\@dblfptop 0pt plus 1fil
\@dblfpsep 8pt plus 2fil
\@dblfpbot 0pt plus 1fil



\newdimen\longindentation
\longindentation=.5\textwidth
\newdimen\indentedwidth
\indentedwidth=\textwidth
\advance\indentedwidth -\longindentation

\def\ps{\par\startbreaks}
\def\re#1{\def\renote{#1}}
\def\renote{}
\def\cc#1{\par\noindent
\parbox[t]{\textwidth}{\@hangfrom{\rm cc: }\ignorespaces #1\strut}\par}
\def\encl#1{\par\noindent
\parbox[t]{\textwidth}{\@hangfrom{\rm encl: }\ignorespaces #1\strut}\par}
\def\stopletter{}

\def\returnaddress{}
\newcount\labelcount

\def\startlabels{\labelcount=0 \baselineskip=0pt \lineskip=0pt
\pagestyle{empty}
\let\@texttop=\relax
\topmargin -50pt
\headsep 0pt
\oddsidemargin -35pt
\evensidemargin -35pt
\textheight 550pt
\@colht\textheight \@colroom\textheight \vsize\textheight
\textwidth 550pt
\columnsep 25pt
\xpt
\baselineskip=0pt
\lineskip=0pt
\boxmaxdepth=0pt
\parindent=0pt \twocolumn\relax}
\def\mlabel#1#2{\setbox0\vbox{\parbox[b]{4.5in}{\strut\ignorespaces #2}}
 \vbox to 2in{\vss \box0 \vss}}



\long\def\letter#1{%\newpage
 \c@page\@ne
 \interlinepenalty=200 \@processto{#1}\re{}}  % clear any \re definition.
\def\endletter{\stopletter\@@par\pagebreak\@@par
 \if@filesw 
 \begingroup 
 \def\protect{\string}
 \let\\=\relax
 \def\protect##1{\string##1\space}
 \immediate\write\@auxout{\string\mlabel{\returnaddress}{\toname
 \\\toaddress}}
 \endgroup 
 \fi}
\long\def\@processto#1{\@xproc #1\\@@@\ifx\toaddress\@empty 
 \else \@yproc #1@@@\fi}
\long\def\@xproc #1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
\long\def\@yproc #1\\#2@@@{\def\toaddress{#2}}
\def\stopbreaks{\interlinepenalty \@M
 \def\par{\@@par\nobreak}\let\\=\@nobreakcr
 \let\vspace\@nobreakvspace}
\def\@nobreakvspace{\@ifstar{\@nobreakvspacex}{\@nobreakvspacex}}
\def\@nobreakvspacex#1{\ifvmode\nobreak\vskip #1\relax\else
 \@bsphack\vadjust{\nobreak\vskip #1}\@esphack\fi}
\def\@nobreakcr{\vadjust{\penalty\@M}\@ifstar{\@xnewline}{\@xnewline}}
\def\startbreaks{\let\\=\@normalcr
 \interlinepenalty 200\def\par{\@@par\penalty 200\relax}}
\def\name#1{\def\fromname{#1}}
\def\fromname{}
\def\signature#1{\def\fromsig{#1}}
\def\fromsig{}
\long\def\address#1{\def\fromaddress{#1}}
\def\fromaddress{}
\def\location#1{\def\fromlocation{#1}}
\def\fromlocation{}
\def\telephone#1{\def\telephonenum{#1}}
\def\telephonenum{}
\def\email#1{\def\emailaddress{#1}}
\email{}
\def\fax#1{\def\faxnum{#1}}
\def\faxnum{}
\def\document{\endgroup
 \@colht\textheight \@colroom\textheight \vsize\textheight
 \columnwidth\textwidth \@clubpenalty\clubpenalty
 \if@twocolumn \advance\columnwidth -\columnsep 
 \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue 
 \fi
 \hsize\columnwidth \linewidth\hsize
 \begingroup\@floatplacement\@dblfloatplacement\endgroup
 \if@filesw \immediate\openout\@mainaux=\jobname.aux
 \immediate\write\@mainaux{\string\startlabels\string\@startlabels}\fi
 \def\do##1{\let ##1\@notprerr}
 \@preamblecmds
 \let\do\noexpand 
 \@normalsize\everypar{}}
\def\enddocument{\@checkend{document}\newpage\begingroup 
\if@filesw \immediate\closeout\@mainaux 
\makeatletter\input \jobname.aux\clearpage
\fi\endgroup\deadcycles\z@\@@end}

\def\makelabels{\@fileswtrue}
\def\@startlabels{}



\def\@texttop{\ifnum\c@page=1\vskip 0pt \relax\fi}
\def\ps@headings{\def\@oddhead{\sl To \ignorespaces\toname \hfil \@date
\hfil Page \thepage}\def\@oddfoot{}}
\def\ps@empty{\def\@oddhead{}\def\@oddfoot{}\def\@evenhead{}\def\@evenfoot{}}

\def\ps@firstpage{\def\@oddhead{}\def\@oddfoot{\raisebox
 {-45pt}[0pt]{\hbox to \textwidth
 {\hspace*{100pt}\xpt\fromlocation \hfill
\telephonenum}}\hss}\def\@evenhead{}\def\@evenfoot{}}
%\def\ps@plain{\def\@oddhead{}\def\@oddfoot{\rm\hfil\thepage
% \hfil}\def\@evenhead{}\let\@evenfoot\@oddfoot}

\parskip .7em \parindent 0pt \topsep .4em \partopsep 0pt \itemsep .4em 
\@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 
\@beginparpenalty -\@lowpenalty \@endparpenalty -\@lowpenalty \@itempenalty
-\@lowpenalty 



\leftmargini 2.5em
\leftmarginii 2.2em \leftmarginiii 1.87em \leftmarginiv 1.7em \leftmarginv 1em
\leftmarginvi 1em
\leftmargin\leftmargini
\labelwidth\leftmargini\advance\labelwidth-\labelsep
\labelsep 5pt
\parsep 0pt
\let\@listi\relax
\def\@listii{\leftmargin\leftmarginii
 \labelwidth\leftmarginii\advance\labelwidth-\labelsep}
\def\@listiii{\leftmargin\leftmarginiii
 \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
 \topsep .2em 
 \itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
 \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
 \labelwidth\leftmarginv\advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
 \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}

\def\labelenumi{\arabic{enumi}.} 
\def\theenumi{\arabic{enumi}} 
\def\labelenumii{(\alph{enumii})}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}
\def\labelenumiii{\roman{enumiii}.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}
\def\labelenumiv{\Alph{enumiv}.}
\def\theenumiv{\Alph{enumiv}} 
\def\p@enumiv{\p@enumiii\theenumiii}

\def\labelitemi{$\bullet$}
\def\labelitemii{\bf --}
\def\labelitemiii{$\ast$}
\def\labelitemiv{$\cdot$}
\def\verse{\let\\=\@centercr 
 \list{}{\itemsep\z@ \itemindent -15pt\listparindent \itemindent 
 \rightmargin\leftmargin\advance\leftmargin 15pt}\item[]}
\let\endverse\endlist
\def\quotation{\list{}{\listparindent 1.5em
 \itemindent\listparindent
 \rightmargin\leftmargin}\item[]}
\let\endquotation=\endlist
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

\def\descriptionlabel#1{\hspace\labelsep \bf #1}
\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin
 \let\makelabel\descriptionlabel}}
\let\enddescription\endlist



\def\theequation{\arabic{equation}}

\arraycolsep 5pt \tabcolsep 6pt \arrayrulewidth .4pt \doublerulesep 2pt 
\tabbingsep \labelsep 
\skip\@mpfootins = \skip\footins
\fboxsep = 3pt \fboxrule = .4pt 

\def\footnoterule{\kern-1\p@ 
 \hrule width .4\columnwidth 
 \kern .6\p@} 

\long\def\@makefntext#1{\noindent \hangindent 5pt\hbox 
 to 5pt{\hss $^{\@thefnmark}$}#1}


\c@topnumber=2
\def\topfraction{.7}
\c@bottomnumber=1
\def\bottomfraction{.3}
\c@totalnumber=3
\def\textfraction{.2}
\def\floatpagefraction{.5}
\c@dbltopnumber= 2
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

\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}


\smallskipamount=.5\parskip \medskipamount=\parskip
\bigskipamount=2\parskip
\ps@plain \pagenumbering{arabic} \onecolumn \@fileswfalse 

%  original letter style ends here.

%  Custom letter style starts here.

% option handling

\def\letter{\@ifnextchar[{\@iletter}{\@iletter[DontComplain]}}

\long\def\@iletter[#1]#2{
  \ls@Letterhead\ls@block\ls@long
  \def\ls@optionlist{#1}
  \ls@options
  \onecolumn  \@colht\textheight  \@colroom\textheight \vsize\textheight
  \c@page\@ne
% \interlinepenalty=200 % smaller than the TeXbook value
  \@processto{#2}
  }

\def\ls@options{\let\@elt\relax
    \@for\@tempa:=\ls@optionlist\do
        {\@ifundefined{ls@\@tempa}
           {\@latexerr{undefined letter option: \@tempa}\@ehc}
           {\csname ls@\@tempa\endcsname}}
    \@indent % indentation depends on the margins selected
    }
\def\ls@DontComplain{}


%
% PAGE LAYOUT
%
% Specifying "short" gives wider margins, which make shorter letters look
% better.  "long" is the default (i.e. \begin{letter} is the same as
% \begin{letter}[long]).

\def\ls@long{
   \oddsidemargin 0.25 true in
   \evensidemargin 0.25 true in
   \marginparwidth 0.75 true in
   \marginparsep 11pt
   \topmargin 0 true in     %    Nominal distance from top of page to top of
			    %    box containing running head.
   \headheight 12pt         %    Height of box containing running head.
   \headsep 25pt            %    Space between running head and text.
   % \topskip = 10pt        %    '\baselineskip' for first line of page.
			    % Bottom of page:
   \footheight 12pt         %    Height of box containing running foot.
   \footskip 50pt           %    Distance from baseline of box containing foot 
			    %    to baseline of last line of text.
   \textheight 8 true in    % Height of text (including footnotes and figures, 
			    % excluding running head and foot).
   \textwidth 5.875 true in % Width of text line.
   \footnotesep 12pt    % Height of strut placed at the beginning of every
			% footnote.
   \skip\footins 6pt plus 2pt minus 2pt  % Space between last line of text and 
                                      % top of first footno
   \vskip 0in plus 0.10fil
   \def\longletterskip{\vspace*{2\parskip}}	   
}

\def\ls@wide{
   \oddsidemargin 0.0 true in
   \evensidemargin 0.0 true in
   \marginparwidth 0.75 true in
   \marginparsep 11pt
   \topmargin 0 true in     %    Nominal distance from top of page to top of
			    %    box containing running head.
   \headheight 12pt         %    Height of box containing running head.
   \headsep 25pt            %    Space between running head and text.
   % \topskip = 10pt        %    '\baselineskip' for first line of page.
			    % Bottom of page:
   \footheight 12pt         %    Height of box containing running foot.
   \footskip 50pt           %    Distance from baseline of box containing foot 
			    %    to baseline of last line of text.
   \textheight 8 true in    % Height of text (including footnotes and figures, 
			    % excluding running head and foot).
   \textwidth 6.0 true in % Width of text line.
   \footnotesep 12pt    % Height of strut placed at the beginning of every
			% footnote.
   \skip\footins 6pt plus 2pt minus 2pt  % Space between last line of text and 
                                      % top of first footno
   \vskip 0in plus 0.10fil
   \def\longletterskip{\vspace*{1.5\parskip}}	   
}



\def\ls@short{
   \oddsidemargin 53 pt
   \evensidemargin 53pt
   \marginparwidth 90pt
   \marginparsep 11pt
   \marginparpush 5pt
   \topmargin 0 true in
   \headheight 12pt
   \headsep 45pt
   % \topskip = 10pt
   \footheight 12pt
   \footskip 50pt
   \textheight 8 true in
   \textwidth 365pt
   \footnotesep 12pt
   \skip\footins 6pt plus 2pt minus 2pt
           \vskip 0in plus 0.10fil
   \def\longletterskip{\vspace*{2\parskip}}	   
}

%
% LETTER PRESENTATION
%
% By default the opening is pushed against the right margin and the signature
% is indented (as in the LaTeX book)
% The following optional parameters to the "letter" environment can also
% be used (they are mutually exclusive)
%
% -- default changed to block
%
% block  - lines up opening and signature, which are indented
% full   - full-block style - puts everything at the left margin.	
%
% Since the margins influence the indentation of the opening, the actual
% definition of the indentation must wait after all the options have been
% processed, hence the need for @indent (see ls@options)

\def\ls@full{
     % everything flush left
     \gdef\@indent{\global\longindentation=0pt}
     \gdef\@rightglue{\hfill} \gdef\@leftglue{}}

\def\ls@block{
     % line up signature and return address
     \gdef\@indent{\global\longindentation=.55\textwidth}
     \gdef\@rightglue{\hfill} \gdef\@leftglue{}}

\def\ls@pushfrom{
     % same as in the "letter" style
     % default - push return address as far left as possible
     \gdef\@indent{\global\longindentation=.5\textwidth}
     \gdef\@rightglue{} \gdef\@leftglue{\hfill}}
      	
\def\opening#1{\ifx\@empty\fromaddress
 \thispagestyle{firstpage} 
 {\raggedleft\@date\par}
 \else \thispagestyle{firstpage}%{empty} 
 {\raggedleft\begin{tabular}{l}\ignorespaces\fromaddress \\*[2\parskip]
 \@date \end{tabular}\par}
 \fi
% \vspace{2\parskip}
 \longletterskip
 {\raggedright \toname \\ \toaddress \par}\vspace{\parskip}%
  \ifx\@empty\renote\else{\renote\par\vspace{\parskip}}\fi#1\par\nobreak}

\long\def\closing#1{\par\nobreak\vspace{\parskip} 
 \stopbreaks
 \noindent%
 \hspace*{\longindentation}%
 \parbox{\indentedwidth}{\raggedright
 \ignorespaces#1\\[6\medskipamount]\ifx\@empty\fromsig 
 \fromname
 \else\fromsig\fi\strut}
 \par}
%\long\def\closing#1
%   {\par\nobreak\vspace*{1\parskip plus 0.05fil}
%   \noindent\hspace*{\longindentation}%
%   \parbox{\indentedwidth}{
%        \showthe\parskip
%         \ignorespaces #1
%         \\[6\parskip]
%         \ifx\@empty\fromsig\fromname\else\fromsig\fi
%         \strut}
%   \par}

\def\stopletter{\vskip 0pt plus 1.2fil}


%
% STATIONERY EMULATION
%
\def\fromaddr{}

\def\ls@PlainPaper{
  \def\opening##1{\ifx\@empty\fromaddress
   \thispagestyle{firstpage} 
   {\raggedleft\@date\par}
   \else \thispagestyle{empty} 
   {\raggedleft\begin{tabular}{l}\ignorespaces\fromaddress \\*[2\parskip]
   \@date \end{tabular}\par}
   \fi
  % \vspace{2\parskip}
   \longletterskip
 {\raggedright \toname \\ \toaddress \par}\vspace{\parskip}%
  \ifx\@empty\renote\else{\renote\par\vspace{\parskip}}\fi##1\par\nobreak}
    \def\fromaddr{\fromaddress}
    \def\@texttop{\ifnum\c@page=1\vskip 0in\relax\fi}}

\newlength{\myheadsep}    
\newlength{\myfootskip}
\special{header=ucseal.ps}
\def\mdot{{\setlength{\unitlength}{1ex}%
\begin{picture}(0,0)\put(0,0.72){\circle*{0.4}}\end{picture}}}
\def\sep{\hspace{\fill}\mdot\hspace{\fill}}
\def\twlrm{\rmfamily}
\def\fivrm{\rmfamily\tiny}
\def\ucletterhead{%
\vbox to 12pt
  {\vskip -\topmargin \vskip -27pt
  \hbox
  {\hskip -\oddsidemargin \hskip -28pt
  \vbox 
    {\hbox to \textwidth{\twlrm\hbox to 7.15in
        {UNIVERSITY OF CALIFORNIA\campusname\hfill\campusabbrev}\hss}
    \vskip 7pt%\vskip 9pt
    \hbox to \textwidth{\hbox to 4.65in{\hrulefill}\hskip .8in
                 \hbox to 1.7in{\hrulefill}\hss}
    \vskip 7pt\vskip-0.03in
    \hbox to \textwidth{\hbox to 7.15in{\fivrm
      \hbox to 4.55in{\hskip 0.02in BERKELEY\sep DAVIS\sep%
      IRVINE\sep LOS ANGELES\sep MERCED\sep RIVERSIDE\sep%
      SAN DIEGO\sep SAN FRANCISCO}\hspace{\fill}%
      \hbox to 1.60in{SANTA BARBARA\sep SANTA CRUZ\hskip 0.10in}}\hss}
    \vskip 7pt\vskip-0.03in
    \hbox to \textwidth{\hbox to 4.65in{\hrulefill}\hskip .8in
                 \hbox to 1.7in{\hrulefill}\hss}
    \vskip 7pt\vskip 0.16in
    \vbox to 0pt{\hbox to \textwidth{\hskip4.65in\special{ps: ucseal}\hss}}
    }}% end of inner vbox and enclosing hbox
\vss}% end outer vbox
\hss
}% end of ucletterhead
\def\ucletterfoot{%
  {\fivrm\hbox%
  {\hskip -\oddsidemargin \hskip -28pt%
  \vbox to 12pt
  {\vss\hsize 7.15in{\hbox to 7.15in{\hrulefill}}
  \vskip 7pt\vskip -0.03in%
    {\hbox to 7.15in{\hskip0.02in\underletterheadtext\hskip0.02in}}%
    \vskip 7pt\vskip -0.03in%
    {\hbox to 7.15in{\hrulefill}}}}\hss}}
\def\ls@Letterhead{% push the letter further down than for
   \def\ps@headings{\@noletterhead\def\@oddhead
     {\@noletterhead\sl To \ignorespaces\toname \hfil \@date \hfil
     Page \thepage}\def\@oddfoot{}}
   \def\ps@empty{\def\@oddhead{\@noletterhead}\def\@oddfoot{}
     \def\@evenhead{\@noletterhead}\def\@evenfoot{}}
   \def\ps@firstpage{%
      \def\@oddfoot{\@letterfoot}
      \def\@oddhead{\@letterhead}
      \def\@evenhead{}
      \def\@evenfoot{}}
   \def\ps@plain{\def\@oddhead{\@noletterhead}\def\@oddfoot{\rm\hfil\thepage
      \hfil}\def\@evenhead{\@noletterhead}\let\@evenfoot\@oddfoot}
   \def\fromaddr{}\ps@plain
   \def\@texttop{
     \ifnum\c@page=1
        \vskip 0.4cm plus 0.1 fil
        \relax
     \fi}
    }
\def\@startlabels{\@noletterhead\def\baselinestretch{1.5}\twlrm}
% dvips letterhead commands.
% use in all \ps@ commands.  Only \ps@firstpage uses letterhead.
\def\@letterhead{\ucletterhead}
\def\@letterfoot{\ucletterfoot}
\def\@noletterhead{}
\def\underletterhead#1{\def\underletterheadtext{#1}}

\def\letterbreak{\stopletter\@@par\pagebreak\@@par}
\def\mytitle#1{\def\@lettertitle{#1}}
\def\underletterhead#1{\def\underletterheadtext{#1}}
\def\board#1{\def\boardname{#1}}
\underletterhead{\boardname\sep Baskin School of Engineering\sep
Santa Cruz, California 95064\sep\emailaddress\sep\telephonenum\sep\faxnum}
\telephone{(831) 459-2939}
\fax{FAX (831) 459-4829}
\email{rph@ce.ucsc.edu}
\board{Computer Engineering \sep Biomolecular Engineering}
\mytitle{}
   \def\ps@empty{\def\@oddhead{\@noletterhead}\def\@oddfoot{}
     \def\@evenhead{\@noletterhead}\def\@evenfoot{}}

