%%% mscrep.cls
%%% Style for M.Sc. projects
%%% AJCD 31/8/90
%%% Last updated 9/10/90
%%% JTB 14/12/94 - modified for LaTeX2e
%%% MXR 25/4/96 - updated parskip option for LaTeX2e

% ----------------------------------
%    Identification   
% ----------------------------------

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{mscrep}[1994/12/14 DCS MSc Report class]

% ----------------------------------
%    Initial code   
% ----------------------------------


% ----------------------------------
%    Declaration of options   
% ----------------------------------

\DeclareOption{a5paper}{\OptionNotUsed}
\DeclareOption{b5paper}{\OptionNotUsed}
\DeclareOption{letterpaper}{\OptionNotUsed}
\DeclareOption{legalpaper}{\OptionNotUsed}
\DeclareOption{executivepaper}{\OptionNotUsed}
\DeclareOption{landscape}{\OptionNotUsed}
\DeclareOption{titlepage}{\OptionNotUsed}
\DeclareOption{notitlepage}{\OptionNotUsed}
\DeclareOption{onecolumn}{\OptionNotUsed}
\DeclareOption{twocolumn}{\OptionNotUsed}
\DeclareOption{parskip}{\AtEndOfClass{\input{parskip.clo}}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}

% ----------------------------------
%    Execution of options   
% ----------------------------------

\ProcessOptions

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

\LoadClass[a4paper,10pt]{report}[1994/06/02]
\RequirePackage{a4wide}
\RequirePackage{doublespace}

% ----------------------------------
%    Main code
% ----------------------------------

%%% Table of contents to list down to subsections and no further
\setcounter{tocdepth}{2}

%%% Number down to subsubsections only
\setcounter{secnumdepth}{3}

%%% Hack the titlepage from report.cls to stop it producing an extra
%%% first page in place of the usual abstract page
\renewenvironment{titlepage}
    {%
      \thispagestyle{empty}%
      \if@compatibility
        \setcounter{page}{0}
      \else
        \setcounter{page}{1}%
      \fi}%
    {\setcounter{page}{1}%
    }

%%% Set up some standard variables
\def\project#1{\gdef\@project{#1}}
\newcommand\@project{M.Sc.~Project Report}
\def\deptname#1{\gdef\@deptname{#1}}
\gdef\@deptname{Department of Computer Science}

%%% Get rid of the original abstract environment and replace it with
%%% our version so that we can put it at the end of the titlepage
%%% instead of on the first page by itself
\def\abstract#1{\gdef\@abstract{#1}} 
\let\@abstract\relax
\def\abstractname{Abstract}
\let\frametitle\relax

%%% Purple covers are obsolete?
\def\orangecover{%
  \def\windowtop{85mm}\def\windowleft{51mm}%
  \def\windowheight{68mm}\def\windowwidth{108mm}}

\def\purplecover{%
  \def\windowtop{72mm}\def\windowleft{66mm}%
  \def\windowheight{62mm}\def\windowwidth{88mm}}

\orangecover

%%% Lots of magic to make the titlepage fit into the orange covers and
%%% put the abstract on the titlepage

\def\maketitle{\begin{titlepage}
\let\footnotesize\small \let\footnoterule\relax \setcounter{page}{0}
\null
\vskip -1in % get rid of default driver margin
\vskip -\voffset \vskip -\topmargin \vskip -\headheight  % get rid of
\vskip -\headsep \vskip -\headheight \vskip -\topskip    % TeX margins
\vbox to \windowtop{% window offset from top of page
\Huge \vss\begin{center}
University of Edinburgh\\
\@deptname
\end{center}\vss}%
\hbox{\hskip -1in % get rid of default driver margin
\hskip -\hoffset \hskip -\evensidemargin  % get rid of TeX margins
\hskip \windowleft % window offset from left side of page
\parbox{\windowwidth}{% box of window width
\frametitle{\vbox to \windowheight{% box of window height
\vss  % centre vertically
\begin{center}  % center horizontally
{\LARGE\bf \@title \par} \vskip 1em plus 1fil
{\large \@project \par} \vfil
{\large\bf \lineskip .75em
\begin{tabular}[t]{c}\@author
\end{tabular}\par} \vfil
{\large \@date \par} \end{center}%
\vss}}}} \par
\ifx\@abstract\relax\typeout{Warning: M.Sc. report regulations require an abstract.}\else
  \null\vfil
  \begin{center}\bf \abstractname \end{center}
  \begin{singlespace} \@abstract \end{singlespace}
\fi
\null\vfil\@thanks
\null\par
\end{titlepage}
\setcounter{footnote}{0} \let\thanks\relax
\gdef\@thanks{}\gdef\@author{}\gdef\@title{}\gdef\@abstract{}%
\gdef\@project{}\let\maketitle\relax\let\abstract\relax}

%%% double spacing for rest of report
\setstretch{1.5}
\normalbaselineskip\baselineskip

