%%
%% This is file `vuwexam.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% vuwexam.dtx  (with options: `class')
%% ----------------------------------------------------------------
%% vuwexam --- description text
%% The vuwexam package provides a class file and
%% correpsonding example templates allowing academics at the Victoria
%% University of Wellington (VUW), who regularly use LaTeX, with a
%% way to create examination papers that conform to whatever style
%% guidelines are distributed within the current version of the
%% University's, dot-DOC only, template.
%% The package also provides a set of macros that are useful when
%% typesetting Computer Science test papers.
%% 
%% E-mail: jobs@ecs.vuw.ac.nz
%% Some bits copyright the various LaTeX teams
%% ----------------------------------------------------------------
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{vuwexam}
   [2023/10/07 VUW examination class $Revision: 2.39 $ $Date: 2023/10/07 04:40:35 $]
\DeclareOption{image}{\Ecs@imagetrue}
\DeclareOption{font}{\Ecs@imagefalse}
\newif\ifEcs@image
%% Article options
\DeclareOption{10pt}{
  \gdef\Ecs@fontoverride{defined}
  \PassOptionsToClass{\CurrentOption}{article}
}
\DeclareOption{11pt}{
  \gdef\Ecs@fontoverride{defined}
  \PassOptionsToClass{\CurrentOption}{article}
}
\DeclareOption{12pt}{
  \gdef\Ecs@fontoverride{defined}
  \PassOptionsToClass{\CurrentOption}{article}
}

\DeclareOption{pondy}{\Ecs@pondystyletrue}
\newif\ifEcs@pondystyle

\DeclareOption{fpstudentinfo}{\Ecs@fpstudinfotrue}
\newif\ifEcs@fpstudinfo

\DeclareOption*{
  \ClassWarning{vuwexam}{Unknown option '\CurrentOption'}
  \PassOptionsToClass{\CurrentOption}{article}
}

%% Execute default options
\ExecuteOptions{font}

\ProcessOptions

\if@compatibility
  \LoadClass{article}
  \RequirePackage{vuw-a4}
\else
  \@ifundefined{Ecs@fontoverride}{
    \LoadClass[12pt,a4paper]{article}
  }{
    \LoadClass[a4paper]{article}
  }
\fi

%%\usepackage{vuwvid}
\usepackage{mathpazo}
\usepackage{lastpage}
%%===========================================================================
%% 2016 T1
%%===========================================================================
%%
%% The swap to a 12pt font in the dot-doc file makes our use of \section{}
%%  for the sections result in text that is way too big.
%% Went with the secsty package for now
\usepackage{sectsty}
\sectionfont{\fontsize{12}{15}\selectfont}

\renewcommand\section{\@endquestion\@startsection {section}{1}{\z@}%
      {-3.5ex \@plus -1ex \@minus -.2ex}%
      {2.3ex \@plus.2ex}%
      {\normalfont\Large\bfseries\SS@sectfont}}

%%===========================================================================
%%===========================================================================
%% VUW VID
%%===========================================================================
%%
\newcommand{\vuwvid}{
  \parbox[b]{95mm}{
%%      \includegraphics[width=74mm]{VIC_CorpLogo_Black}
     \includegraphics[width=95mm]{VUW_Standard_Landscape_BLACK}

  }}

%%===========================================================================
%% Redefine page parameters
%%===========================================================================
%%
\setlength{\textwidth}{165mm}
\setlength{\textheight}{240mm}
\setlength{\oddsidemargin}{-0.1cm}
\setlength{\evensidemargin}{-0.1cm}
\setlength{\topmargin}{-8.2mm}
\setlength{\hoffset}{-0.2cm}
\setlength{\voffset}{-0.2cm}
\setlength{\headheight}{12pt}
\setlength{\headsep}{25pt}
\setlength{\footskip}{30pt}
\setlength{\marginparsep}{2.5mm}
\setlength{\parskip}{.7em}
\setlength{\parindent}{0pt}
\setlength{\columnsep}{10pt}
\setlength{\columnseprule}{0pt}
\setlength{\fboxrule}{1pt}
\setlength{\itemsep}{0mm}

%%===========================================================================
%% Commands for title page of exam
%%===========================================================================
%%
\newcommand*{\examyear}[1]{\def\@examyear{#1}}
\newcommand*{\examdate}[1]{\def\@examdate{#1}}
\def\@examdate{}
\newcommand*{\examtype}[1]{\def\@examtype{#1}}
\newcommand*{\paper}[1]{\def\@paper{#1}}
\newcommand*{\coursecode}[1]{\def\@coursecode{#1}}
\newcommand*{\coursetitle}[1]{\def\@coursetitle{#1}}
\newcommand*{\timeallowed}[1]{\def\@timeallowed{#1}}
\newcommand*{\openorclosed}[1]{\def\@openorclosed{#1}}
\newcommand{\permitted}[1]{\long\def\@permitted{#1}}
\newcommand{\instructions}[1]{\long\def\@instructions{#1}}
\newcommand*{\addedfrontpagetitle}[1]{\def\@addedfrontpagetitle{#1}}
\def\@addedfrontpagetitle{}
\def\studentid{\mbox{}}
\newcommand{\withstudentid}{\def\studentid{\hfill\makebox[6cm]{Student ID: \dotfill}}}
\newcommand*{\subindent}[1]{\def\@subindent{#1}}
\newcommand*{\subsubindent}[1]{\def\@subsubindent{#1}}

%%===========================================================================
%% Backward compatibility commands and environments
%%===========================================================================
%%
\newcommand*{\midyear}[1]{\def\@examtype{#1}}

\newlength{\fieldnamewidth}
\setlength{\fieldnamewidth}{2.9cm}

\long\def\WideItem[#1]{
  \list{}{
    \setlength{\labelwidth}{\fieldnamewidth} % Set width of item labels
    \setlength{\leftmargin}{\labelwidth}
    \addtolength{\leftmargin}{\labelsep}     % leftmargin = labelwidth + labelsep
    \setlength{\listparindent}{0pt}
    \setlength{\itemindent}{0pt}
    \item[\enspace#1\hfill]            % Use \hfill to left-justify label
  }
}
\def\endWideItem{\endlist}

%%===========================================================================
%% Page layout (headers and footers)
%%===========================================================================
%%
\DeclareTextFontCommand{\ftfoot}{\normalfont\bfseries\fontsize{10.95}{13.14}\selectfont}

\def\@coursefoot{\bf \@coursecode\ifx\@empty\@paper\else\ (\@paper)\fi}

\def\ps@headings{
  \renewcommand{\@oddhead}{
    \if@examtitle
      \vbox to\headheight{
\ifEcs@fpstudinfo
    \hbox to \hsize{
    \makebox[50mm]{\hskip-6ex{\footnotesize \bf Surname:}\dotfill}\hspace{3ex}
    \makebox[55mm]{{\footnotesize \bf First Name:}\dotfill}\hspace{5ex}
    \makebox[55mm]{{\footnotesize \bf Student ID:}\dotfill}\\[2em]}
\fi
%%    \makebox[50mm]{\hskip-3ex{\bf Student ID:}\dotfill}\vskip 0.6cm}
%%        \vbox to 0pt{\vss\hbox to\hsize{\hss\studentid}\vskip 3mm}
        \hbox to\hsize{\hss\vuwvid\hss}\vskip 0.6cm
        \setbox0=\hbox{\bf\large{EXAMINATIONS -- \@examyear}}
        \myskipa=\hsize\advance\myskipa by -\wd0
        \divide\myskipa by 2
        \myskipb=\myskipa\advance\myskipb by 1cm\advance\myskipb by -\wd1
        \hbox to\hsize{\hskip\myskipa\box0\hskip\myskipb\box1\hss}
        \vskip 0.2cm
      }
      \global\@examtitlefalse
    \else
      \vbox to\headheight{
      \studentid
      \vskip 0.1cm\vfil
    }
    \fi
  }
  \renewcommand{\@evenhead}{
     \vbox to\headheight{
%%        \phantom{\studentid}
       \studentid
       \vskip 0.1cm\vfil
     }
  }
  \renewcommand{\@oddfoot}{
    \ftfoot{\@coursefoot}\hfil{Page \ftfoot{\thepage}\  of \ftfoot{\pageref{LastPage}}}\hfil\phantom{\ftfoot{\@coursefoot}}
  }
  \renewcommand{\@evenfoot}{\@oddfoot}
}

\def\ps@lastpage{
  \renewcommand{\@oddhead}{
      \vbox to\headheight{\studentid\vskip 0.1cm\vfil}
  }
  \renewcommand{\@evenhead}{
%%     \vbox to\headheight{\phantom{\studentid}\vskip 0.1cm\vfil}
    \vbox to\headheight{\studentid\vskip 0.1cm\vfil}
  }
  \renewcommand{\@oddfoot}{
     \ftfoot{\@coursefoot}\hfil{Page \ftfoot{\thepage}\  of \ftfoot{\pageref{LastPage}}}\hfil\phantom{\ftfoot{\@coursefoot}}
  }
  \renewcommand{\@evenfoot}{\@oddfoot}
}

\pagestyle{headings}

\newcommand{\makeblankpage}{\newpage
                            \thispagestyle{empty}
                            \addtocounter{page}{-1}}

\newcommand{\frontmatter}{\pagenumbering{roman}}

\newcommand{\mainmatter}{\cleardoublepage \pagenumbering{arabic}}

\newcommand{\backmatter}{\appendix \cleardoublepage}

\usepackage{graphicx}  % for including images

%%===========================================================================
%% Exam environment
%%===========================================================================
%%
\newdimen\myskipa
\newdimen\myskipb
\newif\if@examtitle \@examtitlefalse

\newenvironment{exam}{
  \def\maketitle{
    \setbox0=\hbox{\large\bf\ifx\@empty\@examtype\else\@examtype\fi}
    \setbox1=\hbox{\ifx\@empty\@paper\else\@paper\fi}
    \myskipa=\hsize\advance\myskipa by -\wd0
    \divide\myskipa by 2
    \myskipb=\myskipa\advance\myskipb by 1cm\advance\myskipb by -\wd1
\ifEcs@fpstudinfo
    \hbox to\hsize{\vbox to 3.8cm{} \hskip\myskipa\box0\hskip\myskipb\box1\hss}
\else
    \hbox to\hsize{\vbox to 2.8cm{} \hskip\myskipa\box0\hskip\myskipb\box1\hss}
\fi
    \ifx\@empty\@addedfrontpagetitle\else\vskip 0.3cm
    \hbox to\hsize{\hfil \bf\large{\@addedfrontpagetitle}\hfil}\fi
    \vskip 0.5cm
    \hbox to\hsize{
      \hfil
      \fbox{\vbox to 2.4cm{
        \vfil
        \hbox to 7.3cm{\hfil \bf \@coursecode\hfil}
        \vfil
        \hbox to 7.3cm{\hss\vbox{\centering \bf \@coursetitle}\hss}
        \ifx\@empty\@paper
        \else\vfil\hbox to 7.3cm{\hfil\@paper\hfil}\fi
        \ifx\@empty\@examdate\else\hbox to 7.3cm{\hss\vbox{\centering \bf \@examdate}\hss}\fi
        \vfil}}
      \hfil}
%%   % Set the width of the columns.
    \vskip 0.7cm
    \setbox0=\hbox{Time Allowed:}
    \myskipa=\wd0
    \advance\myskipa by 0.7em
    \myskipb=\textwidth
    \advance\myskipb by -\myskipa
    \advance\myskipb by -10mm
%%  % Following line different from original, to avoid conflict with exptex
    \hbox{\begin{tabular}{@{}l@{\hspace{0.7em}}l@{}}
    {\bf Time Allowed:} & \parbox[t]{\myskipb}{\@timeallowed}\\
    & \\
    \multicolumn{2}{@{}l}{\bf \@openorclosed} \\
    & \\
    {\bf Permitted materials:} & \parbox[t]{\myskipb}{\@permitted} \\
    & \\
    {\bf Instructions:} & \parbox[t]{\myskipb}{\@instructions} \\
    \end{tabular}}\par\vskip 0.5cm
    \global\@examtitletrue
  }
}{
  \par\vskip 0.5cm\@lastquestion
  \hbox to \textwidth{\hfil * * * * * * * * * * * * * * *\hfil}
  \thispagestyle{lastpage}\par
}

%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%% QUESTIONS AND SUBQUESTIONS
%% ~~~~~~~~~~~~~~~~~~~~~~~~~~
%%
%% All questions are numbered automatically, with a separate counter for each
%% level.
%%
%% Three levels of question macro are defined:
%%
%% \question
%% \subquestion
%% \subsubquestion
%%
%% All three macros take an optional argument which is the number of marks
%% associated with that individual question.
%%
%% Two styles of laying out the content of a question are available
%%
%% The default style tries to mimic the VUW style for any given term,
%%   ie, incorporating any changes that person or persons unknown may
%%   have made to a microsft word document, or which person or persons
%%   unknown may have rescinded from previously distributed versions.
%%
%% In the absence of a defintive style guide for the format of Examination
%%   papers at VUW, mimicing the word document is the best we can do, for.
%%   example, the word documents rarely, if ever, contain any sub or subsub
%%   questions, so there's nothing to go on, and we made something up that
%%   "looked right" to us, and which is close to the \LaTeX list formatting
%%   defaults.
%%
%% The second style available can be obtained by passing the option 'pondy'
%%  to the document class.
%%
%% The current word document uses a 12pt, sans-serif font, though this
%%  has been known to change
%%
%% The current word document uses a 12pt, sans-serif font
%%
%% The current mimic sees sub or subsub questions indented in the following
%%   fashion
%%
%%  1. The first sentence (or title) of the question, followed by the number
%%     of marks allocated to the question styled thus (N mark/s/), in bold,
%%     and right justified.                                      (N mark/s/)
%%
%%     Any other text indented to the same level as the question "title"
%%
%%     (a) (N mark/s/) The text of the subquestion
%%
%%          Any other text indented to the subquestion "title"
%%
%%          i. (N mark/s/) The text of the subsubquestion
%%
%%             Any other text indented to the subsubquestion "title"
%%
%% The "pondy" style has no indentation for any of the three levels but
%%   lays out the question content using square brackets around the marks
%%   as follows
%%
%%  Question 1. A short emboldened title for the question        [N mark/s/]
%%
%%  Other text, not indented
%%
%%  (a) [N mark/s/] The title text of the subquestion
%%
%%  Other subquestion text
%%
%%  i. [N mark/s/] The title text of the subsubquestion
%%
%%  Other subsubquestion text
%%
%%                  ***********************************
%%
%% Older forms of the class file and template did not
%%
%%  In addition, formatting is controlled by a set
%% of macros for each level:
%%   \thequestion     How to diplay the value of the counter
%%   \questionlabel   How to display the question heading
%%   \questionmarks   How to display the marks of a question
%%                    This is a macro that takes one argument that is the
%%                    number of marks for the question.
%%                    There are 2 pre-defined macros which this can be set to:
%%                       \marksinline  or \marksright
%%
%% Modification of the default formatting can be made be redefining these
%% macros. e.g.
%%   \renewcommand{\questionmarks}{\marksinline}
%%   \renewcommand{\subquestionlabel}{\bf\thesubquestion.}
%%
%% Three levels of question are defined:
%%
%% \question{Name}[20]
%%    Start a new question.
%%    Default format:
%%       Question 1.  Name                         [20 marks]
%%
%% \subquestion[5]
%%    A numbered sub-question.  Counter is reset for each new question.
%%    Default format:
%%       (a) [5 marks]
%%
%% \subsubquestion[1]
%%    A numbered sub-subquestion.  Counter is reset for each new subquestion.
%%    Default format:
%%       (i) [1 mark]
%%
%%
%% \rmarks[5]
%%    Puts  [5 Marks] at the right margin
%%
%%
%% There is also one length parameter, \questionsep, which controls the
%% separation of the question heading from the question text.
%%
%% A standard enumerated list of questions can be achieved with
%%   \renewcommand{\questionlabel}{\thequestion.}
%%   \setlength{\questionsep}{0pt}
%%
%%
%% OTHER
%% ~~~~~
%% \continued         Page break with "Question 3 continued .."
%% \continuedbot      "Question 3 continued on next page" at bot of page
%% \continuedtop      "Question 3 continued " at top of page
%% \sparepage         Does not include \newpage. "This is a spare page....."
%%
%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%%
%% Depth indicators
%%
\newif\ifinqlist
\inqlistfalse
\newif\ifinqqlist
\inqqlistfalse
\newif\ifinqqqlist
\inqqqlistfalse

%% Widest labels
\newlength{\qindent}
\newlength{\qqindent}
\newlength{\qqqindent}

\ifEcs@pondystyle

\def\qlabel{{\bf{Question 00.}}}
\def\qqlabel{{\bf(x)}}
\def\qqqlabel{iii.}

\setlength{\qindent}{0pt}

\setlength{\qqindent}{0pt}

\setlength{\qqqindent}{0pt}

\else

\def\qlabel{00.}
\def\qqlabel{(x)}
\def\qqqlabel{iii.}

\setbox0=\hbox{(\qlabel}
\setlength{\qindent}{\wd0}

\setbox0=\hbox{(\qqlabel}
\setlength{\qqindent}{\wd0}

\setbox0=\hbox{(\qqqlabel}
\setlength{\qqqindent}{\wd0}

\fi

\newlength{\qbackmargin}
\setlength{\qbackmargin}{0pt}

\newlength{\saveparsep}
\newlength{\savetopsep}

%%===========================================================================
%% Mark formatting macros
%%===========================================================================
%%
\ifEcs@pondystyle
\def\lmchar{[}
\def\rmchar{]}
\else
\def\lmchar{(}
\def\rmchar{)}
\fi

\newcommand{\@printmarks}[1]{#1 \ifnum#1 =1{mark}\else{marks}\fi}
\newcommand{\marksright}[1]{\mbox{}\hfill\mbox{\bf\lmchar\@printmarks{#1}\rmchar}\par}
%%\newcommand{\marksinline}[1]{\hskip 1mm{\bf\lmchar\@printmarks{#1}\rmchar}\space}
\newcommand{\marksinline}[1]{{\bf\lmchar\@printmarks{#1}\rmchar}\space}
\newcommand{\nomarks}[1]{}

\def\rmarks{\@ifnextchar[{\@rmarks}{\@@rmarks}}
\def\@rmarks[#1]{\@@rmarks{#1}}
\def\@@rmarks#1{\hspace*{5mm}\marksright{#1}}
\def\marks{\@ifnextchar[{\@marks}{\@@marks}}
\def\@marks[#1]{\@@marks{#1}}
\def\@@marks#1{\par\marksright{#1}}

\newcommand{\questionmarks}{\marksright}

%%===========================================================================
%% Test environment
%%===========================================================================
%%
\newenvironment{test}{
  \def\maketitle{
    \thispagestyle{empty}
    \vspace*{-15mm}
    \begin{flushright}
    \makebox[70mm]{\hskip-3ex{\bf Family Name:}\dotfill}\hspace{4ex}
    \makebox[75mm]{{\bf Other Names:}\dotfill}\\[8mm]
    \makebox[70mm]{\hskip-3ex{\bf Student ID:}\dotfill}\hspace{4ex}
    \makebox[75mm]{{\bf Signature}\dotfill}\\[8mm]
    \end{flushright}

    \vskip 0cm
    \begin{center}
    {\LARGE \bf \@coursecode: \@examtype}
    \\[5mm]{\Large \@examdate}
    \end{center}
    \par\medskip
    {\large\bf Instructions}
    \begin{itemize}\setlength{\itemsep}{0mm}
    \item Time allowed: {\bf \@timeallowed}
    {\@instructions}
    \end{itemize}
    \par\bigskip
  }
  \addtolength{\topmargin}{-5mm}
  \addtolength{\textheight}{10mm}
}{
  \par\vskip 0.5cm\@lastquestion
  \hbox to \textwidth{\hfil * * * * * * * * * * * * * * *\hfil}
  \thispagestyle{lastpage}\par
}

%%===========================================================================
%% Markboxes environment
%%===========================================================================
%%
\def\markbox#1{\framebox[#1]{\rule[-2mm]{0mm}{7mm}\hfil}}

\def\fpq#1[#2][#3]{
 #1. \> #2 \>\> [#3]\>  \markbox{20mm}\\[1mm]
}

\newenvironment{markboxes}{
   \begin{large}\begin{tabbing}
   5.X \=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\=M\=XXXXX\=\kill
   {\bf Questions}                         \>\>{\bf Marks}\\[3mm]
}
{
   \>                                  \> TOTAL:\>\> \markbox{20mm}
   \end{tabbing}
   \end{large}
}

\renewcommand \thesection {SECTION \Alph{section}}

%%===========================================================================
%% Questions
%%===========================================================================
%%
\newcounter{question}
\renewcommand{\thequestion}{\arabic{question}}

\ifEcs@pondystyle
\newcommand{\questionlabel}{{\bf{Question \thequestion.}}}
\newcommand{\@printqtitle}[1]{{\bf#1}}
\else
\newcommand{\questionlabel}{\thequestion.}
\newcommand{\@printqtitle}[1]{#1}
\fi

\newcounter{totalmarks}
\setcounter{totalmarks}{0}
\newcounter{totalsubmarks}[question]
\setcounter{totalsubmarks}{0}

%% If \question has an [n] argument
%% then we use \@questionm
%% else we use \@question
%%
\def\question#1{
  \ifnum\c@totalsubmarks >0
    \typeout{* Subquestions : [\arabic{totalsubmarks} marks]}
  \fi
  \typeout{======================================================================}
  \setlength{\saveparsep}{\parsep}
  \setlength{\savetopsep}{\topsep}
  \setcounter{subquestion}{0}
  \@ifnextchar [{\@questionm{#1}}{\@question{#1}}}

%% A Question without marks
%%
\def\@question#1{
  \stepcounter{question}
  \par
  \setbox1=\hbox{\questionlabel}
  \myskipa=\qindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist \endlist \endlist \egroup
  \else
    \ifinqqlist
      \endlist \endlist \egroup
    \else
      \ifinqlist
        \endlist \egroup
      \fi
    \fi
  \fi
  \setlength{\qbackmargin}{\qindent}
\ifEcs@pondystyle
  \bgroup\list{\questionlabel}{\leftmargin\qbackmargin\labelwidth-1ex}
\else
  \bgroup\list{\questionlabel}{\leftmargin\qbackmargin}
\fi
  \item\relax\nointerlineskip\leavevmode
  \@printqtitle{#1}
  \inqlisttrue
  \inqqlistfalse
  \inqqqlistfalse
  \typeout{Starting Question \thequestion: #1 on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

%% A Question with marks
%%
\def\@questionm#1[#2]{
  \stepcounter{question}
  \addtocounter{totalmarks}{#2}
  \par
  \setbox1=\hbox{\questionlabel}
  \myskipa=\qindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist \endlist \endlist \egroup
  \else
    \ifinqqlist
      \endlist \endlist \egroup
    \else
      \ifinqlist
        \endlist \egroup
      \fi
    \fi
  \fi
  \setlength{\qbackmargin}{\qindent}
\ifEcs@pondystyle
  \bgroup\list{\questionlabel}{\leftmargin\qbackmargin\labelwidth-1ex}
\else
  \bgroup\list{\questionlabel}{\leftmargin\qbackmargin}
\fi
  \item\relax\nointerlineskip\leavevmode
  \@printqtitle{#1}
  \questionmarks{#2}
  \inqlisttrue
  \inqqlistfalse
  \inqqqlistfalse
  \typeout{Starting Question \thequestion: #1 [#2 marks] on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

\def\@endquestion{
  \ifinqqqlist
    \endlist \endlist \endlist \egroup
  \else
    \ifinqqlist
      \endlist \endlist \egroup
    \else
      \ifinqlist
        \endlist \egroup
      \fi
    \fi
  \fi
  \inqlistfalse
  \inqqlistfalse
  \inqqqlistfalse
}
%%---------------------------------------------------------------------------
%% Sub-questions
%%---------------------------------------------------------------------------
%%
\newcounter{subquestion}
\renewcommand{\thesubquestion}{(\alph{subquestion})}
\newcommand{\subquestionlabel}{\thesubquestion}

%% This is actually simply Pondy's preferences that was hardcoded into
%%  the default, because VUW didn't (maybe still doesn't) have a default
%%  for sub and subsub
%%
\ifEcs@pondystyle
  \newcommand{\subquestionmarks}{\marksinline}
\else
  \newcommand{\subquestionmarks}{\marksright}
\fi

%% Traditionally in the ECS template, sub questions didn't require the
%%  question title as an argument so we had to handle three cases
%%
%% If \subquestion has an [n] argument
%%   then we use \@subquestionm
%% however if we alao have a {subquestion title) argument
%%   then we use \@subquestiont
%%   else we use \@subquestion
%%
%% Although it turns out there are five cases
%%    \subquestion some text but no marks
%%       @subquestion
%%    \subquestion[n] some text with marks
%%       @subquestionm
%%    \subquestion{explicit subquestion title but no marks}
%%       @subquestiont
%%    \subquestion[n]{explicit subquestion title with marks}
%%       @subquestionm
%%    \subquestion{alt explicit subquestion title with marks}[n]
%%      @subquestionu
%%
\def\subquestion{
  \setcounter{subsubquestion}{0}
  \@ifnextchar [{\@subquestionm}
    {\@ifnextchar\bgroup{\@subquestiont}
                        {\@subquestion}
    }
}

\def\@subquestion{
  \stepcounter{subquestion}
  \par
  \setbox1=\hbox{\subquestionlabel}
  \myskipa=\qqindent\advance\myskipa by -\wd1
  \ifinqqqlist
   \endlist \endlist
   \setlength{\qbackmargin}{-\qqqindent}
  \else
    \ifinqqlist
      \endlist
      \setlength{\qbackmargin}{0pt}
    \else
      \setlength{\qbackmargin}{\qqindent}
    \fi
  \fi
\ifEcs@pondystyle
  \list{\subquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
  \inqqlisttrue
  \inqqqlistfalse
  \typeout{Starting subQuestion \thesubquestion: on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

%% A subquestion with a marks argument and possibly a title
%%
\def\@subquestionm[#1]{
  \stepcounter{subquestion}
  \addtocounter{totalsubmarks}{#1}
  \par
  \setbox1=\hbox{\subquestionlabel}
  \myskipa=\qqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist \endlist
    \setlength{\qbackmargin}{-\qqqindent}
  \else
    \ifinqqlist
      \endlist
       \setlength{\qbackmargin}{0pt}
    \else
      \setlength{\qbackmargin}{\qqindent}
    \fi
  \fi
\ifEcs@pondystyle
  \list{\subquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
  \setbox3=\hbox{\space}
\ifEcs@pondystyle
  \subquestionmarks{#1}\hskip-\wd3
\else
  \marksinline{#1}\hskip-\wd3
\fi
  \inqqlisttrue
  \inqqqlistfalse
  \typeout{Starting subQuestiom \thesubquestion: [#1 marks] on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

%% A subquestion with a title argument, where we check whether it
%%  also has a marks argument
%%
\def\@subquestiont#1{
  \@ifnextchar [{\@subquestionu{#1}}
  {
  \stepcounter{subquestion}
  \par
  \setbox1=\hbox{\subquestionlabel}
  \myskipa=\qqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist \endlist
    \setlength{\qbackmargin}{-\qqqindent}
  \else
    \ifinqqlist
      \endlist
       \setlength{\qbackmargin}{0pt}
    \else
      \setlength{\qbackmargin}{\qqindent}
    \fi
  \fi
\ifEcs@pondystyle
  \list{\subquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
  #1
  \inqqlisttrue
  \inqqqlistfalse
  \typeout{Starting subQuestiot \thesubquestion: #1 on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
  }
}

%% A subquestion with BOTH title AND marks argument
%%
\def\@subquestionu#1[#2]{
  \stepcounter{subquestion}
  \addtocounter{totalsubmarks}{#2}
  \par
  \setbox1=\hbox{\subquestionlabel}
  \myskipa=\qqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist \endlist
    \setlength{\qbackmargin}{-\qqqindent}
  \else
    \ifinqqlist
      \endlist
       \setlength{\qbackmargin}{0pt}
    \else
      \setlength{\qbackmargin}{\qqindent}
    \fi
  \fi
\ifEcs@pondystyle
   \list{\subquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
 \list{\subquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
\ifEcs@pondystyle
  \subquestionmarks{#2} #1
\else
  \@printqtitle{#1}
  \subquestionmarks{#2}
\fi
  \inqqlisttrue
  \inqqqlistfalse
  \typeout{Starting subQuestiou \thesubquestion:  [#2 marks] on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}


%%---------------------------------------------------------------------------
%% Sub-sub-questions
%%---------------------------------------------------------------------------
%%
\newcounter{subsubquestion}
\renewcommand{\thesubsubquestion}{\roman{subsubquestion}.}
\newcommand{\subsubquestionlabel}{\thesubsubquestion}

%% Again, this is actually simply Pondy's preferences that was hardcoded into
%%  the default, because VUW didn't (maybe still doesn't) have a default
%%  for sub and subsub
%%
%% See the explainatry text in the Sub-questions section for what is
%%  going on here
\ifEcs@pondystyle
  \newcommand{\subsubquestionmarks}{\marksinline}
\else
  \newcommand{\subsubquestionmarks}{\marksright}
\fi

\def\subsubquestion{
  \@ifnextchar [{\@subsubquestionm}
    {\@ifnextchar\bgroup{\@subsubquestiont}
                        {\@subquestion}
    }
}

\def\@subsubquestion{
  \stepcounter{subsubquestion}
  \par
  \setbox1=\hbox{\subsubquestionlabel}
  \myskipa=\qqqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist
    \setlength{\qbackmargin}{0pt}
  \else
    \setlength{\qbackmargin}{\qqqindent}
  \fi
\ifEcs@pondystyle
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
  \inqqqlisttrue
  \typeout{Starting subsubQuestion \thesubsubquestion: on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

%% A subsubquestion with a marks argument and possibly a title
%%
\def\@subsubquestionm[#1]{
  \stepcounter{subsubquestion}
  \par
  \setbox1=\hbox{\subsubquestionlabel}
  \myskipa=\qqqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist
    \setlength{\qbackmargin}{0pt}
  \else
    \setlength{\qbackmargin}{\qqqindent}
  \fi
\ifEcs@pondystyle
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
\ifEcs@pondystyle
  \subsubquestionmarks{#1}
\else
  \marksinline{#1}
\fi
  \inqqqlisttrue
  \typeout{Starting subsubQuestionm \thesubsubquestion: #1 on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

%% A subsubquestion with a title argument where we check whether it
%%  also has a marks argument
%%
\def\@subsubquestiont#1{
  \@ifnextchar [{\@subsubquestionu{#1}}
  {
  \stepcounter{subsubquestion}
  \par
  \setbox1=\hbox{\subsubquestionlabel}
  \myskipa=\qqqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist
    \setlength{\qbackmargin}{0pt}
  \else
    \setlength{\qbackmargin}{\qqqindent}
  \fi
\ifEcs@pondystyle
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
  #1
  \inqqqlisttrue
  \typeout{Starting subsubQuestiont \thesubsubquestion: #1 on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
  }
}

%% A subsubquestion with BOTH title AND marks argument
%%
\def\@subsubquestionu#1[#2]{
  \stepcounter{subsubquestion}
  \par
  \setbox1=\hbox{\subsubquestionlabel}
  \myskipa=\qqqindent\advance\myskipa by -\wd1
  \ifinqqqlist
    \endlist
    \setlength{\qbackmargin}{0pt}
  \else
    \setlength{\qbackmargin}{\qqqindent}
  \fi
\ifEcs@pondystyle
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin\labelwidth-1ex
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\else
  \list{\subsubquestionlabel}{\leftmargin\qbackmargin
  \setlength{\topsep}{\savetopsep}
  \setlength{\parsep}{\saveparsep}}
\fi
  \item\relax\nointerlineskip\leavevmode
\ifEcs@pondystyle
  \subsubquestionmarks{#2} #1
\else
  \@printqtitle{#1}
  \subsubquestionmarks{#2}
\fi
  \inqqqlisttrue
  \typeout{Starting subsubQuestionu \thesubsubquestion: #1 on page \arabic{page}}
%%  \typeout{parsep \number\parsep \space topsep \number\topsep}
}

%% Last Question not really a question !
%%
\def\@lastquestion{
  \ifnum\c@totalsubmarks >0
    \typeout{* Subquestions : [\arabic{totalsubmarks} marks]}
  \fi
  \typeout{**********************************************************************}
  \typeout{* Total marks  = \arabic{totalmarks}}
  \typeout{**********************************************************************}
  \ifinqqqlist
    \endlist \endlist \endlist \egroup
  \else
    \ifinqqlist
      \endlist \endlist \egroup
    \else
      \ifinqlist
        \endlist \egroup
      \fi
    \fi
  \fi
}

%%===========================================================================
%% "Continued" macros
%%===========================================================================
%%
\newcommand{\continuedbot}{\par\nopagebreak\vfill\nopagebreak
\vbox to 3mm{{\begin{flushright}
(Question \thequestion\ continued on next page)
\end{flushright}}\vss}}
\newcommand{\continuedtop}{
\vbox to 0pt{\vss\bf(Question \thequestion\ continued)}\par\vskip 3mm}
\newcommand{\continued}{\continuedbot\newpage\continuedtop}

%%===========================================================================
%% Spare page
%%===========================================================================
%%
\newcommand{\sparepage}{\begin{center}\begin{bf}
SPARE PAGE FOR EXTRA ANSWERS
\end{bf}\end{center}
Cross out rough working that you do not want marked.
\\Specify the question number for work that you do want marked.}

%%===========================================================================
%%===========================================================================
%% Pondy's ferkling of the default style that no-one knew about
%%===========================================================================
%%
\usepackage{color}
\usepackage{boxedminipage}
\usepackage{graphicx}

\definecolor{dgreen}{rgb}{0,.5,0}

%% 2016 Pondy moved to exam-macros.sty%\usepackage{ifthen}
%% 2016 Pondy moved to exam-macros.sty%\newboolean{showanswers}
%% 2016 Pondy moved to exam-macros.sty%\setboolean{showanswers}{false}
%%
%% 2016 Pondy moved to exam-macros.sty%\ifthenelse{\boolean{showanswers}}{%
%% 2016 Pondy moved to exam-macros.sty%\newcommand{\anscolor}{\color{blue}}}{%
%% 2016 Pondy moved to exam-macros.sty %\newcommand{\anscolor}{\color{white}}}
%%
%% 2016 Pondy moved to exam-macros.sty %\newcommand{\Ans}[1]{\protect{\ansft\anscolor\,#1}}   %\rule{1.2pt}{2.5ex}
%%
%% This really should be in the file
%% \renewcommand{\questionmarks}{\marksinline}
%%
%%===========================================================================
%% Pondy's exam-macros.sty
%%===========================================================================
%%
\usepackage{boxedminipage}
\usepackage{relsize}
\usepackage{ifthen}

\let\subqn=\subquestion
\let\subqnm=\subquestion
\let\subsubqn=\subsubquestion
\let\subsubqnm=\subsubquestion

\newcommand{\ronemark}{\rmarks[1]}
\newcommand{\lmarks}[1]{\rmarks[#1]}
\newcommand{\lonemark}{\ronemark}

\setlength{\fboxrule}{1pt}
\newlength{\ansheight}
\newlength{\ansboxwidth}
\def\setboxwidth{\setlength{\ansboxwidth}{\linewidth}\addtolength{\ansboxwidth}{-\leftskip}\addtolength{\ansboxwidth}{-8pt}}


\def\ansft{\larger}

\newcommand{\ansspace}[1]{\ansline\raisebox{-1mm}[5mm][1.2mm]{\makebox[#1]{\dotfill}}}
\def\dts{\raisebox{-1mm}[5mm][1.2mm]{\makebox[6mm]{\dotfill}}}

\newcommand{\fullspace}[2]{\hbox to 0pt{\raisebox{-1mm}[5mm][1.2mm]
{\makebox[#1]{\dotfill}}\hss}{\ansft#2}}

\def\ansline{\rule{0mm}{2.5ex}}

\newcommand{\ansstrut}{\rule[-3mm]{0mm}{10mm}}

\newcommand{\ans}[1]{% width
{\fboxrule=1pt\framebox[#1]{\ansstrut\hfill}}}

\newcommand{\fullans}[2]{{\fboxrule=1pt%
\framebox[#1]{\ansstrut\hskip 3mm#2\hfill}\par\medskip}}

\newcommand{\ansbox}[1]{{\fboxrule=1pt\setboxwidth%
\setlength{\ansheight}{-#1}\addtolength{\ansheight}{7mm}%
\framebox[\ansboxwidth]{\rule[\ansheight]{0mm}{#1}\hfill}\par\bigskip}}

\newcommand{\fullansbox}[2]{\setboxwidth% height stuff%
{\fboxrule=1pt\setlength{\ansheight}{-#1}\addtolength{\ansheight}{7mm}%
\framebox[\ansboxwidth][l]{\rule[\ansheight]{0mm}{#1}
\begin{minipage}{\ansboxwidth}#2\end{minipage}\hfill}\par\bigskip}}

\newcommand{\paransbox}[1]{{\fboxrule=1pt\setboxwidth% stuff%
\fbox{\begin{minipage}{\ansboxwidth}#1\end{minipage}\hfill}\par\bigskip}}

\newcommand{\progansbox}[1]{{\fboxrule=1pt\setboxwidth%
\fbox{\begin{minipage}{\ansboxwidth}#1\end{minipage}\hfill}\par\bigskip}}

\newcommand{\progdispbox}[1]{{\fboxrule=.2pt\setboxwidth%
\fbox{\begin{minipage}{\ansboxwidth}#1\end{minipage}\hfill}\par\bigskip}}

\newenvironment{progbox}{\fboxrule=1pt\setboxwidth%
\begin{boxedminipage}{\ansboxwidth}}{\end{boxedminipage}\hfill\par\bigskip}
\newenvironment{dispbox}{\fboxrule=.2pt\setboxwidth%
\begin{boxedminipage}{\ansboxwidth}}{\end{boxedminipage}\hfill\par\bigskip}
\newcommand{\floatans}[3]{{\fboxrule=1pt%
\fbox{\begin{minipage}[#1]{#2}\rule{0mm}{#3}\mbox{}\hfill\mbox{}\end{minipage}\hfill}\par\bigskip}}

\newcommand{\floatansbox}[3]{{\fboxrule=1pt%
\fbox{\begin{minipage}[#1]{#2}#3\mbox{}\hfill\mbox{}\end{minipage}\hfill}\par\bigskip}}

\newcommand{\floatdispbox}[3]{{\fboxrule=0.2pt%
\fbox{\begin{minipage}[#1]{#2}#3\mbox{}\hfill\mbox{}\end{minipage}\hfill}\par\bigskip}}

\newcommand{\nfullans}[1]{\fullans{#1}}% stuff

\newcommand{\nfullansbox}[2]{\fullansbox{#1}{#2}}

\newcommand{\nansbox}[1]{\ansbox{#1}}% height

\newcommand{\nparansbox}[1]{\paransbox{#1}}

\newcommand{\nprogansbox}[1]{\progansbox{#1}}

\def\epsfxbox#1#2{\epsfxsize=#1 \epsfbox{#2}}
\def\epsfybox#1#2{\epsfysize=#1 \epsfbox{#2}}
\def\epsfscbox#1#2{\def\epsfsize##1##2{#1##1}\epsfbox{#2}}
\def\epsffitbox#1{\def\epsfsize##1##2{\ifnum##1>\hsize\hsize\else##1\fi}\epsfbox{#1}}

%% random stuff
\def\eg{{\it e.g.}}
\def\ie{{\it i.e.}}
\def\Eg{{\it E.g.}}
\def\Ie{{\it I.e.}}
\def\etc{{\it etc.}}
\def\vs{{\it vs.}}

\def\deg{\(^\circ\)}

%% 2016 additions BEGIN
\newboolean{showanswers}
\setboolean{showanswers}{true}

\newsavebox{\savedAnsBox}
\newlength{\ansBoxHeight}

\newcommand{\anscolor}{%
\ifthenelse{\boolean{showanswers}}{\color{blue}}{\color{white}}}

\newcommand{\Ans}[1]{%
\ifthenelse{\boolean{showanswers}}
{\protect{\ansft\anscolor\,#1}}
{\mbox{\phantom{\ansft\,#1}}}}

\newenvironment{answerCode}
{\renewcommand{\baselinestretch}{1.1}\addtolength{\baselineskip}{0.1\baselineskip}%
\begin{lrbox}{\savedAnsBox}\begin{minipage}{\hsize}\anscolor}%
{\end{minipage}\end{lrbox}%
\ifthenelse{\boolean{showanswers}}
{\vbox to 0pt{\vspace*{0.0em}\usebox\savedAnsBox\vss}}
{\vbox to 0pt{\vss}}}

\newenvironment{givenCode}
{\par\renewcommand{\baselinestretch}{1.1}\addtolength{\baselineskip}{0.1\baselineskip}}
{}

%% figureAndAns{scale=0.8}{figure}{answerfigure}
%%
\newcommand{\figureAndAns}[3]{
\ifthenelse{\boolean{showanswers}}
{\includegraphics[#1]{#3}}
{\includegraphics[#1]{#2}}}

%%arguments:  scale, answer figure
%%
\newcommand{\figureAns}[2]{%
\savebox{\savedAnsBox}{\includegraphics[#1]{#2}}%
\ifthenelse{\boolean{showanswers}}
{\usebox{\savedAnsBox}}
{\ansBoxHeight=\ht\savedAnsBox \advance\ansBoxHeight by \dp\savedAnsBox
 \advance\ansBoxHeight by 0.5em
\vbox to \ansBoxHeight{\vss}}}

%% 2016 additions END
%%
%%===========================================================================
%% Pondy's javalisting.sty
%%===========================================================================
%%
\usepackage{listings}
\usepackage{relsize}

%%  Used with
%%
%%  \begin{lstlisting}[style=jjcode, morekeywords={[2]Numbers,Color}]
%%     code
%%  \end{lstlisting}
%%
%%  where the morekeywords[2] are class or type names specific to this program.
%%
\lstdefinelanguage{pjava}{
   morekeywords={abstract,break,case,catch,class,
   const,continue,default,do,else,extends,false,final,
   finally,for,goto,if,implements,import,instanceof,
   interface,label,native,new,null,package,private,protected,%
   public,return,static,super,switch,synchronized,this,throw,%
   throws,transient,true,try,void,volatile,while},
   morekeywords={[2]boolean,byte,char,double,float,int,long,short,String,
      Scanner,Integer,Double,DrawingCanvas,JFrame,JButton,JTextField,JPanel,
      Color,File,PrintStream,List,Set,ArrayList,HashSet,E,Collection,Stack,Queue},
   sensitive,
   morecomment=[l]//,
   morecomment=[s]{/*}{*/},
   morestring=[b]",
   morestring=[b]',
  }

\lstdefinestyle{jjcode}{
  language=pjava,
  basicstyle=\sffamily,
  stringstyle=\ttfamily,
  commentstyle=\rmfamily\itshape,
  keywordstyle={[2]\itshape},
  showstringspaces=false,
  columns=flexible
}

\newenvironment{codefont}{\begin{sffamily}}{\end{sffamily}}
\newenvironment{idfont}{\begin{codefont}\begin{upshape}\begin{mdseries}}
 {\end{mdseries}\end{upshape}\end{codefont}}
\newenvironment{keywordfont}{\begin{codefont}\begin{upshape}\begin{bfseries}}
 {\end{bfseries}\end{upshape}\end{codefont}}
\newenvironment{typefont}{\begin{codefont}\begin{slshape}\begin{mdseries}}
 {\/\end{mdseries}\end{slshape}\end{codefont}}
\newenvironment{stringfont}{\begin{larger}\begin{ttfamily}\begin{mdseries}}
 {\end{mdseries}\end{ttfamily}\end{larger}}

\newcommand{\jstr}[1]{\begin{stringfont}\raisebox{.3ex}{"}#1\raisebox{.3ex}{"}\end{stringfont}}

%% For use within ordinary text (\id for compatibility only)
\newcommand{\cd}[1]{\begin{idfont}#1\end{idfont}}
                  %{\begin{smaller}\begin{idfont}#1\end{idfont}\end{smaller}}
\newcommand{\kw}[1]{\begin{keywordfont}#1\end{keywordfont}}
\newcommand{\tp}[1]{\begin{typefont}#1\end{typefont}}
\def\jeq{\begin{codefont}=\end{codefont}}
\def\jgteq{\(>\)\jeq}
\def\jlteq{\(<\)\jeq}
\def\jneq{!\jeq}
\def\jeqeq{\jeq\,\jeq}
\def\jdec{{\tt -\,-}}
\def\jgt{\(>\)}
\def\jlt{\(<\)}
\def\jtwd{\(\sim\)}
\def\jdamp{{\&\&}}
\def\jdor{\(\mid\, \mid\)}
\def\jbksl/{\(\backslash\)}
\def\jbksln{\(\backslash\)n}
\def\jtms{\(\ast\)}   % *
\def\jqt{\raisebox{.3ex}{\,\ttfamily '}}
\def\jdqt{{\raisebox{.3ex}{\ttfamily "}}}  %{\,\tt'\hskip -0.3em'}}

%%===========================================================================
%% 
%% Copyright (C) 2017 by ECS, VUW, NZ
%% ----------------------------------
%% 
%% Documentation and source file for the vuwexam package.
%% 
%% The package consists of the file  vuwexam.dtx
%% and the derived files             vuwexam.ins,
%%                                   vuwexam.cls,
%%                                   vuwexam.pdf,
%%                                   exam_skel.tex and
%%                                   test_skel.tex
%% 
%%     To install the vuwexam package you need:
%% 
%% vuwexam.dtx (this file)
%% docstrip.tex (part of the standard LaTeX2e distribution)
%% 
%% 
%%     To produce the documentation you also need:
%% 
%% doc.sty (part of the standard LaTeX2e distribution)
%% 
%% 
%%     Instructions
%% 
%% Run LaTeX on vuwexam.dtx to strip the comments from vuwexam.dtx and
%% produce
%% 
%% the package file:             vuwexam.cls.
%% an install file:              vuwexam.ins
%% documentation in DVI format:  vuwexam.dvi
%% two template files:           exam_skel.tex
%%                               test_skel.tex
%% 
%% Put vuwexam.cls somewhere LaTeX can see it.
%% 
%% If you run pdfLaTeX on vuwexam.dtx you will get the above files,
%% without the DVI format, but produce
%% 
%% documentation in PDF format:  vuwexam.pdf
%% 
%% You can then use the skeleton files as a basis for your own exams
%% or tests.
%% 
%% 
%% This program - the file vuwexam.dtx - may be distributed and/or modified
%% under the conditions of SOME LICENCE
%% 
%% Don't modify this file unless you change its name and change all the
%% various identification strings it contains to indicate that: it's
%% derived from our vuwexam package, it's now your responsibility, and
%% it's no longer part of the vuwexam package.
%% 
%% -----------------------------------------------------------------------------
%%  Preserve History of pre-DTX versions
%% 
%%  First written for LaTeX 2.09 by Bernd Gill.  8-Sep-88
%%  Modified for LaTeX2e 1995-04-27 by Ray Brownrigg and Gary Houston.
%%  Bug fixes and upgrade with new question macros by Linton Miller.  4/6/97
%%  Incorporate visual identity by Ray Brownrigg. 31-Aug-01
%%  Bug fixes by Ray Brownrigg. Oct-01
%%  Modified for new template by Ray Brownrigg. 2004.05.05
%%  Merged with John Randal's by Jacek
%%  Palatino font by default (via mathpazo) 20May05
%%  Modified withstudentid for twosided 02Nov06
%%  Modified for 2012 template by Pondy 25Oct12
%%  Modified for 2013 template by Ray 26Mar13
%%  Modified for 2013T2 template by Ray 21Oct13
%%  Modified for 2015T1 template by Ray 24Apr15
%% ------------------------------------------------------------------------------
%%
%% End of file `vuwexam.cls'.
