%\def\filename{cmpreprt.dtx}
%\def\filedate{21 Oct 2010}
%\def\docdate{21 Oct 2010}
%\def\fileversion{1.02}
%\iffalse
% Doc-Source file to use with LaTeX2e
% Copyright (C) 2004 Nicola Talbot, all rights reserved.
%\fi
% \MakeShortVerb{\"}
%
%\title{\texttt{cmpreprt.cls} v \fileversion\ : \LaTeXe\ class file for typesetting reports}
%\author{Nicola L.C. Talbot}
%\date{\docdate}
%\maketitle
%
% \section{Introduction}
% This is the documentation for \texttt{cmpreprt.cls}, a class file
% provided for writing reports in the style required by the School of
% Computing Sciences, University of East Anglia.
% All students should read the \href{http://www.cmp.uea.ac.uk/information/reports.jsp}{Report Writing Guide} before writing a report.
%
% \section{Available Commands}
%\subsection{Title Page Commands}
% The following commands may be used in the preamble.  If they are placed
% within the document environment, they must go before "\maketitle":
%
% \DescribeMacro{\ccode}
% \noindent The course code is specified
% using the command:\\
%"\ccode{"\meta{code}"}".\\
% For example:
%\begin{verbatim}
%\ccode{CMPS1A4Y}
%\end{verbatim}
%
% \DescribeMacro{\supervisor}
% \noindent Your supervisor should be specified using the command:\\
%"\supervisor{"\meta{name}"}"
%
% \DescribeMacro{\title}
% \noindent The assignment title is specified using the command:\\
% "\title{"\meta{title}"}"
%
% \DescribeMacro{\author}
% \noindent The author name (or the group name and the authors) is
% specified using the command:\\
% "\author{"\meta{name(s)}"}"
%
% \DescribeMacro{\regnum}
% \noindent The student's registration number is specified using the command:\\
% "\regnum{"\meta{registration number}"}"\\
% If there is more that one student, the registration numbers can be separated by
% a line break.  For example:
%\begin{verbatim}
%\regnum{01234567\\12345678\\23456789}
%\end{verbatim}
%
%\iffalse
% \DescribeMacro{\numwords}
% \noindent The total number of words in the report can be specified using the
% command:\\
%"\numwords{"\meta{number}"}"\\
% For example:
%\begin{verbatim}
%\numwords{1500}
%\end{verbatim}
% Some front-ends or editors have a build in word count function.  For those
% who don't have this option, there are several ways of counting the
% number of words in your document.
%\begin{enumerate}
%\item The Perl script \texttt{latexcount.pl} can be used to count the words
% in a \LaTeX\ document.  For example:\\[\baselineskip]
%"perl latexcount.pl" \meta{filename}\\[\baselineskip]
% This Perl script can be downloaded from \url{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/latexcount.html}
%
% If you are using a Makefile, you can use \texttt{sed} in combination with \texttt{latexcount.pl}
% to store the word count in a file, and then input it into your document.  For example,
% suppose your document is called "myrep.tex", then your Makefile might look something like:
%\begin{verbatim}
%myrep.dvi       : myrep.tex
%                latexcount.pl myrep.tex | \
%                       sed '/[0-9]\+ total/!d;s/\([0-9]\+\) total/\1/' > docwc.tex
%                latex myrep
%
%\end{verbatim}
% (You may need to write "perl latexcount.pl" instead of simply "latexcount.pl" depending
% on your system.)  The second line (which has been split into two lines as there wasn't
% enough space) of the above creates a file called "docwc.tex" which
% simply contains the total number of words.  This can then be read in by "myrep.tex":
%\begin{verbatim}
%\numwords{\input{docwc}}
%\end{verbatim}
%If you are using Windows, "latexcount.pl" is probably the best method if your front-end doesn't
%have a word count facility. (Although obviously you will need to have Perl installed.)
%
% \item The Unix command \texttt{wc} will count the number of words, characters
% and lines in an ordinary ASCII file, however it will also count all \LaTeX\ commands as well.
% To get around this you can use \texttt{detex}:\\[\baselineskip]
%"detex" \meta{filename} "| wc -w"\\[\baselineskip]
%In this case you will need the following in your Makefile (again supposing that your
% document is called "myrep.tex"):
%\begin{verbatim}
%myrep.dvi       : myrep.tex
%                detex myrep.tex | wc -w | \
%                        sed '/[0-9]\+ myrep.tex/!d;s/\([0-9]\+\) myrep.tex/\1/' \
%                        > docwc.tex
%                latex myrep
%\end{verbatim}
% Again, your \LaTeX\ source code will need to load in "docwc.tex":
%\begin{verbatim}
%\numwords{\input{docwc}}
%\end{verbatim}
%
%\item The shell script \texttt{wordcount.sh} and accompanying file \texttt{wordcount.tex}
% can be used to count words, whilst ignoring \LaTeX\ commands.  This can be downloaded 
% from \url{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/wordcount.html}.
% In this case you will need the following in your Makefile (again supposing that
% your document is called "myrep.tex"):
%\begin{verbatim}
%myrep.dvi      : myrep.tex
%                wordcount.sh myrep.tex | \
%                        sed '/[0-9]\+ words/!d;s/.\+ \([0-9]\+\) words\./\1/' \
%                        > docwc.tex
%                latex myrep
%
%\end{verbatim}
% (You may need to use "bash wordcount.sh" instead of "wordcount.sh".)
% Again, your \LaTeX\ source code will need to load in "docwc.tex":
%\begin{verbatim}
%\numwords{\input{docwc}}
%\end{verbatim}
%\end{enumerate}
% Note that the word count should exclude appendices.  This is easily done by 
% placing the appendices in a separate file, and including that file into
% your document using "\input{"\meta{filename}"}".
%\fi
%
% Most front-ends (such as WinEdt and TeXnicCenter) have a spell checking
% tool, make sure you use it to check your document.  For those not using
% a front-end, there is an application called "ispell" which will spell
% check an ASCII file.  You will need to use the "-t" option to indicate
% that your file is a \LaTeX\ file.
%
% \subsection{Other Commands}
% All commands that are defined in the "article" class file, may also
% be used with this class file.  There is an additional page style
% called "cmpreprt" available, which is used by default.  Remember
% to use "\maketitle" to generate the title page.
%
% \section{Contact Details}
% Dr Nicola Talbot\\
% School of Computing Sciences\\
% University of East Anglia\\
% Norwich. NR4 7TJ.\\
% \url{http://theoval.cmp.uea.ac.uk/~nlct}
%
% \StopEventually{}
%
%\iffalse
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,bookmarks]{hyperref}
\OnlyDescription
\begin{document}\DocInput{cmpreprt.dtx}\end{document}
%</driver>
%    \end{macrocode}
%\fi
% \section{The Code}
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{cmpreprt}[2010/10/21 (1.02) CMP project reports]
% 
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ExecuteOptions{titlepage}
%
\ProcessOptions*
\LoadClass[a4paper]{article}

\RequirePackage{mathptmx}
\RequirePackage[scaled=0.92]{helvet}
\RequirePackage{courier}
\RequirePackage[left=3.17cm,right=3.17cm,top=2.54cm,bottom=2.54cm]{geometry}
\RequirePackage{caption}
\captionsetup{format=hang,font=bf,tableposition=top,figureposition=bottom}
\captionsetup{font+=it}
%
% Define new page style
\newcommand{\ps@cmpreprttitle}{%
\def\@oddhead{\textbf{\@ccode}}
\def\@evenhead{}
\def\@oddfoot{\bfseries For:
\@supervisor\hfill\makebox[1.2in][l]{Reg:\@regnum}}
\def\@evenfoot{}}

\newcommand{\ps@cmpreprt}{%
\def\@oddhead{}
\def\@evenhead{}
\def\@oddfoot{\parbox[c][\headheight]{\textwidth}{\mbox{}\hrule\mbox{}\\Reg:\@regnum,
Supervisor: \@supervisor\hfill\thepage}}
}

\renewcommand{\maketitle}{%
\begin{titlepage}%
  \thispagestyle{cmpreprttitle}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vskip 20\p@
  \begin{center}%
    {\LARGE\bfseries \@title \par}%
    \vskip 1in%
    {\large\bfseries
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\normalsize\bfseries \begin{tabular}{r}\@regnum\end{tabular}\par}%
  \end{center}\par
  \@thanks
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\and\relax
}

\iffalse
% redefine captions so that they are bold italic

\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\bfseries\itshape #1: #2}%
  \ifdim \wd\@tempboxa >\hsize
    \bfseries\itshape #1: #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\fi

\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\scshape}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {-3.25ex \@plus1ex \@minus.2ex}%
                                    {1em}%
                                    {\normalfont\normalsize\bfseries\itshape}}

\def\@ccode{????\typeout{^^JMissing Course Code}}
\newcommand{\ccode}[1]{\renewcommand{\@ccode}{#1}}

\newcommand{\@supervisor}{????\typeout{^^JMissing Supervisor}}
\newcommand{\supervisor}[1]{\renewcommand{\@supervisor}{#1}}

\newcommand{\@numwords}{????}
\newcommand{\numwords}[1]{\renewcommand{\@numwords}{#1}}

\newcommand{\@regnum}{????????\typeout{^^JRegistration number(s) missing}}
\newcommand{\regnum}[1]{\renewcommand{\@regnum}{#1}}

\pagestyle{cmpreprt}

%    \end{macrocode}
%\Finale
%\endinput

