%%% =================================================================== %%% @LaTeX-file{ %%% filename = "uwaexam.dtx", %%% version = "0.9", %%% date = "1999/03/29", %%% time = "01:05:00 EST", %%% checksum = "45083 408 1651 16375" %%% author = "Greg Gamble", %%% address = "Centre for Discrete Mathematics & Computing, %%% Department of Computer Science %%% & Electrical Engineering, %%% The University of Queensland, %%% Queensland 4072, %%% Australia", %%% telephone = "+61 7 336 52425," %%% FAX = "+61 7 336 54999, %%% copyright = "Copyright (C) 1996 Greg Gamble, %%% all rights reserved. Copying of this file is %%% authorised only if either: %%% (1) you make absolutely no changes to your copy, %%% including name; OR %%% (2) if you do make changes, you first rename it %%% to some other name.", %%% email = "gregg@csee.uq.edu.au (Internet)", %%% codetable = "ISO/ASCII", %%% keywords = "latex, amslatex, ams-latex, installation", %%% supported = "yes", %%% abstract = "This is class \cls{uwaexam}. It is built on the %%% standard \latex/ \cls{article} class %%% with option \opt{a4paper}. %%% It provides a document class for typesetting %%% exams at the University of Western Australia %%% with defaults suitable for the Department %%% of Mathematics & Statistics." %%% docstring = "The checksum field above contains a CRC-16 %%% checksum as the first value, followed by the %%% equivalent of the standard UNIX wc (word %%% count) utility output of lines, words, and %%% characters. This is produced by Robert %%% Solovay's checksum utility.", %%% } %%% =================================================================== % % \iffalse %<*driver> \documentclass{amsdtx} \EnableCrossrefs \CodelineIndex \RecordChanges \begin{document} \title{The \cls{uwaexam} class} \author{Greg Gamble} \date{Version \fileversion, \filedate} \hDocInput{uwaexam.dtx} \end{document} % % \fi % % \maketitle % \tableofcontents % \markboth{THE \cls{UWAEXAM} CLASS}{} % % \changes{v0.9}{99/03/29}{First release} % % \makeatletter % \DoNotIndex{\@Alph,\@author,\@coursenum,\@date,\@dept,\@deptcode} % \DoNotIndex{\@duration,\@empty,\@fnsymbol,\@gobbletwo,\@institution} % \DoNotIndex{\@makefnmark,\@makefntext,\@maketitle,\@plus} % \DoNotIndex{\@startsection,\@textsuperscript,\@thanks,\@thefnmark} % \DoNotIndex{\@title,\@xp,\c@footnote,\c@section,\hb@xt@,\tw@} % \DoNotIndex{\z@,\z@skip} % \makeatother % % \section{Introduction} % The file \fn{uwaexam.dtx} is the master file for the \latex/ % class, \cls{uwaexam}, which provides a class for exam preparation % at the University of Western Australia, with defaults % suitable for \latex/ users in the Department of Mathematics \& % Statistics Australia. It is built on the standard % \latex/ \cls{article} class with option \opt{a4paper}. % % \StopEventually{ % \begin{thebibliography}{9} % \addcontentsline{toc}{section}{\numberline{}Bibliography} % \bibitem{AmSLaTeX} American Mathematical Society, % \emph{\amslatex/ Version 1.2 User's Guide} (Jan.\ 1995). % Filename: \fn{amsldoc.dvi}. % \bibitem{source2e} J.~Braams, D.~Carlisle, A.~Jeffrey, L.~Lamport, % F.~Mittelbach, C.~Rowley, and R.~Sch\"opf, % \emph{The \LaTeXe\ Sources} (Jun.\ 1996). % Filename: \fn{source2e.dvi}. % \bibitem{amsthm} M.~Downes, % \emph{The \pkg{amsthm} package} (Version 1.2a, Feb.\ 1995). % Filename: \fn{amsthm.dvi}. % \bibitem{uwamaths} G.~Gamble, % \emph{The \pkg{uwamaths} package}, % (Version 2.1, Nov.\ 1997). % Filename: \fn{uwamaths.dvi}. % Describes a general purpose package of macros for the % Mathematics Department of the % University of Western Australia. % \bibitem{Companion} M.~Goossens, F.~Mittelbach, and A.~Samarin, % \emph{The \latex/ Companion} (Addison-Wesley, 1994). % \bibitem{TeX} D.~E.~Knuth, % \emph{The \tex/book} % (Addison-Wesley, 1984). Describes \tex/ in detail. % \bibitem{LaTeX} L.~Lamport, % \emph{\latex/ -- A Document Preparation System} % (Addison-Wesley, first ed., 1985). Describes \latex/ 2.09. % \bibitem{LaTeXe} L.~Lamport, % \emph{\latex/ -- A Document Preparation System} % (Addison-Wesley, second ed., 1994). Updated for \LaTeXe. % \bibitem{clsguide} The \latex/3 Project, % \emph{\LaTeXe\ for class and package writers} (Jun.\ 1996). % Filename: \fn{clsguide.dvi}. % \end{thebibliography} % \addcontentsline{toc}{section}{\numberline{}Index} % \DisableCrossrefs % \PrintIndex % \addcontentsline{toc}{section}{\numberline{}Change History} % \PrintChanges % } % % \section{Please note \dots} % This is a \emph{beta}-release. The % following are not as yet implemented: % \begin{itemize} % \item automatic counting of pages (filled in on title page); % \item automatic counting of questions (filled in on % title page); % \item mark assignments for questions and sub-parts of % questions (this will be implemented as an optional % argument to \cn{item} in each of the \env{questions}, % \env{subq} and \env{subsubq} environments\ e.g. % \begin{quote} % \verb+\begin{subq}+\\ % \verb+ \item[2] Show ...+ % \end{quote} % assigns 2 marks to the given sub-question; % \item mark totalling -- this will be typed in the % logging information to provide a useful check. % \item allowing more than one course number to be set in % the headers; % \item horizontal lines between questions; % \item footline information about what to expect on the % next page. % \end{itemize} % An example is given to show what it is possible so far. % For most the only differences between what will appear % in the \fn{.tex} file prepared for this \emph{beta}-release % and a final \emph{alpha}-release will be the optional % arguments to the question environment \cn{item}s. % An \emph{alpha}-release is expected to be available in a % few days. % \section{Implementation} % The usual name, date, and version information. % \begin{macrocode} \typeout{uwaexam 0.9} \NeedsTeXFormat{LaTeX2e} \ProvidesClass{uwaexam}[1999/03/29 v0.9] % \end{macrocode} % We build the class \cls{uwaexam} on top of \latex/'s % \cls{article} class with options \opt{a4paper}, % \opt{12pt}, and \opt{oneside}; but we % prefer to use a little more of the page. % % \begin{macrocode} \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax \LoadClass[a4paper,12pt,oneside]{article} % \end{macrocode} % The following code was taken straight from the \cls{amsbook} % class. % \begin{macrocode} \def\calclayout{\advance\textheight -\headheight \advance\textheight -\headsep % \end{macrocode} % \pagebreak % \begin{macrocode} \oddsidemargin\paperwidth \advance\oddsidemargin -\textwidth \divide\oddsidemargin\tw@ \ifdim\oddsidemargin<.5truein \oddsidemargin.5truein \fi \advance\oddsidemargin -1truein \evensidemargin\oddsidemargin \topmargin\paperheight \advance\topmargin -\textheight \advance\topmargin -\headheight \advance\topmargin -\headsep \divide\topmargin\tw@ \ifdim\topmargin<.5truein \topmargin.5truein \fi \advance\topmargin -1truein\relax } % \end{macrocode} % Now we set the page parameters. If a user wishes to reset % these, it is recommended that they do so in the following % way and in the following order. In particular, take note % of what parameters are set \emph{before} and \emph{after} % the \cn{calclayout} command. % The University of Western Australia specifies that % the margin near the binding must be at least $4\,$cm % and other margins at least $2\,$cm. % Our settings are slightly more than these. The setting % of \cn{evensidemargin} is ignored unless the user chooses % the \opt{twoside} option. % \begin{macrocode} \setlength{\textheight}{\paperheight} \addtolength{\textheight}{-4.4cm} \setlength{\textwidth}{\paperwidth} \addtolength{\textwidth}{-6.4cm} \normalsize \setlength{\headheight}{2\baselineskip} \calclayout \addtolength{\evensidemargin}{-1.2cm} \addtolength{\oddsidemargin}{0.8cm} \setlength{\marginparsep}{4mm} \setlength{\marginparwidth}{12mm} % \end{macrocode} % We ensure that the \amslatex/ packages % \pkg{amsmath} \cite{AmSLaTeX} and \pkg{amsfonts} are loaded. % You get still more if you use % the \pkg{uwamaths} package \cite{uwamaths}. % \begin{macrocode} \RequirePackage{amsmath}\relax \ifx\relax\mathfrak \@xp\@gobbletwo \else \let\mathfrak\relax \fi \RequirePackage{amsfonts}\relax % \end{macrocode} % The following \amslatex/ command tells \latex/ to allow breaks % within maths displays but to avoid them as much as possible. % \begin{macrocode} \allowdisplaybreaks[1] % \end{macrocode} % Now we set up macros for the titlepage. % We provide \cn{institution}, \cn{deptandcode}, % \cn{coursenum}, and \cn{duration}. % FIX \cn{coursenum}. % \begin{macrocode} \newcommand*{\institution}[1]{\def\@institution{#1}} \newcommand*{\deptandcode}[2]{\def\@dept{#1}\def\@deptcode{#2}} \newcommand*{\coursenum}[1]{\def\@coursenum{#1}} \newcommand*{\duration}[1]{\def\@duration{#1}} % \end{macrocode} % Now we provide default values for each of these. % \begin{macrocode} \institution{University of Western Australia} \deptandcode{Mathematics}{539} \coursenum{} \duration{Three hours} % \end{macrocode} % Why do define the command \cn{duration} and not \cn{time}? % \dots the reason is \cn{time} is already a \tex/ command! % % Now we define defaults for \cn{title} which is used to define % the type of examinations being held, and the \cn{date}. % \begin{macrocode} \title{\ifnum\month<7 First Semester Examinations% \else Annual Examination% \fi} \date{\ifnum\month<7 June \else November \fi \the\year} % \end{macrocode} % We don't set the \cn{author} of an exam in the paper % itself \dots but we retain it and type it out when the % document is typeset. Since the \cn{author} is not set at % the beginning of the paper, this also removes \latex/'s usual % warning if \cn{author} is absent. % \begin{macrocode} \def\author#1{\typeout{Paper prepared by #1.}} % \end{macrocode} % Now we define the \cn{maketitle} command to set these on % the first page of the exam. % \begin{macrocode} \renewcommand\maketitle{\par \begingroup \renewcommand\thefootnote{\@fnsymbol\c@footnote}% \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% \long\def\@makefntext##1{\parindent 1em\noindent \hb@xt@1.8em{% \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% \@maketitle \endgroup \setcounter{footnote}{0}% \global\let\thanks\relax \global\let\maketitle\relax \global\let\@maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\title\relax \global\let\author\relax \global\let\date\relax \global\let\and\relax } \def\@maketitle{\cleardoublepage \thispagestyle{empty}% \begingroup% \topskip\z@skip %\null \singlespacing\normalsize \begin{center} \@institution \end{center} \MakeUppercase{\@title}\hfill\MakeUppercase{\@date}\\\ \\ \vspace*{0pt}\hfill\MakeUppercase{\@dept\ \@coursenum}\hfill% \llap{\@deptcode.\@coursenum} \begin{flushright} \begin{tabular}{l@{}} This paper contains:\\ pages.\\ questions. \end{tabular} \end{flushright} \begin{center} Time allowed : \MakeUppercase\@duration \end{center} \endgroup% } % \end{macrocode} % Now we modify the \cn{section} command to typeset headers % such as: \verb+PART A+. Perhaps we really should use \cn{part} % but we use \c{section} since \cn{part} was used for subquestions % in the plain \tex/ \fn{exam.tex} previously, and it % is expected that \cn{section} will be rarely used. The % \cn{sectionmark} command is disabled. The % other sectioning commands of the \cls{article} class are still % there untouched (but of course they are not useful in the % form they are). % \begin{macrocode} \newdimen\linespacing \normalsize \setlength{\linespacing}{\baselineskip} \newdimen\normalparindent \setlength{\normalparindent}{18pt} \def\sectionname{PART} \renewcommand{\thesection}{\sectionname \@Alph\c@section} \def\section{\@startsection{section}{1}% \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}% {\normalfont}} \renewcommand{\sectionmark}[1]{} % \end{macrocode} % To get nice page headers we use the % \pkg{fancyhdr} package. % \begin{macrocode} \RequirePackage{fancyhdr} \lhead{\ \\ \bfseries\@title\\ \bfseries\@date} \chead{} \rhead{\thepage.\\ \bfseries\@dept : \@deptcode.\@coursenum\\ \ } \cfoot{} \pagestyle{fancy} % \end{macrocode} % We make available some spacing macros. % The amounts of stretch are those specified % for $12\,$pt by the \emph{\latex/ Companion} \cite{Companion}. % Other font sizes differ from these only marginally. % See the \pkg{uwamaths} package \cite{uwamaths} % where the same macros are defined, for further discussion % of these macros. % \begin{macrocode} \newcommand{\singlespacing}{\renewcommand{\baselinestretch}{1}} \newcommand{\oneandhalfspacing}{\renewcommand{\baselinestretch}{1.24}} \newcommand{\doublespacing}{\renewcommand{\baselinestretch}{1.66}} % \end{macrocode} % Now we provide an \env{instructions} environment, which is % just a doublespaced \env{center} environment. % \begin{macrocode} \newenvironment{instructions}{\begin{center}\doublespacing\normalsize} {\end{center}} % \end{macrocode} % For now we provide a \cn{questions} environment that is % simply an arabic numbered \cn{enumerate} environment, % a \cn{subq} environment which is an alphabetically numbered % \cn{enumerate} environment, and a \cn{subsubq} environment % which is a roman numbered \cn{enumerate} environment. % \begin{macrocode} \RequirePackage{enumerate} \newenvironment{questions}{\begin{enumerate}[1.]} {\end{enumerate}} \newenvironment{subq}{\begin{enumerate}[(a)]} {\end{enumerate}} \newenvironment{subsubq}{\begin{enumerate}[(i)]} {\end{enumerate}} % \end{macrocode} % We set the normal spacing at \cn{oneandhalfspacing}, to % make for easy reading. % \begin{macrocode} \oneandhalfspacing % \end{macrocode} % That's it. % \begin{macrocode} \endinput % \end{macrocode} % \section{A sample exam} % Well that's it for the code. A typical example of the % use of the \cls{uwaexam} documentclass will appear here % soon. For now look at the text and result of an example % just below this documentation on the webpage. % \CheckSum{320} % \Finale