%% %% This is file `tripos.cls', %% generated with the docstrip utility. %% %% The original source files were: %% %% tripos.dtx (with options: `class') %% \NeedsTeXFormat{LaTeX2e} \ProvidesClass{tripos} [2013/04/17 Tripos exam class (Markus Kuhn)] \DeclareOption{draft}{\setlength\overfullrule{5pt}} \DeclareOption{final}{\setlength\overfullrule{0pt}} \ExecuteOptions{draft} \newif\ifcommonpackages \DeclareOption{ownpackages}{\commonpackagesfalse} \DeclareOption{commonpackages}{\commonpackagestrue} \ExecuteOptions{commonpackages} \ProcessOptions \RequirePackage{docmute}[2012/01/28] \RequirePackage{pgfkeys} \input{size12.clo} \setlength\paperwidth {210mm} \setlength\paperheight{297mm} \setlength\voffset{0pt} \setlength\topmargin{-53pt} \setlength\headheight{12pt} \setlength\headsep{67.5pt} \setlength\textheight{664pt} \setlength\parskip{\baselineskip} \setlength\lineskip{1pt} \setlength\normallineskip{1pt} \setlength\footskip{2\parskip} \raggedbottom \newlength{\indentation} \newlength{\numbergap} \setlength\indentation{25pt} \setlength\numbergap{12pt} \setlength\hoffset{0pt} \setlength\oddsidemargin{27.5pt} \setlength\evensidemargin{\oddsidemargin} \setlength\textwidth{432pt} \setlength\parindent{0pt} \pretolerance=1000 \tolerance=2000 \hyphenpenalty=2000 \exhyphenpenalty=2000 \newcommand{\@listo}{ \setlength\topsep{0pt} \setlength\partopsep{0pt} \setlength\parsep{\parskip} \setlength\itemsep{0pt} \setlength\leftmargin{\indentation} \setlength\labelsep{4pt} \setlength\labelwidth{\leftmargin} \addtolength\labelwidth{-\labelsep} } \renewcommand{\@listi }{\@listo} \renewcommand{\@listI }{\@listo} \renewcommand{\@listii }{\@listo} \renewcommand{\@listiii}{\@listo} \renewcommand{\@listiv }{\@listo} \renewcommand{\@listv }{\@listo} \renewcommand\theenumi {(\textit{\@alph\c@enumi})} \renewcommand\theenumii {(\textit{\@roman\c@enumii})} \renewcommand\theenumiii{(\@Alph\c@enumiii)} \renewcommand\theenumiv {(\the\c@enumiv)} \newcommand\labelenumi {\makebox[\labelwidth][l]{\theenumi}} \newcommand\labelenumii {\makebox[\labelwidth][l]{\theenumii}} \newcommand\labelenumiii{\makebox[\labelwidth][l]{\theenumiii}} \newcommand\labelenumiv {\makebox[\labelwidth][l]{\theenumiv}} \renewcommand\p@enumii {\theenumi} \renewcommand\p@enumiii {\theenumi\theenumii} \renewcommand\p@enumiv {\p@enumiii\theenumiii} \newcommand\labelitemi {\makebox[\labelwidth][c]{\textbullet\hspace{-\labelsep}}} \newcommand\labelitemii {\makebox[\labelwidth][c]{\textbf{\textendash}\hspace{-\labelsep}}} \newcommand\labelitemiii{\makebox[\labelwidth][c]{\textasteriskcentered\hspace{-\labelsep}}} \newcommand\labelitemiv {\makebox[\labelwidth][c]{\textperiodcentered\hspace{-\labelsep}}} \newenvironment{compact}{\setlength{\parskip}{0.5\baselineskip}}{} \newenvironment{quote} {\list{}{\rightmargin\leftmargin}% \item\relax} {\endlist} \newenvironment{quotation} {\list{}{\rightmargin\leftmargin}% \item\relax} {\endlist} \pagenumbering{arabic} \setlength\arraycolsep{5\p@} \setlength\tabcolsep{6\p@} \setlength\arrayrulewidth{.4\p@} \setlength\doublerulesep{2\p@} \ifcommonpackages\else \DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} \DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} \DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt} \DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf} \DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit} \DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl} \DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc} \DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal} \DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal} \fi \newcommand{\absize}{% \ifx\@currsize\normalsize\footnotesize\else % test more likely sizes first \ifx\@currsize\small\scriptsize\else \ifx\@currsize\footnotesize\tiny\else \ifx\@currsize\large\small\else \ifx\@currsize\Large\normalsize\else \ifx\@currsize\LARGE\large\else \ifx\@currsize\scriptsize\tiny\else \ifx\@currsize\huge\Large\else \ifx\@currsize\Huge\LARGE \fi\fi\fi\fi\fi\fi\fi\fi\fi } \newcounter{paper} \newcounter{section} \newcounter{question} \newcounter{origquestion} \setcounter{paper}{1} \setcounter{question}{1} \newif\ifmetadata \newif\ifanswers \newif\iftopics \newif\ifrenumberquestions \newif\ifnewpage \newif\ifnewsheet \newif\ifsignoff \newcommand*\triposset[1]{\pgfqkeys{/tripos}{#1}} \newcommand*\triposget[1]{\pgfkeysvalueof{/tripos/#1}} \newcommand\triposifempty[3]{\pgfkeysgetvalue{/tripos/#1}{\@value}% \ifx\@value\relax#2\else\ifx\@value\@empty#2\else#3\fi\fi} \triposset{paper/.code={\setcounter{paper}{#1}}} \triposset{question/.code={\ifrenumberquestions \setcounter{origquestion}{#1}\else \setcounter{question}{#1}\fi}} \triposset{metadata/.is if=metadata, answers/.is if=answers, topics/.is if=topics, renumberquestions/.is if=renumberquestions, newpage/.is if=newpage, newsheet/.is if=newsheet, signoff/.is if=signoff, metadata=true,answers=false,topics=false, renumberquestions=false, newpage=true,newsheet=false,signoff=false} \triposset{title/.initial={title=???}, subtitle/.initial=, code/.initial={code=???}, year/.initial={year=???}, date/.initial={date=???}, day/.style={date=#1 \triposget{year}}, time/.initial={time=???}, enddate/.initial=, endtime/.initial={endtime=???}, subject/.initial={subject=???}, rubrics/.initial={rubrics=???}, rubrics2/.initial=, author/.initial={author=???}, fullmarks/.initial=} \triposset{titlecentre/.initial=} \triposset{titlebottomleft/.initial=} \triposset{titlebottomright/.initial=} \triposset{titlewarningwidth/.initial=278pt} \triposset{titlewarning/.style={titlecentre={ \fboxrule=3pt\fboxsep=1.8pt \fbox{\fboxrule=1.2pt\fboxsep=13pt \fbox{\parbox{\triposget{titlewarningwidth}}{\centerlastline \large\bfseries #1}}} }}} \triposset{stationery requirements/.style={ titlebottomleft={STATIONERY REQUIREMENTS\\\itshape #1} }} \triposset{special requirements/.style={ titlebottomright={SPECIAL REQUIREMENTS\\\itshape #1} }} \newcommand\centerlastline{\leftskip=0pt plus .5fil \rightskip=0pt plus -.5fil \parfillskip=0pt plus 1fil} \triposset{attempts/.style={rubrics2={Submit the answers in #1 \textbf{separate} bundles, each with its own cover sheet. On each cover sheet, write the numbers of \textbf{all} attempted questions, and circle the number of the question attached. }}} \triposset{structure/.is choice} \triposset{structure/1abc2d/.style={rubrics={Answer \textbf{one} question from each of Sections A, B and C, and \textbf{two} questions from Section D. }}} \triposset{structure/5q/.style={rubrics={ Answer \textbf{five} questions.}}} \triposset{structure/aq/.style={rubrics={ Answer \textbf{all} questions. }}} \triposset{structure/3a1b40/.style={rubrics={ Answer \textbf{three} questions from Section A\\ \phantom{Answer}\makebox[0pt][r]{and} \textbf{one} question from Section B.\\[2.4pt] Forty per cent of the marks will be allocated to Section B. }}} \triposset{structure/5qmax2ps/.style={rubrics={ Answer \textbf{five} questions.\\[2.4pt] No more than \textbf{two} questions from any one section are to be answered. }}} \triposset{structure/5qmin1ps/.style={rubrics={ Answer \textbf{five} questions.\\[2.4pt] At least \textbf{one} question from each section is to be answered. }}} \triposset{paper style/.style={newpage=false}} \triposset{solutionnotes style/.style={}} \triposset{signoff style/.style={}} \triposset{CST/.style={ subject=COMPUTER SCIENCE \ Paper \arabic{paper}, code=CST,subtitle=,fullmarks=20,time=1.30,endtime=4.30,attempts=five, titlewarning={You may not start to read the questions printed on the subsequent pages of this question paper until instructed that you may do so by the Invigilator}, stationery requirements={Script paper\\Blue cover sheets\\Tags}, special requirements={Approved calculator permitted} }} \triposset{CSTpartIA/NST/PPS/.style={ CST,structure=1abc2d, title={COMPUTER SCIENCE TRIPOS \ Part I{\absize A}}, subtitle={NATURAL SCIENCES TRIPOS \ Part I{\absize A} \ (Paper CS/1)\\ POLITICS, PSYCHOLOGY, AND SOCIOLOGY TRIPOS \ Part I \ (Paper 9)} }} \triposset{CSTpartIA/.style={ CST,structure=1abc2d,title=COMPUTER SCIENCE TRIPOS \ Part I{\absize A}}} \triposset{CSTpartIB/.style={ CST,structure=5q,title=COMPUTER SCIENCE TRIPOS \ Part I{\absize B}}} \triposset{CSTpartII/.style={ CST,structure=5q,title=COMPUTER SCIENCE TRIPOS \ Part II}} \triposset{CSTpartIII/ACS/.style={ title={COMPUTER SCIENCE TRIPOS \ Part III\\ MPHIL IN ADVANCED COMPUTER SCIENCE}, metadata=false, structure=aq, rubrics2={ Answers may be either handwritten in the booklet provided, or computer printed. If submitting computer-printed answers, please use the yellow cover sheet provided. \\[\parskip] On the cover page, enter the numbers of all the questions you have answered. Put a circle around the number(s) of the question(s) you have answered in each answer booklet if you have used more than one book. \\[\parskip] All booklets and cover sheets must be returned to Graduate Education Office whether used or not. \\[2\parskip] The completed answers should be submitted to the Graduate Education Office \textbf{no later than \triposget{endtime} on \triposget{enddate}}. \\[\parskip] Students will be required to sign an undertaking that work submitted will be entirely their own; \textbf{no collaboration is permitted}. }, stationery requirements={Two 20-page answer booklets\\Yellow cover sheet} }} \triposset{ signoff request/.initial={ An examination question which you set recently is likely to appear as reproduced below. Please check carefully that this is what you intended. }, signoff declaration/.initial={ I have carefully checked the above and can find no errors. } } \newif\if@sectionstart \newcommand\section{ \ifpaper \par \addtocounter{section}{1} \@sectionstarttrue \ifnewsheet\cleardoublepage\else\ifnewpage\clearpage\else\filbreak\fi\fi \vspace{3em} \hspace*{-\indentation}\textbf{SECTION~\Alph{section}} \par \fi } \newcounter{marksum} \newenvironment{question}[2][]{\triposset{author=,#1}% \par \ifsignoff \ifnewsheet\cleardoublepage\else\clearpage\fi \else \if@sectionstart \else \ifnewsheet\cleardoublepage\else\ifnewpage\clearpage\else\filbreak\fi\fi \ifmetadata \vspace{4\baselineskip}% do not (see below) move above question heading \else \vspace{3em}% regular space between questions \fi \fi \fi \global\@sectionstartfalse \begingroup \setcounter{marksum}{0}% \setcounter{equation}{0}% \setlength\partopsep{0pt} \setlength\topsep{0pt} \let\lonely@item@error\makelabel% preserve default definition \trivlist \item[{\makebox[0pt][r]{\textbf{\strut\arabic{question}}\hspace{\numbergap}}}] \def\makelabel{\lonely@item@error}% restore default \def\question@heading{#2}\ifx\question@heading\@empty\else \ifsignoff \makebox[0pt][l]{\parbox[b][0pt][b]{\linewidth}{% \triposget{signoff request} \vspace{12pt} \titlerule \vspace*{19.2pt}}}% \else \ifmetadata \makebox[0pt][l]{\parbox{\linewidth}{% \if@sectionstart \vspace*{-8\baselineskip}% move above section and question heading \else \vspace*{-4\baselineskip}% move above question heading \fi \hspace*{-\indentation}\textbf{\triposget{title} -- \triposget{year} -- Paper \arabic{paper} \ifrenumberquestions-- Question \arabic{origquestion}\fi}}}% \fi\fi \textbf{\question@heading\ifmetadata\ (\triposget{author})\fi}\par\fi \ignorespaces }{ \triposifempty{fullmarks}{}{ \ifnum\value{marksum}=\triposget{fullmarks} \else \def\markswarning{expected \triposget{fullmarks} marks total, but found \arabic{marksum}} \ClassWarningNoLine{tripos}{Question \arabic{question}: \markswarning} \textbf{[Warning: \markswarning]}\par \fi } \endtrivlist\endgroup \ifsignoff \nopagebreak \vspace{-2\parskip}\makebox[0pt][l]{\parbox[t][0pt][t]{\linewidth}{% \vspace{16pt} \titlerule \vspace{12pt} \triposget{signoff declaration}\par \vspace{18pt} Signed $\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots$% \qquad Date $\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots\ldots$\par }}% \newpage \fi \addtocounter{question}{1} } \newcommand{\fullmarks}{\@ifstar\fullmarks@text\fullmarks@integer} \newcount\@marks \newcommand*{\fullmarks@integer}[2][1]{\@marks=#2\multiply\@marks by#1% \fullmarks@text{\@marks}{#2~mark\ifnum#2=1\else s\fi\ifnum#1=1\else~each\fi}} \newcommand*{\fullmarks@text}[2]{\addtocounter{marksum}{#1}% {\hspace*{\fill}\nolinebreak[1]% \hspace{5pt}\hspace*{\fill}\mbox{[#2]}\parfillskip=0pt% \finalhyphendemerits=0\par}} \def\question@labelprefix{\triposget{year}-p\arabic{paper}-q\arabic{question}} \let\orig@label=\label \let\orig@ref=\ref \let\orig@pageref=\pageref \renewcommand*\label[1]{\orig@label{\question@labelprefix:#1}}% \renewcommand*\ref[1]{\orig@ref{\question@labelprefix:#1}}% \renewcommand*\pageref[1]{\orig@pageref{\question@labelprefix:#1}}% \let\@topics\@empty \newcommand*\topic[1]{\iftopics\g@addto@macro\@topics{{#1}\par}\fi} \@mparswitchfalse \setlength\marginparwidth{75pt} \setlength\marginparsep{10pt} \reversemarginpar \def\output@topics{\global\let\@@topics\@topics \global\let\@topics\@empty \ifx\@@topics\@empty\else \marginpar{\sffamily\footnotesize\raggedright\@@topics}\fi} \let\tripos@@everypar\everypar \newtoks\tripos@everypar \tripos@everypar\expandafter{\the\everypar} \tripos@@everypar{\output@topics\the\tripos@everypar} \let\everypar\tripos@everypar \newcommand*\hint[1]{\note[Hint]{#1}} \newcommand*\note[2][Note]{[\emph{#1:} #2]} \newsavebox{\answerbox} \newcommand{\answerheader}{\emph{Answer:}\hspace{0.8em plus 0.2em}} \newenvironment{answer}{\par \ifanswers\else\renewcommand*\ref[1]{}\renewcommand*\pageref[1]{}\fi \renewcommand{\fullmarks}{\ClassError{tripos} {\@backslashchar fullmarks not allowed in answer environment}} \ifanswers\else\begingroup\lrbox{\answerbox}\begingroup\minipage{\linewidth}\fi \parskip=\medskipamount \footnotesize\let\@listi\@listI \renewcommand\footnoterule{% \kern8\p@\hrule\@width.15\columnwidth\kern3\p@} \newcommand\@makefntext[1]{\footnotesize \parindent 1em% \noindent \hb@xt@1.8em{\hss\@makefnmark}##1}% \rule{\linewidth}{1pt} \par\nobreak\nointerlineskip\vspace{-\parskip}\vspace{4pt} \answerheader\ignorespaces }{% \par\nopagebreak\nointerlineskip\vspace{-\parskip}\vspace{4pt} \rule{\linewidth}{1pt}% \ifanswers\else\endminipage\endgroup\endlrbox\endgroup\fi } \newcommand*\questionmissing[1][]{ \begin{question}[author={author=???},metadata=false,fullmarks=,#1]{This question is still missing (\triposget{author})} \end{question} } \newcommand*\context[1]{\par \iftopics[\textit{Context: #1.}]\par\fi} \newsavebox{\subjectareasbox} \newenvironment{subjectareas}{\par \begin{lrbox}{\subjectareasbox}\begin{minipage}{\linewidth}[\textit \bgroup\ignorespaces }{\unskip\egroup]\end{minipage}\end{lrbox}% \iftopics\usebox{\subjectareasbox}\fi } \newcommand\continued{ \vfill\rightline{\textbf{[continued. . .}} \newpage } \newcommand\spacer{\par \parbox{\linewidth}{\rule{2pt}{42pt}\qquad \raisebox{10pt}{\parbox[b]{406pt}{\centering Please leave this much space at the bottom of the page,\\ to allow for a section header or end-of-paper footer.}\par}}} \newcommand\titlerule{\par\nointerlineskip \makebox[\textwidth]{\kern-\indentation\leaders\vrule height 0.5pt\hfill \relax}\par\nointerlineskip} \newcommand\maketitle{ \ifpaper \thispagestyle{papertitle} {\large \textbf{\triposget{title} \triposifempty{subtitle}{}{\\[6pt]\small\triposget{subtitle}}}\par} \vskip 6pt \titlerule \triposifempty{enddate} {\triposget{date}\qquad\triposget{time} to \triposget{endtime}} {\triposget{date}\quad\triposget{time}\qquad to\qquad\triposget{enddate}\quad\triposget{endtime}} \vskip -3pt \titlerule \vskip 6pt \triposget{subject} \textit{\ignorespaces\triposget{rubrics}} \textit{\ignorespaces\triposget{rubrics2}} \vfill \centerline{\triposget{titlecentre}} \vfill \parbox{432pt}{% \parbox[t]{240pt}{\mbox{}\triposget{titlebottomleft}}% \parbox[t]{192pt}{\mbox{}\triposget{titlebottomright}}% } \vspace*{\parskip} \newpage \fi } \newif\ifpaper\papertrue \newenvironment{paper}[1][]{ \ifpaper \pagestyle{paper} \addtolength\parskip{0pt minus 3pt} \triposset{metadata=false,answers=false,topics=false,paper style} \fi \setcounter{section}{0} \setcounter{question}{1} \triposset{#1} }{ \ifpaper \nopagebreak \vspace{36pt} \centerline{\textbf{END OF PAPER}} \thispagestyle{paperlast} \newpage \pagestyle{plain} \fi \addtocounter{paper}{1} } \newenvironment{solutionnotes}[1][]{ \triposset{metadata=true,answers=true,topics=true,solutionnotes style,#1} \pagestyle{solutionnotes} \paperfalse }{ \newpage \pagestyle{plain} } \newenvironment{signoff}[1][]{ \triposset{metadata=false,answers=false,topics=false,signoff=true, signoff style,#1} \pagestyle{signoff} \addtolength\parskip{0pt minus 3pt} \paperfalse }{ \newpage \pagestyle{empty} } \newcommand\ps@paper{% \renewcommand\@oddhead{\hfil\scriptsize\triposget{code}.\triposget{year}.% \arabic{paper}.\thepage} \let\@evenhead\@oddhead \renewcommand\@oddfoot {\hfil\thepage\hfil\makebox[0pt][r]{(TURN OVER)}} \renewcommand\@evenfoot{\hfil\thepage\hfil} } \newcommand\ps@paperlast{% \ps@paper \let\@oddfoot\@evenfoot } \newcommand\ps@papertitle{% \ps@paper \renewcommand\@oddfoot{} \renewcommand\@evenfoot{} } \newcommand\ps@solutionnotes{% \renewcommand\@oddhead{\hspace*{-\indentation}\hfil\raisebox{-5mm} {\textit{\Large --- Solution notes ---}}\hfil} \let\@evenhead\@oddhead \renewcommand\@oddfoot{\hfil\thepage\hfil} \let\@evenfoot\@oddfoot } \newcommand\ps@signoff{% \renewcommand\@oddhead{\textbf{EXAMINATION QUESTION BY \triposget{author}}\quad\hfil\triposget{code} \triposget{year} Paper \arabic{paper}} \let\@evenhead\@oddhead \renewcommand\@oddfoot{} \let\@evenfoot\@oddfoot } \@twosidetrue \pagestyle{plain} \ifcommonpackages \RequirePackage{color} \RequirePackage{graphicx} \DeclareGraphicsRule{.pdftex}{pdf}{*}{} \RequirePackage{amsmath} \RequirePackage{amssymb} \RequirePackage{stmaryrd} \RequirePackage{proof} \RequirePackage{latexsym} \RequirePackage{upgreek} \RequirePackage{upquote}[2012/04/19] \RequirePackage{alltt} \renewcommand*\usepackage[1][]{ \ClassError{tripos}{Do not load packages in Tripos questions} } \fi \InputIfFileExists{tripos-config.tex}{}{} \endinput %% %% End of file `tripos.cls'.