GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
19
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
ouexam
Browse code
- Added version 1.2 files.
master
OUEXAM_2_4_2
OUEXAM_2_4_1
OUEXAM_2_4
OUEXAM_2_3_2
OUEXAM_2_3_1
OUEXAM_2_3
OUEXAM_2_2
OUEXAM_2_1_3_FINAL
OUEXAM_2_1_3
OUEXAM_2_1_2
OUEXAM_2_1_1
OUEXAM_2_1
OUEXAM_2_0_2
OUEXAM_2_0_1_FINAL
OUEXAM_2_0_1
OUEXAM_2_0
OUEXAM_1_2
1 parent
6e402f3
commit
193de5d83daaf02fcd863baa095d7fc37c02a269
nstanger
authored
on 5 Apr 2004
Patch
Showing
1 changed file
ouexam.dtx
Ignore Space
Show notes
View
ouexam.dtx
\def\filedate{14 April 2000} \def\fileversion{1.2} % \iffalse meta-comment %% %% ouexam.dtx Copyright 1999--2000 Nigel Stanger %% %% You may use this package freely, and also distribute it %% provided that you don't change it, make any money off %% it or pretend that you wrote it. %% %<*driver> \documentclass{ltxdoc} \usepackage{doc} \DisableCrossrefs \CodelineNumbered \RecordChanges \title{The \textsf{ouexam} document class, v\fileversion} \author{Nigel Stanger\\nstanger@infoscience.otago.ac.nz} \date{\filedate} \begin{document} \maketitle \DocInput{ouexam.dtx} \end{document} %</driver> % % \fi % %% \CheckSum{575} %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %% % % \MakeShortVerb{\|} % % \changes{1.0}{1999/04/15}{Initial version.} % % \begin{abstract} % This document class allows you to create Otago University final % examination papers using \LaTeXe\@. It implements the major formatting % requirements specified by the University and also provides some useful % macros to ease the process of building the title page and automatically % deals with fiddly little issues such as question and section numbering, % the number of pages in the paper, printing `\textbf{TURN OVER}' in the % bottom right corner of every page except the last one and adding up the % total number of marks for a question. % \end{abstract} % % \section{Introduction} % % \subsection{Class options} % % This document class is based on the \textsf{article} class and accepts any of % the options accepted by \textsf{article}. The default options are % \textsf{onecolumn}, \textsf{oneside}, \textsf{a4paper} and \textsf{12pt}. % Normally the only one you might want to change is the last one. % % \changes{1.1}{1999/04/20}{NJS Documented \textsf{multichoice} class option.} % The only `native' option recognised by \textsf{ouexam} is % \DescribeMacro{multichoice} \textsf{multichoice}, which tells % \textsf{ouexam} to format the examination paper as a multiple-choice % examination. The title page format is different, and several of the title % page macros have no effect when this option is specified. The % \textsf{multichoice} option also defines some additional macros that are % useful for multiple-choice examination papers. See % sections~\ref{Sec:Questions:MP} and~\ref{Sec:TitlePage:MP}. % % \subsection{Required packages} % % This class currently requires the \textsf{calc} and \textsf{ifthen} % packages. I may look at removing the requirement for these in a % later version, as neither of them are that essential. % % \subsection{Page margins} % % This class assumes A4 paper. You will probably get weird results if you try % to do anything different. The margins are set up as follows: top and bottom % 2cm (headers and footers are inside this margin), left and right 2.54cm (1in). % % \subsection{Page styles} % % There are three main page styles in this class: % \begin{description} % \item[\textsf{plain}] \DescribeMacro{plain} This is a slight modification of % the \textsf{plain} page style from \textsf{article}. It produces pages that % have the page number centered at the top, the paper number in the top right % corner and the text `\textbf{TURN OVER}' in the bottom right. This is the % default page style. % \item[\textsf{lastpage}] \DescribeMacro{lastpage} This is the same as % \textsf{plain}, but without the `\textbf{TURN OVER}'. This is used for the % last page of the examination. You normally will not have to use this % yourself --- the class should take care of it for you. I have managed to % confuse it in the past, however, so there may be odd occasions where you % have to set the page style of the last page manually. It will be fairly % obvious when you need to do this. % \item[\textsf{titlepage}] \DescribeMacro{titlepage} This is the same as % \textsf{plain}, but without the page header, and is used for the title page. % Again, you will normally not use this yourself, as the |\maketitlepage| % macro handles this for you (see section~\ref{Sec:TitlePage}). % \end{description} % % \section{Writing the paper} % % \subsection{Sections} % % Examination papers may have multiple sections, `numbered' A, B, \ldots. % Rather than redefine the existing section macros, this class defines a new % macro \DescribeMacro{\newsection} |\newsection| that generates a new % section. This macro has one optional parameter which is an instruction or % instructions for answering the questions in the section. The default is % `ANSWER ALL QUESTIONS'. Every section begins on a new page, and the section % title is formatted as `\textbf{\underline{Section A}}', in |\large| size. % % \subsection{Questions} % \label{Sec:Questions} % % If the \textsf{multichoice} option is not specified, \textsf{ouexam} % provides three environments for writing questions: \DescribeEnv{questions} % \textsf{questions}, \DescribeEnv{subquestions} \textsf{subquestions} and % \DescribeEnv{subsubquestions} \textsf{subsubquestions}. These three % environments are actually just defined to be identical to the % \textsf{enumerate} environment, and work in the same manner. The labels for % list items have been redefined so that questions are numbered according to % University formatting requirements. % % Questions must be numbered sequentially throughout the entire paper % regardless of section boundaries. Since it is quite possible to have % multiple \textsf{questions} environments within a document, the class % defines the \DescribeMacro{question} |question| counter, which is % global to the entire document and not reset every time a new % \textsf{questions} environment is started, unlike the |enumi| % counter. The |enumii| and |enumiii| counters are unchanged. % % \changes{1.1}{1999/04/20}{NJS Documented changes to the \cs{marks} macro.} % Each part of a question is worth some number of marks, which needs to be % displayed somewhere after the question. You can specify the number of marks % for a question using the \DescribeMacro{\marks} |\marks| macro, which prints % `(\emph{n} marks)' right-justified on the line. It has a single parameter, % the number of marks, which is added to the \DescribeMacro{marks} |marks| % counter. The macro automatically determines whether to print `mark' or % `marks' as appropriate. Other than right-justifying, the macro does no other % formatting or positioning; how you position the marks relative to a question % is up to you. % % \changes{1.1}{1999/04/20}{NJS Documented changes to the \cs{totalmarks} % macro.} % If you have a question with several sub-parts, each worth some number of % marks, you should display the total number of marks for the question at the % end of the question. You can do this with the \DescribeMacro{\totalmarks} % |\totalmarks| macro, which prints `\textbf{[TOTAL \emph{n} MARKS]} % right-justifed on the line, where \emph{n} is the current value of the % |marks| counter. As with |\marks|, |\totalmarks| determines whether to print % `MARK' or `MARKS' automatically, and does no other formatting or % positioning. The value of the |marks| counter is reset to zero by this % macro. % % \subsubsection{Marking schedule information} % \label{Sec:Questions:Marking} % % \changes{1.2}{1999/10/26}{NJS Documented new \textsf{marking} environment and % \cs{markingschedule} macro.} % Rather than writing a separate marking schedule for an examination paper, you % can use the \DescribeEnv{marking} \textsf{marking} environment to include % marking information with the question. By default this information is not % printed (for obvious reasons!), but when it comes time to print a marking % schedule for the examination, use the \DescribeMacro{\markingschedule} % |\markingschedule| macro in the document preamble to print the hidden content. % % These macros do not apply to multiple-choice examinations (see next section). % % \subsubsection{Multiple-choice questions} % \label{Sec:Questions:MP} % % \changes{1.1}{1999/04/20}{NJS Documented new \textsf{options} environment for % \textsf{multichoice}.} % If the \textsf{multichoice} option to \textsf{ouexam} is specified, you can % still use the \textsf{questions} environment, but the \textsf{subquestions}, % \textsf{subsubquestions} and \textsf{marking} environments, and the % |\markingschedule| macro are not defined, as these are not required in % multiple-choice examinations. Instead, the \DescribeEnv{options} % \textsf{options} environment is defined to allow you to specify the possible % answers for a question. As with the other question environments, this is a % redefinition of the \textsf{enumerate} environment. % % \changes{1.1}{1999/04/20}{NJS Documented new \cs{citem} macro for % \textsf{multichoice}.} % \changes{1.2}{1999/10/26}{NJS Deprecated \cs{citem} macro and introduced % replacement \cs{answer} macro.} % You can specify the correct answer for a question using the % \DescribeMacro{\answer} |\answer|\footnote{Note that this replaces the % \cs{citem} macro from version 1.1. \cs{citem} is deprecated but will still % work for backwards compatibility. New documents should use \cs{answer} % instead.} macro. Normally this is identical to the |\item| macro, but if you % issue a \DescribeMacro{\showanswers} |\showanswers| in the document preamble, % the item label of the correct answer will have a box drawn around it, for % example `\fbox{a)}' instead of `a)'. % % \changes{1.2}{2000/04/14}{NJS Documented new question number style feature.} % You can specify how the question numbers for multiple-choice questions are % drawn using the \DescribeMacro{\qnumberstyle} \cs{qnumberstyle} macro, which % works in a manner analogous to \cs{pagestyle}. There are four question number % styles currently defined: % \begin{description} % \item[\textsf{plain}] No special formatting, e.g.: 3. (the default) % \item[\textsf{bold}] The question number is printed in bold face, e.g.: % \textbf{3.} % \item[\textsf{boxed}] The question number is printed inside a box, e.g.: % \fbox{3.} % \item[\textsf{boxedbold}] The question number is printed in bold face inside % a box, e.g.: \fbox{\textbf{3.}} % \end{description} % There is no special formatting for question numbers in `normal' examinations, % and \cs{qnumberstyle} will only work with the \textsf{multichoice} option % turned on. % % \changes{1.2}{2000/04/14}{NJS Documented new \cs{allabove} and \cs{noneabove} % macros.} % Often a multi-choice question will include an option that says `all of the % above' or `none of the above'. For convenience, the macros % \DescribeMacro{\allabove} \cs{allabove} and \DescribeMacro{\noneabove} % \cs{noneabove} will create these options respectively. \cs{allabove} will produce the string ``All of the above.'', and \cs{noneabove} will produce the string ``None of the above.''. % % \subsection{Generating the title page} % \label{Sec:TitlePage} % % \changes{1.1}{1999/04/20}{NJS Minor changes to title page documentation.} % This class defines a collection of macros that let you fill in the various % parts of the examination title page. This is analogous to the process you % use to generate the title of a document in, for example, the % \textsf{article} class (using |\title|, |\author|, |\date| and % |\maketitle|). That is, you issue the macros described below in the document % preamble, then issue a |\maketitlepage| in the document body. % % The \DescribeMacro{\examyear} |\examyear| macro lets you specify the year % in which the examination is being held, for example, |\examyear{1999}|. This % macro is required. I may look at defaulting this to the current year at some % later stage. % % The \DescribeMacro{\department} |\department| macro lets you specify the % name of the department that produced the examination paper, for example, % |\department{Information| |Science}|. This macro is required. % % The \DescribeMacro{\papernumber} |\papernumber| macro lets you specify the % paper number that the examination is for, for example, % |\papernumber{INFO 211}|. This macro is required. % % \changes{1.1}{1999/04/20}{NJS Documented changes to \cs{papertitle} macro.} % The \DescribeMacro{\papertitle} |\papertitle| macro lets you specify the % title of the paper, for example, % |\papertitle{Systems Analysis and Design Methods}|. This macro is required % for final examinations, and optional for multiple-choice examinations. % % Some papers are offered in both semesters. The \DescribeMacro{\semester} % |\semester| macro lets you specify which semester the examination is for. % The parameter can be either `1' or `2', for example, |\semester{2}|. This % macro is optional --- if you omit it, no semester information is generated. % % The \DescribeMacro{\timeallowed} |\timeallowed| macro lets you specify the % length of the examination in hours, for example, |\timeallowed{2}|. This % macro is optional --- if you omit it, it defaults to three (3) hours. % % If calculators are allowed in the examination, use the % \DescribeMacro{\allowcalculators} |\allowcalculators| macro. This macro is % optional --- if you omit it, a sentence is printed saying that calculators % are \emph{not} allowed. % % The \DescribeMacro{\instructions} |\instructions| macro lets you specify % instructions on how candidates should complete the % examination, for example, |\instructions{Answer ALL| |questions.}|. This macro % is optional. Note that the content of the instructions can be just about % anything. It is up to you to control formatting, such as how you want lines % broken, etc. This also true of the |\material|, |\copiesof| and % |\otherinstructions| macros described below. % % The \DescribeMacro{\material} |\material| macro lets you specify any % additional material that candidates are provided in addition to the % examination paper itself, for example, |\material{SQL schema definition}|. % This macro is optional. % % The \DescribeMacro{\copiesof} |\copiesof| macro lets you specify any % material that candidates are allowed to bring into the examination, for % example, |\copiesof{McFadden &| |Hoffer, 5th edition}|. This macro is % optional. % % The \DescribeMacro{\otherinstructions} |\otherinstructions| macro lets you % specify any other instructions not covered by any of the above, for example, % |\otherinstructions{No smoking| |allowed}|. This macro is optional. % % Once you have specified the content of the title page using the above % macros, you simply issue a \DescribeMacro{\maketitlepage} |\maketitlepage| % to generate the front page of the examination (cf. |\maketitle|). The title % page generated meets University formatting requirements. % % Note that the number of pages in the examination paper is generated % and inserted into the title page automatically --- you do not need to specify % it manually. % % \subsubsection{Title pages for multiple-choice examinations} % \label{Sec:TitlePage:MP} % % \changes{1.1}{1999/04/20}{NJS Documented effect of \textsf{multichoice} on % various title page macros.} % The \textsf{multichoice} option to \textsf{ouexam} does not remove any of % the macros described above, but the following macros will have no effect, as % they are not relevant: % \begin{itemize} % \item |\copiesof| % \item |\material| % \item |\allowcalculators| % \end{itemize} % The |\papertitle| macro becomes optional rather than mandatory. % \changes{1.1}{1999/04/20}{NJS Documented new \cs{testtitle} macro.} % One new macro is also defined, \DescribeMacro{\testtitle} |\testtitle|, % which allows you to specify the title of the test, for example, % |\testtitle{Theory Test}|. This macro is required. % % The title page produced by |\maketitlepage| will also have a different format. % This can be altered by redefining the |\mc@maketitlepage| macro. % % \section{Example} % % \changes{1.1}{1999/04/20}{NJS Updated example to conform to 1.1 changes.} % The code shown below is for a subset of the INFO212 1998 final examination. % The title page produced by this code is shown in figure~\ref{Fig.Output1}, % and the second page of the examination is shown in figure~\ref{Fig.Output2}. % Particular points to note are: % \begin{itemize} % \item This examination has no sections and only one \textsf{questions} % environment, but the usual procedure would be to end any current % \textsf{questions} environment, then issue a |\newsection|. % \item The number of hours is not specified, so it defaults to three. % \item This exam allows calculators. % \item The parameter of the |\instructions|, |\material|, |\copiesof| and % |\other| |instructions| macros can be just about anything, as illustrated % below by the |\material| macro. % \item Formatting within questions is totally under user control, for % example, each question in this examination is terminated with a % linebreak (|\\|) to produce some space between questions. % \end{itemize} % % \begin{verbatim} % \documentclass[12pt]{ouexam} % % \examyear{1998} % \department{INFORMATION SCIENCE} % \papernumber{INFO 212} % \papertitle{Database Design and Management Principles} % \instructions{Answer \underline{ALL} questions.} % \material{Happy Joe SQL schema \\ % Oracle Rdb SQL syntax diagrams for: \\ % \hspace*{1cm} CREATE TRIGGER \\ % \hspace*{1cm} CREATE VIEW } % \allowcalculators % % \begin{document} % % \maketitlepage % % \underline{ANSWER ALL QUESTIONS} \\[\baselineskip] % % \begin{questions} % \item Study the Happy Joe schema supplied with this paper % (see pages~\pageref{start.schema}--\pageref{end.schema}) % and answer the following questions. % \begin{subquestions} % \item Explain fully in English the purpose of the following items % in the schema (see page~\pageref{end.schema}): % \begin{subsubquestions} % \item Trigger \textbf{T1}. \marks{2} \\ % \item Trigger \textbf{T2}. \marks{1} \\ % \item View \textbf{V1}. \marks{1} \\ % \item View \textbf{V2}. \marks{2} \\ % \item View \textbf{V3}. \marks{2} \\ % \item Stored procedure \textbf{P1}. \marks{3} \\ % \end{subsubquestions} % % \item Write SQL code to define a single view that will show all % cars that have travelled more than 80,000 kilometres (or % 50,000 miles for older cars), and which have been sold for % less than their purchase price. (Note: the odometers of older % cars use miles instead of kilometres. The attribute miles\_km % in the Car table contains `K' if the odometer reading is in % kilometres or `M' if it is in miles.) \\ % % The syntax diagram for the CREATE VIEW statement has been % supplied with this paper (see page~\pageref{page.syntax}). \\ % \marks{5} \\ % % \item ... \\ % \end{subquestions} % \totalmarks % . % . % . % \end{questions} % % \end{document} % \end{verbatim} % \normalsize % % \begin{figure} % \fbox{% % \begin{minipage}{\textwidth} % \vspace*{1cm} % \begin{center} % {\large \textbf{UNIVERSITY OF OTAGO EXAMINATIONS 1998}} % \\[0.625\baselineskip] % \fbox{% % \framebox[9.9cm]{% % \begin{tabular}{c} % \\ % {INFORMATION SCIENCE} \\ % \\ % {Paper INFO 212} \\ % \\ % {Database Design and Management Principles} \\ % \\ % \end{tabular}% % }% % } % \mbox{}\\[0.625\baselineskip] % {\small \textbf{(TIME ALLOWED: 3 HOURS)}} % \\[0.625\baselineskip] % \end{center} % \small % \hspace*{1cm}\underline{This examination paper comprises 9 pages} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Candidates should answer questions as % % follows:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % Answer \underline{ALL} questions. % \end{minipage} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{The following material is provided:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % Happy Joe SQL schema \\ % Oracle Rdb SQL syntax diagrams for: \\ % \hspace*{0.625cm} CREATE TRIGGER \\ % \hspace*{0.625cm} CREATE VIEW % \end{minipage} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Use of calculators:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % Electronic calculators may be used in this examination. % \\[0.625\baselineskip] % Please note: where the use of calculators is permitted, these % must be non-pro\-gram\-ma\-ble, hand-held calculators without % alphabetic key pads. % \end{minipage} % \\[0.625\baselineskip] % \mbox{}\hfill(Subject to inspection by the examiners.)\hspace*{1cm} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Candidates are permitted copies of:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % \end{minipage} % \\[0.625\baselineskip] % \mbox{}\hfill(Subject to inspection by the examiners.)\hspace*{1cm} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Other Instructions:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % \end{minipage} % \\[0.75cm] % \mbox{}\hfill\textbf{TURN OVER}\hspace*{1cm} % \vspace*{1cm} % \end{minipage} % } % \caption{Title page produced by \textsf{ouexam}.} % \label{Fig.Output1} % \end{figure} % % \begin{figure} % \fbox{% % \begin{minipage}{\textwidth} % \small % \vspace*{1cm} % \hspace*{1cm}\hfill 2 \hfill INFO 211 \hspace*{1cm} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{ANSWER ALL QUESTIONS} % \\[1cm] % \hspace*{0.8cm} % \begin{minipage}{10cm} % \renewcommand{\labelenumiii}{(\theenumiii)} % \begin{enumerate} % \item Study the Happy Joe schema supplied with this paper (see % pages~6--8) and answer the following questions. % \begin{enumerate} % \item Explain fully in English the purpose of the following % items in the schema (see page~9): % \begin{enumerate} % \item Trigger \textbf{T1}. \hfill (2 marks) % \item Trigger \textbf{T2}. \hfill (1 mark) % \item View \textbf{V1}. \hfill (1 mark) % \item View \textbf{V2}. \hfill (2 marks) % \item View \textbf{V3}. \hfill (2 marks) % \item Stored procedure \textbf{P1}. \hfill (3 marks) % \\[-0.5\baselineskip] % \end{enumerate} % % \item Write SQL code to define a single view that will show % all cars that have travelled more than 80,000 kilometres % (or 50,000 miles for older cars), and which have been sold % for less than their purchase price. (Note: the odometers % of older cars use miles instead of kilometres. The % attribute miles\_km in the Car table contains `K' if the % odometer reading is in kilometres or `M' if it is in % miles.) \\[-0.5\baselineskip] % % The syntax diagram for the CREATE VIEW statement has been % supplied with this paper (see page~9). \\ % \mbox{}\hfill (5 marks) \\[-0.5\baselineskip] % % \item When a feature code is changed in the Feature table, % this change should be automatically cascaded to the % Car\_feature table. Write SQL code to define a trigger % that does this. \\[-0.5\baselineskip] % % The syntax diagram for the CREATE TRIGGER statement has % been supplied with this paper (see page~9). \\ % \mbox{}\hfill (4 marks) \\[-0.5\baselineskip] % \end{enumerate} % \mbox{}\hfill \textbf{[TOTAL 20 MARKS]} % \\[1cm] % \mbox{}\hfill\textbf{TURN OVER} % \vspace*{1cm} % \end{enumerate} % \end{minipage} % \end{minipage} % } % \caption{Second page of the examination paper.} % \label{Fig.Output2} % \end{figure} % % \section{To do} % % \begin{itemize} % \item Add option label styles for multiple-choice questions, for example, % `a)', % `(a)', `A)', `(A)', etc. % \item Add marks for marking schedules in a similar manner to marks % for questions. % \end{itemize} % % % \StopEventually{} % % \section{The code} % % \subsection{Preamble} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1998/06/01] \ProvidesClass{ouexam}% [2000/04/14 v1.2 Otago University examination paper] % \end{macrocode} % % \begin{macro}{multichoice} % \changes{1.1}{1999/04/20}{NJS New class option.} % \begin{macro}{\if@multichoice} % \changes{1.1}{1999/04/20}{NJS New switch for \textsf{multichoice}.} % This document class is based on the \textsf{article} class and accepts any % of the options accepted by \textsf{article}. The only `native' option to % \textsf{ouexam} is \textsf{multichoice}; the |\if@multichoice| switch is used % to determine whether this is in effect (default false). % \begin{macrocode} \newif\if@multichoice \@multichoicefalse \DeclareOption{multichoice}{\@multichoicetrue} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{twoside} % \changes{1.1}{1999/04/20}{NJS Turned off \textsf{twoside} option.} % The \textsf{twoside} option does not really make sense --- all Otago % examination papers are printed single-sided anyway, and the format is such % that two-sided printing would look no different. The \textsf{twoside} option % is therefore not used in this class. % \begin{macrocode} \DeclareOption{twoside}{\OptionNotUsed} % \end{macrocode} % \end{macro} % All other options are passed directly to \textsf{article}. % \begin{macrocode} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions % \end{macrocode} % % \changes{1.1}{1999/04/20}{NJS Changed default point size to 12pt.} % The defaults for this class are \textsf{onecolumn}, \textsf{oneside}, % \textsf{a4paper} and \textsf{12pt}. The font size is the only one that might % change. % \begin{macrocode} \LoadClass[onecolumn,oneside,a4paper,12pt]{article} % \end{macrocode} % % % \subsection{Required packages} % % The required packages are \textsf{calc}, \textsf{ifthen} and % \textsf{verbatim} (for the \textsf{comment} environment), but these may % change. % \begin{macrocode} \RequirePackage{calc} \RequirePackage{ifthen} \RequirePackage{verbatim} % \end{macrocode} % % % \subsection{Page setup} % % \begin{macro}{\oddsidemargin} % \begin{macro}{\topmargin} % \begin{macro}{\textwidth} % \begin{macro}{\textheight} % A4 paper is assumed (since this class is intended only for Otago examination % papers, this seems a reasonable assumption). The margins are top and bottom % 2cm, left and right 2.54cm (1in). This is the only place where the % \textsf{calc} package is used, and could easily be rewritten to not use it. % \begin{macrocode} \setlength{\oddsidemargin}{0cm} \setlength{\topmargin}{-0.54cm} \setlength{\textwidth}{15.9cm} \setlength{\textheight}{25.7cm-\headheight-\headsep-\footskip} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Page styles} % % \begin{macro}{\ps@plain} % The \textsf{plain} page style is the same as that in the \textsf{article} % class, except that it produces pages with the page number centered at the % top, the paper number in the top right corner and the text `\textbf{TURN % OVER}' in the bottom right: % \begin{macrocode} \renewcommand{\ps@plain}{% \renewcommand{\@oddhead}{\hfil\textrm{\thepage}\hfil\@pnumber}% \renewcommand{\@evenhead}{\@oddhead}% \renewcommand{\@oddfoot}{\hfil\textbf{TURN OVER}}% \renewcommand{\@evenfoot}{\@oddfoot}% } % \end{macrocode} % \end{macro} % \textsf{plain} is the default page style. % \begin{macrocode} \pagestyle{plain} % \end{macrocode} % % \begin{macro}{\ps@lastpage} % The \textsf{lastpage} page style is the same as \textsf{plain}, but without % the `\textbf{TURN OVER}': % \begin{macrocode} \newcommand{\ps@lastpage}{% \renewcommand{\@oddhead}{\hfil\textrm{\thepage}\hfil\@pnumber}% \renewcommand{\@evenhead}{\@oddhead}% \renewcommand{\@oddfoot}{}% \renewcommand{\@evenfoot}{\@oddfoot}% } % \end{macrocode} % \end{macro} % This page style should be automatically applied to the last page of the % document. % \begin{macrocode} \AtEndDocument{\thispagestyle{lastpage}} % \end{macrocode} % % \begin{macro}{\ps@titlepage} % The \textsf{titlepage} page style is the same as \textsf{plain}, but without % the header: % \begin{macrocode} \newcommand{\ps@titlepage}{% \renewcommand{\@oddhead}{}% \renewcommand{\@evenhead}{\@oddhead}% \renewcommand{\@oddfoot}{\hfil\textbf{TURN OVER}}% \renewcommand{\@evenfoot}{\@oddfoot}% } % \end{macrocode} % \end{macro} % % % \subsection{Question number styles} % % \begin{macro}{\@drawqnumber} % \changes{1.2}{2000/04/14}{NJS Added \cs{@drawqnumber} macro to facilitate % question number styles for multi-choice examinations.} % Questions numbers in a University final examination have a prescribed % style, but for internal multi-choice examinations, we are free to choose % the style of the question numbers. This can be useful to for multi-choice % examinations in order to clearly distinguish the question numbers from the % surrounding text. This package now supports question number styles for % multi-choice examinations, but not for `normal' examinations. To facilitate % this change, all question numbers are now drawn by the \cs{@drawqnumber} % macro. The default action is to draw the question numbers with no special % formatting. % \begin{macrocode} \newcommand{\@drawqnumber}{\arabic{question}.} % \end{macrocode} % \end{macro} % % \begin{macro}{\qnumberstyle} % \changes{1.2}{2000/04/14}{NJS Added \cs{qnumberstyle} macro to support % question number styles for multi-choice examinations.} % The \cs{qnumberstyle} macro allows us to change the question number style % for all questions in a multi-choice examination (cf. the \cs{pagestyle} % macro). % \begin{macrocode} \if@multichoice \def\qnumberstyle#1{% \@ifundefined{qns@#1}% \undefinedqnumberstyle {\@nameuse{qns@#1}}} % \end{macrocode} % \end{macro} % % The four question number styles currently defined are: % % \begin{macro}{\qns@plain} % \changes{1.2}{2000/04/14}{NJS Added \cs{qns@plain} macro to support question % number styles for multi-choice examinations.} % \begin{macro}{\qns@bold} % \changes{1.2}{2000/04/14}{NJS Added \cs{qns@bold} macro to support question % number styles for multi-choice examinations.} % \begin{macro}{\qns@boxed} % \changes{1.2}{2000/04/14}{NJS Added \cs{qns@boxed} macro to support question % number styles for multi-choice examinations.} % \begin{macro}{\qns@boxedbold} % \changes{1.2}{2000/04/14}{NJS Added \cs{qns@boxedbold} macro to support % question number styles for multi-choice examinations.} % \begin{description} % \item[\textsf{plain}] No formatting: 3. (default) % \item[\textsf{bold}] The question number is printed in bold face: % \textbf{3.} % \item[\textsf{boxed}] The question number is printed inside a box: \fbox{3.} % \item[\textsf{boxedbold}] The question number is printed in bold face inside % a box: \fbox{\textbf{3.}} % \end{description} % \begin{macrocode} \newcommand{\qns@plain}{% \renewcommand{\@drawqnumber}{\arabic{question}.} } \newcommand{\qns@bold}{% \renewcommand{\@drawqnumber}{\textbf{\arabic{question}.}} } \newcommand{\qns@boxed}{% \renewcommand{\@drawqnumber}{\fbox{\arabic{question}.}} } \newcommand{\qns@boxedbold}{% \renewcommand{\@drawqnumber}{\fbox{\textbf{\arabic{question}.}}} } \qnumberstyle{plain} \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Environments and associated items} % % \begin{environment}{questions} % \begin{environment}{subquestions} % \changes{1.1}{1999/04/20}{NJS Now disabled when \textsf{multichoice} is % active.} % \begin{environment}{subsubquestions} % \changes{1.1}{1999/04/20}{NJS Now disabled when \textsf{multichoice} is % active.} % \begin{environment}{marking} % \changes{1.2}{1999/10/26}{NJS New environment for including answers and/or % marking schedule information.} % \begin{environment}{options} % \changes{1.1}{1999/04/20}{NJS New environment for \textsf{multichoice}.} % \begin{macro}{markingschedule} % \changes{1.2}{1999/10/26}{NJS New macro to turn marking information on and % off.} % The \textsf{questions}, \textsf{subsubquestions}, \textsf{subsubquestions} % and \textsf{options} environments are just redefinitions of the % \textsf{enumerate} environment. The \textsf{marking} environment allows the % specification of marking schedule information in the same location as the % questions. Normally \textsf{marking} is just a redefinition of the % \textsf{comment} environment from Rainer Sch\"{o}pf's \textsf{verbatim} % package, i.e., marking information is not printed. The |\markingschedule| % macro is used to enable printing of marking information. At present, this is % printed in italics. % % Note that a straight redefinition of \textsf{comment} to \textsf{marking} does % not work --- the code below is taken directly from the \textsf{verbatim} % package. % % If \textsf{multichoice} is not set, then \textsf{questions}, % \textsf{subquestions}, \textsf{subsubquestions} and \textsf{marking} are % available. If \textsf{multichoice} is set, then \textsf{questions} and % \textsf{options} are available. % \begin{macrocode} \newenvironment{questions}{\begin{enumerate}}{\end{enumerate}} \if@multichoice \newenvironment{options}{\begin{enumerate}}{\end{enumerate}} \else \newenvironment{subquestions}{\begin{enumerate}}{\end{enumerate}} \newenvironment{subsubquestions}{\begin{enumerate}}{\end{enumerate}} \def\marking{\@bsphack \let\do\@makeother\dospecials\catcode`\^^M\active \let\verbatim@startline\relax \let\verbatim@addtoline\@gobble \let\verbatim@processline\relax \let\verbatim@finish\relax \verbatim@} \let\endmarking=\@esphack \newcommand{\markingschedule}{% \renewenvironment{marking}{\itshape}{\normalfont}} \fi % \end{macrocode} % \end{macro} % \end{environment} % \end{environment} % \end{environment} % \end{environment} % \end{environment} % % \begin{macro}{\answer} % \changes{1.2}{1999/10/26}{NJS The \cs{answer} macro replaces the \cs{citem} % macro.} % \begin{macro}{\citem} % \changes{1.1}{1999/04/20}{NJS New macro for \textsf{options} environment.} % The |\answer| or |\citem| macros are used to indicate the correct answer for a % multiple-choice question (they are identical). |\citem| is deprecated but will % continue to work for backwards compatibilty. If a |\showanswers| has not been % issued in the document preamble (see below), then both of these macros are % identical to |\item|. % \begin{macrocode} \if@multichoice \def\answer{% \@inmatherr\item \@ifnextchar [\@item{\@noitemargtrue \@item[\@itemlabel]}} \newcommand{\citem}{% \ClassWarning{ouexam}{\protect\citem\space is deprecated % --- it will still work, but you should use % \protect\answer\space instead}\@eha \answer} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\showanswers} % \changes{1.1}{1999/04/20}{NJS New macro for \textsf{multichoice}.} % \changes{1.2}{1999/10/26}{NJS Updated for new \cs{answer} macro.} % Issuing the |\showanswers| macro in the document preamble redefines |\answer| % so that a box is drawn around the label of the correct answer, for example % `\fbox{b)}'. % \begin{macrocode} \newcommand{\showanswers}{% \renewcommand{\answer}{% \@inmatherr\item \@ifnextchar [\@item{\@noitemargtrue \@item[\fbox{\@itemlabel}]}}} % \end{macrocode} % \end{macro} % % \begin{macro}{\allabove} % \begin{macro}{\noneabove} % \changes{1.2}{2000/04/14}{NJS Added new \cs{allabove} and \cs{noneabove} % macros.} % Issuing the \cs{allabove} macro causes the string ``All of the above.'' to be % printed. Similarly, the \cs{noneabove} macro causes the string ``None of the % above.'' to be printed. % \begin{macrocode} \newcommand{\allabove}{All of the above.} \newcommand{\noneabove}{None of the above.} \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{question} % We cannot use the |enumi| counter for the \textsf{questions} environment % because |enumi| would get reset every time we start a new \textsf{questions} % environment. We therefore need a separate counter: % \begin{macrocode} \newcounter{question} % \end{macrocode} % \end{macro} % % \begin{macro}{marks} % \changes{1.1}{1999/04/20}{NJS New counter for calculating question marks.} % If \textsf{multichoice} is not set, we need to keep track of the total % number of marks for each question. The |marks| counter is used for this % purpose. It is reset to zero every time a |\totalmarks| macro is issued. % \begin{macrocode} \if@multichoice \else \newcounter{marks} \setcounter{marks}{0} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\labelenumi} % \changes{1.1}{1999/04/20}{NJS Changed so that it prints differently when % \textsf{multichoice} is in effect.} % \changes{1.2}{2000/04/14}{NJS Updated to use the new question number label % styles.} % There are certain formats for numbering questions that need to be adhered % to. We therefore need to redefine the label-generating macros slightly. In % particular, we need to redefine |\labelenumi| so that it uses the new % |question| counter. For multiple-choice examinations, the question number is % drawn using the currently defined question number label style. The default is % to draw the number in bold face in order to distinguish it from the % surrounding text. % \begin{macrocode} \if@multichoice \renewcommand{\labelenumi}{% \refstepcounter{question} \@drawqnumber } % \end{macrocode} % For final examinations, the question number is drawn normally. % \begin{macrocode} \else \renewcommand{\labelenumi}{% \refstepcounter{question} \arabic{question}. } \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\labelenumii} % \changes{1.1}{1999/04/20}{NJS Changes to list labels are now contingent on % \textsf{multichoice}.} % For multiple-choice examinations, we arbitrarily define the format for the % question numbers for answer labels as `a)', `b)', \ldots. Future versions of % this class may make this configurable. % \begin{macrocode} \if@multichoice \renewcommand{\labelenumii}{\alph{enumii})} % \end{macrocode} % \end{macro} % % \begin{macro}{\p@enumii} % \begin{macro}{\p@enumiii} % \begin{macro}{\labelenumiii} % For final examinations, the University requires that questions be numbered % as `1.', `2.', \ldots, sub-questions be numbered as `(a)', `(b)', \ldots, % and sub-sub-questions be numbered as `(i)', `(ii)', \ldots. We also redefine % |\p@enumii| and |\p@enumiii| to make referring to other parts of questions % slightly tidier (for example, `see part (a) above' versus `see part 1(a) % above'). % \begin{macrocode} \else \renewcommand{\p@enumii}{} \renewcommand{\p@enumiii}{(\theenumii)} \renewcommand{\labelenumiii}{(\roman{enumiii})} \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsection{Miscellaneous macros} % % \begin{macro}{\newsection} % The |\newsection| macro generates a new examination section, appropriately % numbered. The optional parameter contains instructions for answering the % questions in the new section, and defaults to `ANSWER ALL QUESTIONS'. % \begin{macrocode} \newcommand{\newsection}[1][ANSWER ALL QUESTIONS.]{% % \end{macrocode} % Every section begins on a new page. % \begin{macrocode} \newpage % \end{macrocode} % The section title is formatted as `\textbf{\underline{Section A}}', in % |\large| size. Note that sections are `numbered' A, B, \ldots. % \begin{macrocode} \refstepcounter{section} {\large\noindent\textbf{\underline{Section~\Alph{section}}}} \\[0.5\baselineskip] #1 } % \end{macrocode} % \end{macro} % % \begin{macro}{\marks} % \changes{1.1}{1999/04/20}{NJS This macro now increments the \texttt{marks} % counter.} % The |\marks| macro specifies the number of marks for a question, and prints % it right-justified on the line as `(\emph{n} marks)', where \emph{n} is % passed as a parameter to the macro. It uses \textsf{ifthenelse} to determine % whether to print `mark' or `marks', based on the value of the parameter. The % number of marks is added to the |marks| counter. % \begin{macrocode} \newcommand{\marks}[1]{% \mbox{}\hfill (#1~\ifthenelse{#1=1}{mark}{marks}) \addtocounter{marks}{#1} } % \end{macrocode} % \end{macro} % % \begin{macro}{\totalmarks} % \changes{1.1}{1999/04/20}{NJS Removed the parameter for the number of marks; % this is now retrieved from the \texttt{marks} counter.} % The |\totalmarks| macro calculates the total marks for a question that % comprises several sub-parts, and prints it out right-justified on the line % as `\textbf{[TOTAL \emph{n} MARKS]}, where \emph{n} is is the value of the % |marks| counter. to the macro. As with |\marks|, |\totalmarks| determines % whether to print `MARK' or `MARKS' automatically. Note that the |marks| % counter is reset to zero by this macro. % \begin{macrocode} \newcommand{\totalmarks}{% \mbox{}\hfill \textbf{[TOTAL \themarks~\ifthenelse{\themarks=1}{MARK}{MARKS}]} \setcounter{marks}{0} } % \end{macrocode} % \end{macro} % % \subsection{Title page macros} % % \begin{macro}{\examyear} % \begin{macro}{\@year} % The |\examyear| macro specifies the year in which the examination is being % held. It redefines the |\@year| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\examyear}{\renewcommand{\@year}} % \end{macrocode} % This macro is required: % \begin{macrocode} \newcommand{\@year}{% \ClassError{ouexam}{No \protect\examyear\space given}\@eha } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\department} % \begin{macro}{\@dept} % The |\department| macro specifies the name of the department, and is required. % It redefines the |\@dept| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\department}{\renewcommand{\@dept}} \newcommand{\@dept}{% \ClassError{ouexam}{No \protect\department\space given}\@eha } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\papernumber} % \begin{macro}{\@pnumber} % The |\papernumber| macro specifies the paper number, and is required. % It redefines the |\@pnumber| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\papernumber}{\renewcommand{\@pnumber}} \newcommand{\@pnumber}{% \ClassError{ouexam}{No \protect\papernumber\space given}\@eha } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\papertitle} % \begin{macro}{\@ptitle} % \changes{1.1}{1999/04/20}{NJS Made this macro optional under % \textsf{multichoice}.} % The |\papertitle| macro specifies the title of the paper. It is required for % final examinations, but optional for multiple-choice examinations. % It redefines the |\@ptitle| macro which is used in |\maketitlepage|: % \begin{macrocode} \if@multichoice \newcommand{\papertitle}{\renewcommand{\@ptitle}} \newcommand{\@ptitle}{} \else \newcommand{\papertitle}{\renewcommand{\@ptitle}} \newcommand{\@ptitle}{% \ClassError{ouexam}{No \protect\papertitle\space given}\@eha } \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\semester} % \begin{macro}{\@semester} % The |\semester| macro specifies which semester the examination is for. Legal % values for the parameter are `1' or `2'. This macro uses \textsf{ifthenelse}. % It redefines the |\@semester| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\semester}[1]{% \ifthenelse{#1=1}% {\renewcommand{\@semester}{Semester One \\}}% {\renewcommand{\@semester}{Semester Two \\}} } % \end{macrocode} % \changes{1.1}{1999/04/20}{NJS Updated slightly for \textsf{multichoice}.} % |\semester| is optional --- if you omit it, |\@semester| remains empty. Note % the slight difference for \textsf{multichoice}, which ensures there is % always a something there: % \begin{macrocode} \if@multichoice \newcommand{\@semester}{\mbox{}} \else \newcommand{\@semester}{} \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\timeallowed} % \begin{macro}{\@hours} % The |\timeallowed| macro specifies the length of the examination in hours. % It redefines the |\@hours| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\timeallowed}{\renewcommand{\@hours}} % \end{macrocode} % |\timeallowed| is optional --- if you omit it, |\@hours| defaults to three: % \begin{macrocode} \newcommand{\@hours}{3} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{num.pages} % \changes{1.1}{1999/04/20}{NJS Renamed label from \texttt{page.last}.} % There is no macro to specify the number of pages in the examination because % it is done automatically by inserting a |\newlabel| that refers to the last % page directly into the |.aux| file: % \begin{macrocode} \AtEndDocument{% \immediate\write\@auxout{% \string\newlabel{num.pages}{{}{\thepage}} } } % \end{macrocode} % This label is then referenced in |\maketitlepage|. % \end{macro} % % \begin{macro}{num.questions} % \changes{1.1}{1999/04/20}{NJS New label representing the number of questions.} % Similarly, there is no macro to specify the number of questions in the % examination. This is calculated using the same method as for the number of % pages: % \begin{macrocode} \AtEndDocument{% \immediate\write\@auxout{% \string\newlabel{num.questions}{{}{\thequestion}} } } % \end{macrocode} % \end{macro} % % \begin{macro}{\instructions} % \begin{macro}{\@instructions} % The |\instructions| macro specifies instructions on how candidates should % answer questions, and is optional. It redefines the |\@instructions| macro % which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@instructions}{} \newcommand{\instructions}[1]{\renewcommand{\@instructions}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\material} % \begin{macro}{\@material} % The |\material| macro lets specifies any additional material that candidates % are provided in addition to the examination paper itself, and is optional. % It redefines the |\@material| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@material}{} \newcommand{\material}[1]{\renewcommand{\@material}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\allowcalculators} % \begin{macro}{\@calculators} % The |\allowcalculators| macro specifies whether or not calculators are % allowed in the examination. If |\allowcalculators| is omitted, |\@calculators| % defaults to `may not': % \begin{macrocode} \newcommand{\@calculators}{may not} % \end{macrocode} % Issuing |\allowcalculators| changes the redefines |\@calculators| to `may': % \begin{macrocode} \newcommand{\allowcalculators}{\renewcommand{\@calculators}{may}} % \end{macrocode} % |\@calculators| is used in |\maketitlepage|. % \end{macro} % \end{macro} % % \begin{macro}{\copiesof} % \begin{macro}{\@copiesof} % The |\copiesof| macro specifies any material that candidates are allowed to % bring into the examination, and is optional. It redefines the |\@copiesof| % macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@copiesof}{} \newcommand{\copiesof}[1]{\renewcommand{\@copiesof}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\otherinstructions} % \begin{macro}{\@otherinst} % The |\otherinstructions| macro specifies any other instructions not covered % by any of the above, and is optional. It redefines the |\@otherinst| % macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@otherinst}{} \newcommand{\otherinstructions}[1]{\renewcommand{\@otherinst}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\testtitle} % \begin{macro}{\@ttitle} % \changes{1.1}{1999/04/20}{NJS New macro.} % The |\testtitle| macro specifies the title of the test for a multiple-choice % examination, and is required. It redefines the |\@ttitle| macro which is % used in |\mc@maketitlepage|: % \begin{macrocode} \if@multichoice \newcommand{\testtitle}{\renewcommand{\@ttitle}} \newcommand{\@ttitle}{% \ClassError{ouexam}{No \protect\testtitle\space given}\@eha } \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\maketitlepage} % \changes{1.1}{1999/04/20}{NJS Redefined to take account of % \textsf{multichoice}.} % The |\maketitlepage| macro is the \textsf{ouexam} analogue of |\maketitle|. % It takes all of the information provided by the above macros and generates a % properly formatted examination title page. If the \textsf{multichoice} % option is used, the title page will be different, and some of the macros % described above will have no effect. If you want to design your own title % page styles, redefine |\mc@maketitlepage| for multiple choice examinations, % and |\final@maketitlepage| for `conventional' final examinations. (I would % not normally recommend redefining |\final@maketitlepage|.) % \begin{macrocode} \if@multichoice \newcommand{\maketitlepage}{\mc@maketitlepage} \else \newcommand{\maketitlepage}{\final@maketitlepage} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\final@maketitlepage} % \changes{1.1}{1999/04/20}{NJS Renamed macro from \cs{maketitlepage}.} % The |\final@maketitlepage| macro generates an examination title page that % meets the Otago University requirements for final examination papers. You % can redefine this if you want to change the format, but normally you would % not do this. % \begin{macrocode} \newcommand{\final@maketitlepage}{% \thispagestyle{titlepage} % \end{macrocode} % The header information for the examination is printed centered at the top % of the page. The department, paper number and paper title (and the semester % information if required) are placed inside a double box. % \begin{macrocode} \begin{center} {\Large \textbf{UNIVERSITY OF OTAGO EXAMINATIONS \@year}} \\[\baselineskip] \fbox{% \framebox[\linewidth]{% \begin{tabular}{c} \\ {\large \@dept} \\ \\ {\large Paper \@pnumber} \\ \\ {\large \@ptitle} \\ \@semester \\ \end{tabular}% }% } \mbox{}\\[\baselineskip] % \end{macrocode} % Next, the time allowed for completing the examination: % \begin{macrocode} \textbf{(TIME ALLOWED: \@hours\ HOURS)} \\[\baselineskip] \end{center} % \end{macrocode} % The number of pages is automatically calculated, as descibed earlier. All we % need to do is reference the |num.pages| label that we put into the |.aux| % file: % \begin{macrocode} \underline{This examination paper comprises % \pageref{num.pages} pages} \\[\baselineskip] % \end{macrocode} % Print out the instructions for answering questions: % \begin{macrocode} \underline{Candidates should answer questions as follows:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@instructions \end{minipage} \\[\baselineskip] % \end{macrocode} % Print out any provided material: % \begin{macrocode} \underline{The following material is provided:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@material \end{minipage} \\[\baselineskip] % \end{macrocode} % Print out use of calculators section: % \begin{macrocode} \underline{Use of calculators:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} Electronic calculators \@calculators\ be used in this examination. \\[\baselineskip] Please note: where the use of calculators is permitted, these must be non-pro\-gram\-ma\-ble, hand-held calculators without alphabetic key pads. \end{minipage} \\[\baselineskip] \mbox{}\hfill (Subject to inspection by the examiners.) \\[\baselineskip] % \end{macrocode} % Print out anything that candidates are allowed to bring: % \begin{macrocode} \underline{Candidates are permitted copies of:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@copiesof \end{minipage} \\[\baselineskip] \mbox{}\hfill (Subject to inspection by the examiners.) \\[\baselineskip] % \end{macrocode} % Print out other instructions, and finish. % \begin{macrocode} \underline{Other Instructions:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@otherinst \end{minipage} \\[\baselineskip] \newpage } % \end{macrocode} % \end{macro} % % \begin{macro}{\mc@maketitlepage} % \changes{1.1}{1999/04/20}{NJS New macro for \textsf{multichoice}.} % The |\mc@maketitlepage| macro generates an examination title page that for a % multiple-choice examination paper. There is no prescribed format for this, % so you are free to redefine this macro if the default format does not meet % your requirements. % \begin{macrocode} \newcommand{\mc@maketitlepage}{% \thispagestyle{titlepage} \large\mbox{}\vfill % \end{macrocode} % The title and preamble information is centered on the page in a box: % \begin{macrocode} \begin{center} \fbox% { \Huge \begin{tabular}{>{\bfseries}c<{\normalfont}} \@dept\ Paper \@pnumber \\ \\ \@ttitle\ \@semester\ \@year \\ \end{tabular} } \vfill This test comprises \pageref{num.questions} multiple choice questions and is \pageref{num.pages} pages long. \\[\baselineskip] % \end{macrocode} % General instructions for answering questions are printed next. We need the % |\mbox| just in case the instructions are empty: % \begin{macrocode} \mbox{}\@instructions \\[\baselineskip] \vfill % \end{macrocode} % followed by an other instructions: % \begin{macrocode} \mbox{}\@otherinst \\[\baselineskip] \end{center} \vfill\mbox{} \newpage } % \end{macrocode} % \end{macro} % % \Finale % % \PrintChanges
\def\filedate{20 April 1999} \def\fileversion{1.1} % \iffalse meta-comment %% %% ouexam.dtx Copyright 1999 Nigel Stanger %% %% You may use this package freely, and also distribute it %% provided that you don't change it, make any money off %% it or pretend that you wrote it. %% %<*driver> \documentclass{ltxdoc} \usepackage{doc} \DisableCrossrefs \CodelineNumbered \RecordChanges \title{The \textsf{ouexam} document class, v\fileversion} \author{Nigel Stanger\\nstanger@infoscience.otago.ac.nz} \date{\filedate} \begin{document} \maketitle \DocInput{ouexam.dtx} \end{document} %</driver> % % \fi % %% \CheckSum{490} %% %% \CharacterTable %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z %% Digits \0\1\2\3\4\5\6\7\8\9 %% Exclamation \! Double quote \" Hash (number) \# %% Dollar \$ Percent \% Ampersand \& %% Acute accent \' Left paren \( Right paren \) %% Asterisk \* Plus \+ Comma \, %% Minus \- Point \. Solidus \/ %% Colon \: Semicolon \; Less than \< %% Equals \= Greater than \> Question mark \? %% Commercial at \@ Left bracket \[ Backslash \\ %% Right bracket \] Circumflex \^ Underscore \_ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %% % % \MakeShortVerb{\|} % % \changes{1.0}{1999/04/15}{Initial version.} % % \begin{abstract} % This document class allows you to create Otago University final % examination papers using \LaTeXe\@. It implements the major formatting % requirements specified by the University and also provides some useful % macros to ease the process of building the title page and automatically % deals with fiddly little issues such as question and section numbering, % the number of pages in the paper, printing `\textbf{TURN OVER}' in the % bottom right corner of every page except the last one and adding up the % total number of marks for a question. % \end{abstract} % % \section{Introduction} % % \subsection{Class options} % % This document class is based on the \textsf{article} class and accepts any of % the options accepted by \textsf{article}. The default options are % \textsf{onecolumn}, \textsf{oneside}, \textsf{a4paper} and \textsf{12pt}. % Normally the only one you might want to change is the last one. % % \changes{1.1}{1999/04/20}{Documented \textsf{multichoice} class option.} % The only `native' option recognised by \textsf{ouexam} is % \DescribeMacro{multichoice} \textsf{multichoice}, which tells % \textsf{ouexam} to format the examination paper as a multiple-choice % examination. The title page format is different, and several of the title % page macros have no effect when this option is specified. The % \textsf{multichoice} option also defines some additional macros that are % useful for multiple-choice examination papers. See % sections~\ref{Sec:Questions:MP} and~\ref{Sec:TitlePage:MP}. % % \subsection{Required packages} % % This class currently requires the \textsf{calc} and \textsf{ifthen} % packages. I may look at removing the requirement for these in a % later version, as neither of them are that essential. % % \subsection{Page margins} % % This class assumes A4 paper. You will probably get weird results if you try % to do anything different. The margins are set up as follows: top and bottom % 2cm (headers and footers are inside this margin), left and right 2.54cm (1in). % % \subsection{Page styles} % % There are three main page styles in this class: % \begin{description} % \item[\textsf{plain}] \DescribeMacro{plain} This is a slight modification of % the \textsf{plain} page style from \textsf{article}. It produces pages that % have the page number centered at the top, the paper number in the top right % corner and the text `\textbf{TURN OVER}' in the bottom right. This is the % default page style. % \item[\textsf{lastpage}] \DescribeMacro{lastpage} This is the same as % \textsf{plain}, but without the `\textbf{TURN OVER}'. This is used for the % last page of the examination. You normally will not have to use this % yourself --- the class should take care of it for you. I have managed to % confuse it in the past, however, so there may be odd occasions where you % have to set the page style of the last page manually. It will be fairly % obvious when you need to do this. % \item[\textsf{titlepage}] \DescribeMacro{titlepage} This is the same as % \textsf{plain}, but without the page header, and is used for the title page. % Again, you will normally not use this yourself, as the |\maketitlepage| % macro handles this for you (see section~\ref{Sec:TitlePage}). % \end{description} % % \section{Writing the paper} % % \subsection{Sections} % % Examination papers may have multiple sections, `numbered' A, B, \ldots. % Rather than redefine the existing section macros, this class defines a new % macro \DescribeMacro{\newsection} |\newsection| that generates a new % section. This macro has one optional parameter which is an instruction or % instructions for answering the questions in the section. The default is % `ANSWER ALL QUESTIONS'. Every section begins on a new page, and the section % title is formatted as `\textbf{\underline{Section A}}', in |\large| size. % % \subsection{Questions} % \label{Sec:Questions} % % If the \textsf{multichoice} option is not specified, \textsf{ouexam} % provides three environments for writing questions: \DescribeEnv{questions} % \textsf{questions}, \DescribeEnv{subquestions} \textsf{subquestions} and % \DescribeEnv{subsubquestions} \textsf{subsubquestions}. These three % environments are actually just defined to be identical to the % \textsf{enumerate} environment, and work in the same manner. The labels for % list items have been redefined so that questions are numbered according to % University formatting requirements. % % Questions must be numbered sequentially throughout the entire paper % regardless of section boundaries. Since it is quite possible to have % multiple \textsf{questions} environments within a document, the class % defines the \DescribeMacro{question} |question| counter, which is % global to the entire document and not reset every time a new % \textsf{questions} environment is started, unlike the |enumi| % counter. The |enumii| and |enumiii| counters are unchanged. % % \changes{1.1}{1999/04/20}{Documented changes to the \cs{marks} macro.} % Each part of a question is worth some number of marks, which needs to be % displayed somewhere after the question. You can specify the number of marks % for a question using the \DescribeMacro{\marks} |\marks| macro, which prints % `(\emph{n} marks)' right-justified on the line. It has a single parameter, % the number of marks, which is added to the \DescribeMacro{marks} |marks| % counter. The macro automatically determines whether to print `mark' or % `marks' as appropriate. Other than right-justifying, the macro does no other % formatting or positioning; how you position the marks relative to a question % is up to you. % % \changes{1.1}{1999/04/20}{Documented changes to the \cs{totalmarks} macro.} % If you have a question with several sub-parts, each worth some number of % marks, you should display the total number of marks for the question at the % end of the question. You can do this with the \DescribeMacro{\totalmarks} % |\totalmarks| macro, which prints `\textbf{[TOTAL \emph{n} MARKS]} % right-justifed on the line, where \emph{n} is the current value of the % |marks| counter. As with |\marks|, |\totalmarks| determines whether to print % `MARK' or `MARKS' automatically, and does no other formatting or % positioning. The value of the |marks| counter is reset to zero by this % macro. % % \subsubsection{Multiple-choice questions} % \label{Sec:Questions:MP} % % \changes{1.1}{1999/04/20}{Documented new \textsf{options} environment for % \textsf{multichoice}.} % If the \textsf{multichoice} option to \textsf{ouexam} is specified, you can % still use the \textsf{questions} environment, but the \textsf{subquestions} % and \textsf{subsubquestions} are not defined, as these are not required in % multiple-choice examinations. Instead, the \DescribeEnv{options} % \textsf{options} environment is defined to allow you to specify the possible % answers for a question. As with the other question environments, this is a % redefinition of the \textsf{enumerate} environment. % % \changes{1.1}{1999/04/20}{Documented new \cs{citem} macro for % \textsf{multichoice}.} % You can specify the correct answer for a question using the % \DescribeMacro{\citem} |\citem| macro. Normally this is identical to the % |\item| macro, but if you issue a \DescribeMacro{\showanswers} % |\showanswers| in the document preamble, the item label of the correct % answer will have a box drawn around it, for example `\fbox{a)}' instead of % `a)'. % % There is no control at present over the formatting of question numbers or % option labels. These may be added later. % % \subsection{Generating the title page} % \label{Sec:TitlePage} % % \changes{1.1}{1999/04/20}{Minor changes to title page documentation.} % This class defines a collection of macros that let you fill in the various % parts of the examination title page. This is analogous to the process you % use to generate the title of a document in, for example, the % \textsf{article} class (using |\title|, |\author|, |\date| and % |\maketitle|). That is, you issue the macros described below in the document % preamble, then issue a |\maketitlepage| in the document body. % % The \DescribeMacro{\examyear} |\examyear| macro lets you specify the year % in which the examination is being held, for example, |\examyear{1999}|. This % macro is required. I may look at defaulting this to the current year at some % later stage. % % The \DescribeMacro{\department} |\department| macro lets you specify the % name of the department that produced the examination paper, for example, % |\department{Information| |Science}|. This macro is required. % % The \DescribeMacro{\papernumber} |\papernumber| macro lets you specify the % paper number that the examination is for, for example, % |\papernumber{INFO 211}|. This macro is required. % % \changes{1.1}{1999/04/20}{Documented changes to \cs{papertitle} macro.} % The \DescribeMacro{\papertitle} |\papertitle| macro lets you specify the % title of the paper, for example, % |\papertitle{Systems Analysis and Design Methods}|. This macro is required % for final examinations, and optional for multiple-choice examinations. % % Some papers are offered in both semesters. The \DescribeMacro{\semester} % |\semester| macro lets you specify which semester the examination is for. % The parameter can be either `1' or `2', for example, |\semester{2}|. This % macro is optional --- if you omit it, no semester information is generated. % % The \DescribeMacro{\timeallowed} |\timeallowed| macro lets you specify the % length of the examination in hours, for example, |\timeallowed{2}|. This % macro is optional --- if you omit it, it defaults to three (3) hours. % % If calculators are allowed in the examination, use the % \DescribeMacro{\allowcalculators} |\allowcalculators| macro. This macro is % optional --- if you omit it, a sentence is printed saying that calculators % are \emph{not} allowed. % % The \DescribeMacro{\instructions} |\instructions| macro lets you specify % instructions on how candidates should complete the % examination, for example, |\instructions{Answer ALL| |questions.}|. This macro % is optional. Note that the content of the instructions can be just about % anything. It is up to you to control formatting, such as how you want lines % broken, etc. This also true of the |\material|, |\copiesof| and % |\otherinstructions| macros described below. % % The \DescribeMacro{\material} |\material| macro lets you specify any % additional material that candidates are provided in addition to the % examination paper itself, for example, |\material{SQL schema definition}|. % This macro is optional. % % The \DescribeMacro{\copiesof} |\copiesof| macro lets you specify any % material that candidates are allowed to bring into the examination, for % example, |\copiesof{McFadden &| |Hoffer, 5th edition}|. This macro is % optional. % % The \DescribeMacro{\otherinstructions} |\otherinstructions| macro lets you % specify any other instructions not covered by any of the above, for example, % |\otherinstructions{No smoking| |allowed}|. This macro is optional. % % Once you have specified the content of the title page using the above % macros, you simply issue a \DescribeMacro{\maketitlepage} |\maketitlepage| % to generate the front page of the examination (cf. |\maketitle|). The title % page generated meets University formatting requirements. % % Note that the number of pages in the examination paper is generated % and inserted into the title page automatically --- you do not need to specify % it manually. % % \subsubsection{Title pages for multiple-choice examinations} % \label{Sec:TitlePage:MP} % % \changes{1.1}{1999/04/20}{Documented effect of \textsf{multichoice} on % various title page macros.} % The \textsf{multichoice} option to \textsf{ouexam} does not remove any of % the macros described above, but the following macros will have no effect, as % they are not relevant: % \begin{itemize} % \item |\copiesof| % \item |\material| % \item |\allowcalculators| % \end{itemize} % The |\papertitle| macro becomes optional rather than mandatory. % \changes{1.1}{1999/04/20}{Documented new \cs{testtitle} macro.} % One new macro is also defined, \DescribeMacro{\testtitle} |\testtitle|, % which allows you to specify the title of the test, for example, % |\testtitle{Theory Test}|. This macro is required. % % The title page produced by |\maketitlepage| will also have a different format. % This can be altered by redefining the |\mc@maketitlepage| macro. % % \section{Example} % % \changes{1.1}{1999/04/20}{Updated example to conform to 1.1 changes.} % The code shown below is for a subset of the INFO212 1998 final examination. % The title page produced by this code is shown in figure~\ref{Fig.Output1}, % and the second page of the examination is shown in figure~\ref{Fig.Output2}. % Particular points to note are: % \begin{itemize} % \item This examination has no sections and only one \textsf{questions} % environment, but the usual procedure would be to end any current % \textsf{questions} environment, then issue a |\newsection|. % \item The number of hours is not specified, so it defaults to three. % \item This exam allows calculators. % \item The parameter of the |\instructions|, |\material|, |\copiesof| and % |\other| |instructions| macros can be just about anything, as illustrated % below by the |\material| macro. % \item Formatting within questions is totally under user control, for % example, each question in this examination is terminated with a % linebreak (|\\|) to produce some space between questions. % \end{itemize} % % \begin{verbatim} % \documentclass[12pt]{ouexam} % % \examyear{1998} % \department{INFORMATION SCIENCE} % \papernumber{INFO 212} % \papertitle{Database Design and Management Principles} % \instructions{Answer \underline{ALL} questions.} % \material{Happy Joe SQL schema \\ % Oracle Rdb SQL syntax diagrams for: \\ % \hspace*{1cm} CREATE TRIGGER \\ % \hspace*{1cm} CREATE VIEW } % \allowcalculators % % \begin{document} % % \maketitlepage % % \underline{ANSWER ALL QUESTIONS} \\[\baselineskip] % % \begin{questions} % \item Study the Happy Joe schema supplied with this paper % (see pages~\pageref{start.schema}--\pageref{end.schema}) % and answer the following questions. % \begin{subquestions} % \item Explain fully in English the purpose of the following items % in the schema (see page~\pageref{end.schema}): % \begin{subsubquestions} % \item Trigger \textbf{T1}. \marks{2} \\ % \item Trigger \textbf{T2}. \marks{1} \\ % \item View \textbf{V1}. \marks{1} \\ % \item View \textbf{V2}. \marks{2} \\ % \item View \textbf{V3}. \marks{2} \\ % \item Stored procedure \textbf{P1}. \marks{3} \\ % \end{subsubquestions} % % \item Write SQL code to define a single view that will show all % cars that have travelled more than 80,000 kilometres (or % 50,000 miles for older cars), and which have been sold for % less than their purchase price. (Note: the odometers of older % cars use miles instead of kilometres. The attribute miles\_km % in the Car table contains `K' if the odometer reading is in % kilometres or `M' if it is in miles.) \\ % % The syntax diagram for the CREATE VIEW statement has been % supplied with this paper (see page~\pageref{page.syntax}). \\ % \marks{5} \\ % % \item ... \\ % \end{subquestions} % \totalmarks % . % . % . % \end{questions} % % \end{document} % \end{verbatim} % \normalsize % % \begin{figure} % \fbox{% % \begin{minipage}{\textwidth} % \vspace*{1cm} % \begin{center} % {\large \textbf{UNIVERSITY OF OTAGO EXAMINATIONS 1998}} % \\[0.625\baselineskip] % \fbox{% % \framebox[9.9cm]{% % \begin{tabular}{c} % \\ % {INFORMATION SCIENCE} \\ % \\ % {Paper INFO 212} \\ % \\ % {Database Design and Management Principles} \\ % \\ % \end{tabular}% % }% % } % \mbox{}\\[0.625\baselineskip] % {\small \textbf{(TIME ALLOWED: 3 HOURS)}} % \\[0.625\baselineskip] % \end{center} % \small % \hspace*{1cm}\underline{This examination paper comprises 9 pages} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Candidates should answer questions as % % follows:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % Answer \underline{ALL} questions. % \end{minipage} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{The following material is provided:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % Happy Joe SQL schema \\ % Oracle Rdb SQL syntax diagrams for: \\ % \hspace*{0.625cm} CREATE TRIGGER \\ % \hspace*{0.625cm} CREATE VIEW % \end{minipage} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Use of calculators:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % Electronic calculators may be used in this examination. % \\[0.625\baselineskip] % Please note: where the use of calculators is permitted, these % must be non-pro\-gram\-ma\-ble, hand-held calculators without % alphabetic key pads. % \end{minipage} % \\[0.625\baselineskip] % \mbox{}\hfill(Subject to inspection by the examiners.)\hspace*{1cm} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Candidates are permitted copies of:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % \end{minipage} % \\[0.625\baselineskip] % \mbox{}\hfill(Subject to inspection by the examiners.)\hspace*{1cm} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{Other Instructions:} % \\[0.625\baselineskip] % \hspace*{1.625cm} % \begin{minipage}{8.4cm} % \end{minipage} % \\[0.75cm] % \mbox{}\hfill\textbf{TURN OVER}\hspace*{1cm} % \vspace*{1cm} % \end{minipage} % } % \caption{Title page produced by \textsf{ouexam}.} % \label{Fig.Output1} % \end{figure} % % \begin{figure} % \fbox{% % \begin{minipage}{\textwidth} % \small % \vspace*{1cm} % \hspace*{1cm}\hfill 2 \hfill INFO 211 \hspace*{1cm} % \\[0.625\baselineskip] % \hspace*{1cm}\underline{ANSWER ALL QUESTIONS} % \\[1cm] % \hspace*{0.8cm} % \begin{minipage}{10cm} % \renewcommand{\labelenumiii}{(\theenumiii)} % \begin{enumerate} % \item Study the Happy Joe schema supplied with this paper (see % pages~6--8) and answer the following questions. % \begin{enumerate} % \item Explain fully in English the purpose of the following % items in the schema (see page~9): % \begin{enumerate} % \item Trigger \textbf{T1}. \hfill (2 marks) % \item Trigger \textbf{T2}. \hfill (1 mark) % \item View \textbf{V1}. \hfill (1 mark) % \item View \textbf{V2}. \hfill (2 marks) % \item View \textbf{V3}. \hfill (2 marks) % \item Stored procedure \textbf{P1}. \hfill (3 marks) % \\[-0.5\baselineskip] % \end{enumerate} % % \item Write SQL code to define a single view that will show % all cars that have travelled more than 80,000 kilometres % (or 50,000 miles for older cars), and which have been sold % for less than their purchase price. (Note: the odometers % of older cars use miles instead of kilometres. The % attribute miles\_km in the Car table contains `K' if the % odometer reading is in kilometres or `M' if it is in % miles.) \\[-0.5\baselineskip] % % The syntax diagram for the CREATE VIEW statement has been % supplied with this paper (see page~9). \\ % \mbox{}\hfill (5 marks) \\[-0.5\baselineskip] % % \item When a feature code is changed in the Feature table, % this change should be automatically cascaded to the % Car\_feature table. Write SQL code to define a trigger % that does this. \\[-0.5\baselineskip] % % The syntax diagram for the CREATE TRIGGER statement has % been supplied with this paper (see page~9). \\ % \mbox{}\hfill (4 marks) \\[-0.5\baselineskip] % \end{enumerate} % \mbox{}\hfill \textbf{[TOTAL 20 MARKS]} % \\[1cm] % \mbox{}\hfill\textbf{TURN OVER} % \vspace*{1cm} % \end{enumerate} % \end{minipage} % \end{minipage} % } % \caption{Second page of the examination paper.} % \label{Fig.Output2} % \end{figure} % % % \StopEventually{} % % \section{The code} % % \subsection{Preamble} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1998/06/01] \ProvidesClass{ouexam}% [1999/20/01 Otago University examination paper class, v1.1] % \end{macrocode} % % \begin{macro}{multichoice} % \changes{1.1}{1999/04/20}{New class option.} % \begin{macro}{\if@multichoice} % \changes{1.1}{1999/04/20}{New switch for \textsf{multichoice}.} % This document class is based on the \textsf{article} class and accepts any % of the options accepted by \textsf{article}. The only `native' option to % \textsf{ouexam} is \textsf{multichoice}; the |\if@multichoice| switch is used % to determine whether this is in effect (default false). % \begin{macrocode} \newif\if@multichoice \@multichoicefalse \DeclareOption{multichoice}{\@multichoicetrue} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{twoside} % \changes{1.1}{1999/04/20}{Turned off \textsf{twoside} option.} % The \textsf{twoside} option does not really make sense --- all Otago % examination papers are printed single-sided anyway, and the format is such % that two-sided printing would look no different. The \textsf{twoside} option % is therefore not used in this class. % \begin{macrocode} \DeclareOption{twoside}{\OptionNotUsed} % \end{macrocode} % \end{macro} % All other options are passed directly to \textsf{article}. % \begin{macrocode} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions % \end{macrocode} % % \changes{1.1}{1999/04/20}{Changed default point size to 12pt.} % The defaults for this class are \textsf{onecolumn}, \textsf{oneside}, % \textsf{a4paper} and \textsf{12pt}. The font size is the only one that might % change. % \begin{macrocode} \LoadClass[onecolumn,oneside,a4paper,12pt]{article} % \end{macrocode} % % % \subsection{Required packages} % % The required packages are \textsf{calc} and \textsf{ifthen}, but these may % change. % \begin{macrocode} \RequirePackage{calc} \RequirePackage{ifthen} % \end{macrocode} % % % \subsection{Page setup} % % \begin{macro}{\oddsidemargin} % \begin{macro}{\topmargin} % \begin{macro}{\textwidth} % \begin{macro}{\textheight} % A4 paper is assumed (since this class is intended only for Otago examination % papers, this seems a reasonable assumption). The margins are top and bottom % 2cm, left and right 2.54cm (1in). This is the only place where the % \textsf{calc} package is used, and could easily be rewritten to not use it. % \begin{macrocode} \setlength{\oddsidemargin}{0cm} \setlength{\topmargin}{-0.54cm} \setlength{\textwidth}{15.9cm} \setlength{\textheight}{25.7cm-\headheight-\headsep-\footskip} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \subsection{Page styles} % % \begin{macro}{\ps@plain} % The \textsf{plain} page style is the same as that in the \textsf{article} % class, except that it produces pages with the page number centered at the % top, the paper number in the top right corner and the text `\textbf{TURN % OVER}' in the bottom right: % \begin{macrocode} \renewcommand{\ps@plain}{% \renewcommand{\@oddhead}{\hfil\textrm{\thepage}\hfil\@pnumber}% \renewcommand{\@evenhead}{\@oddhead}% \renewcommand{\@oddfoot}{\hfil\textbf{TURN OVER}}% \renewcommand{\@evenfoot}{\@oddfoot}% } % \end{macrocode} % \end{macro} % \textsf{plain} is the default page style. % \begin{macrocode} \pagestyle{plain} % \end{macrocode} % % \begin{macro}{\ps@lastpage} % The \textsf{lastpage} page style is the same as \textsf{plain}, but without % the `\textbf{TURN OVER}': % \begin{macrocode} \newcommand{\ps@lastpage}{% \renewcommand{\@oddhead}{\hfil\textrm{\thepage}\hfil\@pnumber}% \renewcommand{\@evenhead}{\@oddhead}% \renewcommand{\@oddfoot}{}% \renewcommand{\@evenfoot}{\@oddfoot}% } % \end{macrocode} % \end{macro} % This page style should be automatically applied to the last page of the % document. % \begin{macrocode} \AtEndDocument{\thispagestyle{lastpage}} % \end{macrocode} % % \begin{macro}{\ps@titlepage} % The \textsf{titlepage} page style is the same as \textsf{plain}, but without % the header: % \begin{macrocode} \newcommand{\ps@titlepage}{% \renewcommand{\@oddhead}{}% \renewcommand{\@evenhead}{\@oddhead}% \renewcommand{\@oddfoot}{\hfil\textbf{TURN OVER}}% \renewcommand{\@evenfoot}{\@oddfoot}% } % \end{macrocode} % \end{macro} % % % \subsection{Environments and associated items} % % \begin{environment}{questions} % \begin{environment}{subquestions} % \changes{1.1}{1999/04/20}{Now disabled when \textsf{multichoice} is active.} % \begin{environment}{subsubquestions} % \changes{1.1}{1999/04/20}{Now disabled when \textsf{multichoice} is active.} % \begin{environment}{options} % \changes{1.1}{1999/04/20}{New environment for \textsf{multichoice}.} % The \textsf{questions}, \textsf{subsubquestions}, \textsf{subsubquestions} % and \textsf{options} environments are just redefinitions of the % \textsf{enumerate} environment. If \textsf{multichoice} is not set, then % \textsf{questions}, \textsf{subquestions} and \textsf{subsubquestions} are % available. If \textsf{multichoice} is set, then \textsf{questions} and % \textsf{options} are available. % \begin{macrocode} \newenvironment{questions}{\begin{enumerate}}{\end{enumerate}} \if@multichoice \newenvironment{options}{\begin{enumerate}}{\end{enumerate}} \else \newenvironment{subquestions}{\begin{enumerate}}{\end{enumerate}} \newenvironment{subsubquestions}{\begin{enumerate}}{\end{enumerate}} \fi % \end{macrocode} % \end{environment} % \end{environment} % \end{environment} % \end{environment} % % \begin{macro}{\citem} % \changes{1.1}{1999/04/20}{New macro for \textsf{options} environment.} % The |\citem| macro is used to indicate the correct answer for a % multiple-choice question. If a |\showanswers| has not been issued in the % document preamble (see below), then |\citem| is identical to |\item|. % \begin{macrocode} \if@multichoice \def\citem{% \@inmatherr\item \@ifnextchar [\@item{\@noitemargtrue \@item[\@itemlabel]}} % \end{macrocode} % \end{macro} % % \begin{macro}{\showanswers} % \changes{1.1}{1999/04/20}{New macro for \textsf{multichoice}.} % Issuing the |\showanswers| macro in the document preamble redefines |\citem| % so that a box is drawn around the label of the correct answer, for example % `\fbox{b)}'. % \begin{macrocode} \newcommand{\showanswers}{% \renewcommand{\citem}{% \@inmatherr\item \@ifnextchar [\@item{\@noitemargtrue \@item[\fbox{\@itemlabel}]}}} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{question} % We cannot use the |enumi| counter for the \textsf{questions} environment % because |enumi| would get reset every time we start a new \textsf{questions} % environment. We therefore need a separate counter: % \begin{macrocode} \newcounter{question} % \end{macrocode} % \end{macro} % % \begin{macro}{marks} % \changes{1.1}{1999/04/20}{New counter for calculating question marks.} % If \textsf{multichoice} is not set, we may need to keep track of the total % number of marks for each question. The |marks| counter is used for this % purpose. It is reset to zero every time a |\totalmarks| macro is issued. % \begin{macrocode} \if@multichoice \else \newcounter{marks} \setcounter{marks}{0} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\labelenumi} % \changes{1.1}{1999/04/20}{Changed so that it prints differently when % \textsf{multichoice} is in effect.} % There are certain formats for numbering questions that need to be adhered % to. We therefore need to redefine the label-generating macros slightly. In % particular, we need to redefine |\labelenumi| so that it uses the new % |question| counter. For multiple-choice examinations, the question number is % drawn in bold face and a box is drawn around it to make it easier to % differentiate between different questions. % \begin{macrocode} \if@multichoice \renewcommand{\labelenumi}{% \refstepcounter{question} \fbox{\textbf{\arabic{question}.}} } % \end{macrocode} % For final examinations, the question number is drawn normally. % \begin{macrocode} \else \renewcommand{\labelenumi}{% \refstepcounter{question} \arabic{question}. } \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\labelenumii} % \changes{1.1}{1999/04/20}{Changes to list labels are now contingent on % \textsf{multichoice}.} % For multiple-choice examinations, we arbitrarily define the format for the % question numbers for answer labels as `a)', `b)', \ldots. Future versions of % this class may make this configurable. % \begin{macrocode} \if@multichoice \renewcommand{\labelenumii}{\alph{enumii})} % \end{macrocode} % \end{macro} % % \begin{macro}{\p@enumii} % \begin{macro}{\p@enumiii} % \begin{macro}{\labelenumiii} % For final examinations, the University requires that questions be numbered % as `1.', `2.', \ldots, sub-questions be numbered as `(a)', `(b)', \ldots, % and sub-sub-questions be numbered as `(i)', `(ii)', \ldots. We also redefine % |\p@enumii| and |\p@enumiii| to make referring to other parts of questions % slightly tidier (for example, `see part (a) above' versus `see part 1(a) % above'). % \begin{macrocode} \else \renewcommand{\p@enumii}{} \renewcommand{\p@enumiii}{(\theenumii)} \renewcommand{\labelenumiii}{(\roman{enumiii})} \fi % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % \subsection{Miscellaneous macros} % % \begin{macro}{\newsection} % The |\newsection| macro generates a new examination section, appropriately % numbered. The optional parameter contains instructions for answering the % questions in the new section, and defaults to `ANSWER ALL QUESTIONS'. % \begin{macrocode} \newcommand{\newsection}[1][ANSWER ALL QUESTIONS.]{% % \end{macrocode} % Every section begins on a new page. % \begin{macrocode} \newpage % \end{macrocode} % The section title is formatted as `\textbf{\underline{Section A}}', in % |\large| size. Note that sections are `numbered' A, B, \ldots. % \begin{macrocode} \refstepcounter{section} {\large\noindent\textbf{\underline{Section~\Alph{section}}}} \\[0.5\baselineskip] #1 } % \end{macrocode} % \end{macro} % % \begin{macro}{\marks} % \changes{1.1}{1999/04/20}{This macro now increments the \texttt{marks} % counter.} % The |\marks| macro specifies the number of marks for a question, and prints % it right-justified on the line as `(\emph{n} marks)', where \emph{n} is % passed as a parameter to the macro. It uses \textsf{ifthenelse} to determine % whether to print `mark' or `marks', based on the value of the parameter. The % number of marks is added to the |marks| counter. % \begin{macrocode} \newcommand{\marks}[1]{% \mbox{}\hfill (#1~\ifthenelse{#1=1}{mark}{marks}) \addtocounter{marks}{#1} } % \end{macrocode} % \end{macro} % % \begin{macro}{\totalmarks} % \changes{1.1}{1999/04/20}{Removed the parameter for the number of marks; % this is now retrieved from the \texttt{marks} counter.} % The |\totalmarks| macro calculates the total marks for a question that % comprises several sub-parts, and prints it out right-justified on the line % as `\textbf{[TOTAL \emph{n} MARKS]}, where \emph{n} is is the value of the % |marks| counter. to the macro. As with |\marks|, |\totalmarks| determines % whether to print `MARK' or `MARKS' automatically. Note that the |marks| % counter is reset to zero by this macro. % \begin{macrocode} \newcommand{\totalmarks}{% \mbox{}\hfill \textbf{[TOTAL \themarks~\ifthenelse{\themarks=1}{MARK}{MARKS}]} \setcounter{marks}{0} } % \end{macrocode} % \end{macro} % % \subsection{Title page macros} % % \begin{macro}{\examyear} % \begin{macro}{\@year} % The |\examyear| macro specifies the year in which the examination is being % held. It redefines the |\@year| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\examyear}{\renewcommand{\@year}} % \end{macrocode} % This macro is required: % \begin{macrocode} \newcommand{\@year}{% \ClassError{ouexam}{No {\protect\examyear} given}\@eha } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\department} % \begin{macro}{\@dept} % The |\department| macro specifies the name of the department, and is required. % It redefines the |\@dept| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\department}{\renewcommand{\@dept}} \newcommand{\@dept}{% \ClassError{ouexam}{No {\protect\department} given}\@eha } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\papernumber} % \begin{macro}{\@pnumber} % The |\papernumber| macro specifies the paper number, and is required. % It redefines the |\@pnumber| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\papernumber}{\renewcommand{\@pnumber}} \newcommand{\@pnumber}{% \ClassError{ouexam}{No {\protect\papernumber} given}\@eha } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\papertitle} % \begin{macro}{\@ptitle} % \changes{1.1}{1999/04/20}{Made this macro optional under % \textsf{multichoice}.} % The |\papertitle| macro specifies the title of the paper. It is required for % final examinations, but optional for multiple-choice examinations. % It redefines the |\@ptitle| macro which is used in |\maketitlepage|: % \begin{macrocode} \if@multichoice \newcommand{\papertitle}{\renewcommand{\@ptitle}} \newcommand{\@ptitle}{} \else \newcommand{\papertitle}{\renewcommand{\@ptitle}} \newcommand{\@ptitle}{% \ClassError{ouexam}{No {\protect\papertitle} given}\@eha } \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\semester} % \begin{macro}{\@semester} % The |\semester| macro specifies which semester the examination is for. Legal % values for the parameter are `1' or `2'. This macro uses \textsf{ifthenelse}. % It redefines the |\@semester| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\semester}[1]{% \ifthenelse{#1=1}% {\renewcommand{\@semester}{Semester One \\}}% {\renewcommand{\@semester}{Semester Two \\}} } % \end{macrocode} % \changes{1.1}{1999/04/20}{Updated slightly for \textsf{multichoice}.} % |\semester| is optional --- if you omit it, |\@semester| remains empty. Note % the slight difference for \textsf{multichoice}, which ensures there is % always a something there: % \begin{macrocode} \if@multichoice \newcommand{\@semester}{\mbox{}} \else \newcommand{\@semester}{} \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\timeallowed} % \begin{macro}{\@hours} % The |\timeallowed| macro specifies the length of the examination in hours. % It redefines the |\@hours| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\timeallowed}{\renewcommand{\@hours}} % \end{macrocode} % |\timeallowed| is optional --- if you omit it, |\@hours| defaults to three: % \begin{macrocode} \newcommand{\@hours}{3} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{num.pages} % \changes{1.1}{1999/04/20}{Renamed label from \texttt{page.last}.} % There is no macro to specify the number of pages in the examination because % it is done automatically by inserting a |\newlabel| that refers to the last % page directly into the |.aux| file: % \begin{macrocode} \AtEndDocument{% \immediate\write\@auxout{% \string\newlabel{num.pages}{{}{\thepage}} } } % \end{macrocode} % This label is then referenced in |\maketitlepage|. % \end{macro} % % \begin{macro}{num.questions} % \changes{1.1}{1999/04/20}{New label representing the number of questions.} % Similarly, there is no macro to specify the number of questions in the % examination. This is calculated using the same method as for the number of % pages: % \begin{macrocode} \AtEndDocument{% \immediate\write\@auxout{% \string\newlabel{num.questions}{{}{\thequestion}} } } % \end{macrocode} % \end{macro} % % \begin{macro}{\instructions} % \begin{macro}{\@instructions} % The |\instructions| macro specifies instructions on how candidates should % answer questions, and is optional. It redefines the |\@instructions| macro % which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@instructions}{} \newcommand{\instructions}[1]{\renewcommand{\@instructions}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\material} % \begin{macro}{\@material} % The |\material| macro lets specifies any additional material that candidates % are provided in addition to the examination paper itself, and is optional. % It redefines the |\@material| macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@material}{} \newcommand{\material}[1]{\renewcommand{\@material}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\allowcalculators} % \begin{macro}{\@calculators} % The |\allowcalculators| macro specifies whether or not calculators are % allowed in the examination. If |\allowcalculators| is omitted, |\@calculators| % defaults to `may not': % \begin{macrocode} \newcommand{\@calculators}{may not} % \end{macrocode} % Issuing |\allowcalculators| changes the redefines |\@calculators| to `may': % \begin{macrocode} \newcommand{\allowcalculators}{\renewcommand{\@calculators}{may}} % \end{macrocode} % |\@calculators| is used in |\maketitlepage|. % \end{macro} % \end{macro} % % \begin{macro}{\copiesof} % \begin{macro}{\@copiesof} % The |\copiesof| macro specifies any material that candidates are allowed to % bring into the examination, and is optional. It redefines the |\@copiesof| % macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@copiesof}{} \newcommand{\copiesof}[1]{\renewcommand{\@copiesof}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\otherinstructions} % \begin{macro}{\@otherinst} % The |\otherinstructions| macro specifies any other instructions not covered % by any of the above, and is optional. It redefines the |\@otherinst| % macro which is used in |\maketitlepage|: % \begin{macrocode} \newcommand{\@otherinst}{} \newcommand{\otherinstructions}[1]{\renewcommand{\@otherinst}{#1}} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\testtitle} % \begin{macro}{\@ttitle} % \changes{1.1}{1999/04/20}{New macro.} % The |\testtitle| macro specifies the title of the test for a multiple-choice % examination, and is required. It redefines the |\@ttitle| macro which is % used in |\mc@maketitlepage|: % \begin{macrocode} \if@multichoice \newcommand{\testtitle}{\renewcommand{\@ttitle}} \newcommand{\@ttitle}{% \ClassError{ouexam}{No {\protect\testtitle} given}\@eha } \fi % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\maketitlepage} % \changes{1.1}{1999/04/20}{Redefined to take account of \textsf{multichoice}.} % The |\maketitlepage| macro is the \textsf{ouexam} analogue of |\maketitle|. % It takes all of the information provided by the above macros and generates a % properly formatted examination title page. If the \textsf{multichoice} % option is used, the title page will be different, and some of the macros % described above will have no effect. If you want to design your own title % page styles, redefine |\mc@maketitlepage| for multiple choice examinations, % and |\final@maketitlepage| for `conventional' final examinations. (I would % not normally recommend redefining |\final@maketitlepage|.) % \begin{macrocode} \if@multichoice \newcommand{\maketitlepage}{\mc@maketitlepage} \else \newcommand{\maketitlepage}{\final@maketitlepage} \fi % \end{macrocode} % \end{macro} % % \begin{macro}{\final@maketitlepage} % \changes{1.1}{1999/04/20}{Renamed macro from \cs{maketitlepage}.} % The |\final@maketitlepage| macro generates an examination title page that % meets the Otago University requirements for final examination papers. You % can redefine this if you want to change the format, but normally you would % not do this. % \begin{macrocode} \newcommand{\final@maketitlepage}{% \thispagestyle{titlepage} % \end{macrocode} % The header information for the examination is printed centered at the top % of the page. The department, paper number and paper title (and the semester % information if required) are placed inside a double box. % \begin{macrocode} \begin{center} {\Large \textbf{UNIVERSITY OF OTAGO EXAMINATIONS \@year}} \\[\baselineskip] \fbox{% \framebox[\linewidth]{% \begin{tabular}{c} \\ {\large \@dept} \\ \\ {\large Paper \@pnumber} \\ \\ {\large \@ptitle} \\ \@semester \\ \end{tabular}% }% } \mbox{}\\[\baselineskip] % \end{macrocode} % Next, the time allowed for completing the examination: % \begin{macrocode} \textbf{(TIME ALLOWED: \@hours\ HOURS)} \\[\baselineskip] \end{center} % \end{macrocode} % The number of pages is automatically calculated, as descibed earlier. All we % need to do is reference the |num.pages| label that we put into the |.aux| % file: % \begin{macrocode} \underline{This examination paper comprises % \pageref{num.pages} pages} \\[\baselineskip] % \end{macrocode} % Print out the instructions for answering questions: % \begin{macrocode} \underline{Candidates should answer questions as follows:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@instructions \end{minipage} \\[\baselineskip] % \end{macrocode} % Print out any provided material: % \begin{macrocode} \underline{The following material is provided:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@material \end{minipage} \\[\baselineskip] % \end{macrocode} % Print out use of calculators section: % \begin{macrocode} \underline{Use of calculators:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} Electronic calculators \@calculators\ be used in this examination. \\[\baselineskip] Please note: where the use of calculators is permitted, these must be non-pro\-gram\-ma\-ble, hand-held calculators without alphabetic key pads. \end{minipage} \\[\baselineskip] \mbox{}\hfill (Subject to inspection by the examiners.) \\[\baselineskip] % \end{macrocode} % Print out anything that candidates are allowed to bring: % \begin{macrocode} \underline{Candidates are permitted copies of:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@copiesof \end{minipage} \\[\baselineskip] \mbox{}\hfill (Subject to inspection by the examiners.) \\[\baselineskip] % \end{macrocode} % Print out other instructions, and finish. % \begin{macrocode} \underline{Other Instructions:} \\[\baselineskip] \hspace*{1cm} \begin{minipage}{13.5cm} \@otherinst \end{minipage} \\[\baselineskip] \newpage } % \end{macrocode} % \end{macro} % % \begin{macro}{\mc@maketitlepage} % \changes{1.1}{1999/04/20}{New macro for \textsf{multichoice}.} % The |\mc@maketitlepage| macro generates an examination title page that for a % multiple-choice examination paper. There is no prescribed format for this, % so you are free to redefine this macro if the default format does not meet % your requirements. % \begin{macrocode} \newcommand{\mc@maketitlepage}{% \thispagestyle{titlepage} \large\mbox{}\vfill % \end{macrocode} % The title and preamble information is centered on the page in a box: % \begin{macrocode} \begin{center} \fbox% { \Huge \begin{tabular}{>{\bfseries}c<{\normalfont}} \@dept\ Paper \@pnumber \\ \\ \@ttitle\ \@semester\ \@year \\ \end{tabular} } \vfill This test comprises \pageref{num.questions} multiple choice questions and is \pageref{num.pages} pages long. \\[\baselineskip] % \end{macrocode} % General instructions for answering questions are printed next. We need the % |\mbox| just in case the instructions are empty: % \begin{macrocode} \mbox{}\@instructions \\[\baselineskip] \vfill % \end{macrocode} % followed by an other instructions: % \begin{macrocode} \mbox{}\@otherinst \\[\baselineskip] \end{center} \vfill\mbox{} \newpage } % \end{macrocode} % \end{macro} % % \Finale % % \PrintChanges
Show line notes below