%%
%%    File : csmemo.cls    (LaTeX2e class file)
%%  Author : Martin Reddy (mxr@dcs.ed.ac.uk) 
%% Version : 1.1
%% Updates : 1.0 [16/1/97] - initial release.
%%           1.1 [15/4/97] - added \AddressTitle and \AddressAltTitle
%%
%% This file contains a class definition, csmemo, for the LaTeX2e
%% system which defines the layout of an internal memorandum style
%% used by the Dept of Computer Science at the University of Edinburgh.
%%
%% For information on this package, please refer to "texdoc csmemo"
%%
%% To Do List:
%%    . font problems with cm option. option currently not documented
%%

\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesClass{csmemo}[1997/01/16 v1.1 Computer Science memo - MXR]

%%
%%  --- Options ---
%%

\DeclareOption{times}{\def\memo@fontfamily{ptm}} %% font family used for 
\DeclareOption{cm}{\def\memo@fontfamily{cmr}}    %% titles
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ExecuteOptions{times}
\ProcessOptions

\LoadClass[a4paper,12pt]{article}

%%
%% --- Package Loading ---
%%

\RequirePackage{ifthen}
\RequirePackage{graphics}
\RequirePackage{array}

%%
%% --- Main Code ---
%%

%%
%% Set up the memo page margins
%%

\addtolength{\voffset}{-2.5cm}
\addtolength{\textheight}{5cm}

\addtolength{\hoffset}{-2cm}
\addtolength{\textwidth}{3.5cm}

%% 
%% Set up the fonts (so that the text doesn't change if the
%% document itself is 10pt, 11pt or 12pt).
%%

\def\memo@perpetuafontfamily{mpp}

\DeclareFixedFont{\memo@AddressFont}%
  {\encodingdefault}{\memo@perpetuafontfamily}{m}{n}{12pt}

\DeclareFixedFont{\memo@AddressSmallFont}%
  {\encodingdefault}{\memo@perpetuafontfamily}{m}{n}{10pt}

\DeclareFixedFont{\memo@AddressItalicFont}%
  {\encodingdefault}{\memo@perpetuafontfamily}{m}{it}{12pt}

\DeclareFixedFont{\memo@MainTextFont}%
  {\encodingdefault}{\memo@fontfamily}{m}{n}{12pt}

\DeclareFixedFont{\memo@MainItalicsFont}%
  {\encodingdefault}{\memo@fontfamily}{m}{it}{12pt}

\DeclareFixedFont{\memo@MainBoldFont}%
  {\encodingdefault}{\memo@fontfamily}{b}{n}{12pt}

\DeclareFixedFont{\memo@DescFont}%
  {\encodingdefault}{\memo@fontfamily}{m}{it}{12pt}

\DeclareFixedFont{\memo@TitleFont}%
  {\encodingdefault}{\memo@fontfamily}{b}{n}{16pt}

\DeclareFixedFont{\memo@SectionFont}%
  {\encodingdefault}{\memo@fontfamily}{b}{n}{12pt}

%%
%% Now do the reading in of information
%%

\newcommand{\@memoto}{}
\newcommand{\@memofrom}{}
\newcommand{\@memocc}{}
\newcommand{\@memosubject}{}
\newcommand{\@memodate}{\@date}
\newcommand{\@memospecial@header}{}
\newcommand{\@memospecial@text}{}
\newcommand{\@addressname}{}
\newcommand{\@addresstitle}{}
\newcommand{\@addressalttitle}{}
\newcommand{\@addressemail}{}
\newcommand{\@addressext}{}

\newcommand{\MemoTo}[1]{\renewcommand{\@memoto}{#1}}
\newcommand{\MemoFrom}[1]{\renewcommand{\@memofrom}{#1}}
\newcommand{\MemoCC}[1]{\renewcommand{\@memocc}{#1}}
\newcommand{\MemoSubject}[1]{\renewcommand{\@memosubject}{#1}}
\newcommand{\MemoDate}[1]{\renewcommand{\@memodate}{#1}}
\newcommand{\MemoSpecial}[2]{\renewcommand{\@memospecial@header}{#1}%
                             \renewcommand{\@memospecial@text}{#2}}
\newcommand{\AddressName}[1]{\renewcommand{\@addressname}{#1}}
\newcommand{\AddressTitle}[1]{\renewcommand{\@addresstitle}{#1}}
\newcommand{\AddressAltTitle}[1]{\renewcommand{\@addressalttitle}{#1}}
\newcommand{\AddressEmail}[1]{\renewcommand{\@addressemail}{#1}}
\newcommand{\AddressExt}[1]{\renewcommand{\@addressext}{#1}}

%%
%% Sundry lengths and commands used by the \makefax command
%%

\newlength{\memo@infolen}
\setlength{\memo@infolen}{\textwidth}
\addtolength{\memo@infolen}{-1.1in}

\newcommand{\memo@ob}{\raisebox{1pt}{(}}
\newcommand{\memo@cb}{\raisebox{1pt}{)}}
\newcommand{\memo@plus}{\raisebox{0pt}{+}}
\newcommand{\memo@code}{\memo@ob\memo@plus44\memo@cb\ \memo@ob0\memo@cb131\ }

%%
%% The bit which inserts a University crest - ripped from euletr.cls
%%

\def\@dvips{dvips.def}
\def\@oztex{oztex.def}
\ifx\Gin@driver\@dvips
        %%% Do the PS image stuff for the DVIPS driver
        \newcommand{\@eushield}{%
          \scalebox{0.2332}{\includegraphics{eushield.ps}}
        }%
\else
\ifx\Gin@driver\@oztex
        %%% Do the PS image stuff for OzTeX
        \newcommand{\@eushield}{%
           \includegraphics[30mm,30mm]{eushield.ps}
        }%
\fi
\fi

%%
%% Now draw the actual memo cover page using the information we have
%%

\renewcommand{\maketitle}{%
  {\parindent=0pt\parskip=0pt\newpage\thispagestyle{empty}%
    \hfill \vbox to 0mm {\vss \hbox to 0pt {\hss \@eushield \hss} \vss}
    \vspace*{1.5cm}
    \begin{flushright}\memo@AddressFont
      DEPARTMENT {\memo@AddressItalicFont of} COMPUTER SCIENCE\vspace*{2ex}\\%
      \ifthenelse{\equal{\@addressname}{}}{}{\@addressname \\}%
      \ifthenelse{\equal{\@addresstitle}{}}{}{\@addresstitle \\}%
      \ifthenelse{\equal{\@addressalttitle}{}}{}{\@addressalttitle \\}%
%      The University of Edinburgh \\
      James Clerk Maxwell Building \\
      The King's Buildings \\
      Mayfield Road \\
      Edinburgh\ \ EH9 3JZ\vspace*{1ex} \\
      \memo@AddressSmallFont
      Tel No: \memo@code 650
      \ifthenelse{\equal{\@addressext}{}}{5129}{\@addressext} \\
      Fax No: \memo@code 667 7209
      \ifthenelse{\equal{\@addressemail}{}}{}%
         {\\ \vskip 1ex Email: {\tt\@addressemail}}%
    \end{flushright}%
    
    \vspace{2ex}\begin{flushleft}
    {\memo@TitleFont MEMORANDUM}
    \end{flushleft}\vspace*{-3ex}\rule{\textwidth}{1mm}\par
  
    \vskip 12pt
    \begin{tabular}{lp{\memo@infolen}}
    \bfseries To:      & \@memoto \\
    \bfseries From:    & \@memofrom \\%
    \ifthenelse{\equal{\@memocc}{}}{}{\bfseries CC: & \@memocc \\}%
    \ifthenelse{\equal{\@memospecial@header}{}}{}%
       {\bfseries \@memospecial@header & \@memospecial@text \\}%
    \bfseries Date:    & \@memodate \\
    \bfseries Subject: & \@memosubject
    \end{tabular}
    \par\vskip 10pt\noindent\hrulefill\vskip 12pt
  }
  \parindent=0pt
  \parskip=10pt
}

%%
%% EOF: csmemo.cls
%%
