From 67067bf3dea16a3ad7a67d81602f2dbfbb1e1956 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 18 Oct 2016 21:23:06 +0000 Subject: bangorexam (18oct16) git-svn-id: svn://tug.org/texlive/trunk@42299 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/latex/bangorexam/bangorexam.pdf | Bin 178908 -> 180742 bytes .../source/latex/bangorexam/bangorexam.dtx | 363 +++++++++++++-------- .../texmf-dist/tex/latex/bangorexam/bangorexam.cls | 134 ++++++-- 3 files changed, 324 insertions(+), 173 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf b/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf index 49724645919..6b66e074e48 100644 Binary files a/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf and b/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf differ diff --git a/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx b/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx index 6287774a016..116e68d25d4 100644 --- a/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx +++ b/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx @@ -40,9 +40,10 @@ \end{document} % %\fi -%\CheckSum{432} +%\CheckSum{501} %\RecordChanges %\changes{v1.0}{2016/09/26}{Initial version.} +%\changes{v1.1}{2016/10/17}{Added two from four exam mode.} %\pagestyle{fancy} %\title{Bangor University Computer Science Department\\ Exam Document Class} %\author{Cameron Gray \texttt{}} @@ -247,7 +248,7 @@ % %\ \\ % -%\DescribeMacro{\choice Choice Text} Typesets a single choice according to +%\DescribeMacro{\choice\ Choice Text} Typesets a single choice according to %which environment it is placed in. % %Solutions to multiple choice questions are handled somewhat differently. @@ -256,7 +257,7 @@ % %\ \\ % -%\DescribeMacro{\correctchoice Choice Text} Typeset the correct choice based +%\DescribeMacro{\correctchoice\ Choice Text} Typeset the correct choice based %on where the macro is placed. When |answers| is in effect, the output of %this macro will either highlight the option in boldface, or replace the %checkbox with a tick. @@ -272,11 +273,11 @@ %\end{macrocode} %\fi %\begin{macrocode} -\def\version{1.0.0} +\def\version{1.1.0} \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{bangorexam}[2016/10/03 \version C. Gray] +\ProvidesClass{bangorexam}[2016/10/17 \version{}C. Gray] % Based on the Exam document class by Philip S. Hirschhorn % Developed/Adapted for Bangor University by C. Gray @@ -291,7 +292,6 @@ \RequirePackage{color} \RequirePackage{etoolbox} \RequirePackage{graphicx} -\RequirePackage{ifthen} \RequirePackage{letltxmacro} \RequirePackage{newpxtext,newpxmath} \RequirePackage{totcount} @@ -299,6 +299,17 @@ \RequirePackage{courier} +% ******************************************************************* +% Strings +% ******************************************************************* + +\newcommand{\engATypeText}{Answer {\bf Section A} (compulsory) and {\bf any two} questions from {\bf Section B}.}% +\newcommand{\welATypeText}{Atebwch {\bf Adran A} (gorfodol) ac {\bf unrhyw ddau} gwestiwn o {\bf Adran B}.}% +\newcommand{\engBTypeText}{Answer \textbf{two} out of four questions.}% +\newcommand{\welBTypeText}{Atebwch \textbf{ddau} o'r pedwar cwestiwn.}% +\newcommand{\sectionAHeader}{\textbf{SECTION A} --- Answer \textbf{ALL} questions (Total marks \total{sectiona})}% +\newcommand{\sectionBHeader}{\textbf{SECTION B} --- Answer any \textbf{TWO} questions (\total{sectionb} marks each)}% + % ******************************************************************* % Class Level Options % ******************************************************************* @@ -306,34 +317,30 @@ % Enable Welsh headings, etc. Does not affect the cover sheet. % ------------------------------------------------------------------- \DeclareOption{welsh}{% -\newcommand{\welsh}{true}% + \newcommand{\welsh}{true}% + \renewcommand{\sectionAHeader}{\textbf{ADRAN A} --- Atebwch BOB cwestiwn (Cyfanswm marciau \total{sectiona})}% + \renewcommand{\sectionBHeader}{\textbf{ADRAN B} --- Atebwch unrhyw DDAU chwestiwn (\total{sectionb} marc yr un)}% }% % Exam Type % ------------------------------------------------------------------- +\newcommand{\engTypeText}{} +\newcommand{\welTypeText}{} \DeclareOption{ab}{% -\newtotcounter{sectiona}% -\newtotcounter{sectionb} -\newcommand{\examtype}{ab}% -\newcommand{\engTypeText}{Answer {\bf Section A} (compulsory) and {\bf any two} questions from {\bf Section B}.}% -\newcommand{\welTypeText}{Atebwch {\bf Adran A} (gorfodol) ac {\bf unrhyw ddau} gwestiwn o {\bf Adran B}.}% -\newcommand{\sectionAHeader}{\textbf{ADRAN A} --- Atebwch BOB cwestiwn (Cyfanswm marciau \total{sectiona})}% -\newcommand{\sectionBHeader}{\textbf{ADRAN B} --- Atebwch unrhyw DDAU chwestiwn (\total{sectionb} marc yr un)}% -\ifx\welsh\undefined% -\renewcommand{\sectionAHeader}{\textbf{SECTION A} --- Answer \textbf{ALL} questions (Total marks \total{sectiona})}% -\renewcommand{\sectionBHeader}{\textbf{SECTION B} --- Answer any \textbf{TWO} questions (\total{sectionb} marks each)}% -\fi% + \newcommand{\examtype}{ab}% + \renewcommand{\engTypeText}{\engATypeText} + \renewcommand{\welTypeText}{\welATypeText} }% \DeclareOption{twofour}{% -\newcommand{\examtype}{twofour}% -\newcommand{\engTypeText}{Answer \textbf{two} out of four questions.}% -\newcommand{\welTypeTest}{Atebwch \textbf{ddau} o'r pedwar cwestiwn.}% + \newcommand{\examtype}{twofour}% + \renewcommand{\engTypeText}{\engBTypeText} + \renewcommand{\welTypeText}{\welBTypeText} }% \DeclareOption{answers}{\PassOptionsToClass{\CurrentOption}{exam}}% \DeclareOption{draft}{\PassOptionsToClass{\CurrentOption}{exam}}% \ProcessOptions\relax% \ifx\examtype\undefined% -\ClassError{bangorexam}{An exam type option has not been defined; use ab or twofour in the class options.}% + \ClassError{bangorexam}{An exam type option has not been defined; use ab or twofour in the class options}% \fi% \LoadClass[a4paper,twoside,11pt,addpoints]{exam}% @@ -348,73 +355,77 @@ % Footer \pagestyle{headandfoot}% \coverfooter{}{}{\iflastpage{}{/ troi drosodd\\/ turn over}{}}% -\footer{}{}{\oddeven{}{\iflastpage{}{/ troi drosodd / turn over}}}% +\footer{}{}{\oddeven{}{\iflastpage{}{/ troi drosodd\\/ turn over}}}% % Cover Column Definition \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \SolutionEmphasis{\color{red}} +\CorrectChoiceEmphasis{\bfseries\color{red}} % ******************************************************************* % Configuration Macros % ******************************************************************* \newcounter{tmp} \newtotcounter{all} +\newtotcounter{tf} +\newtotcounter{sectiona} +\newtotcounter{sectionb} \newcommand{\school}[2] {% -\def \engSchool {\expandafter\MakeUppercase\expandafter{#1}}% -\def \welSchool {\expandafter\MakeUppercase\expandafter{#2}}% + \def \engSchool {\expandafter\MakeUppercase\expandafter{#1}}% + \def \welSchool {\expandafter\MakeUppercase\expandafter{#2}}% }% \newcommand{\module}[2]{% -\StrSubstitute{#1}{-}{}[\mTmp]% -\def \moduleCode {\expandafter\MakeUppercase\expandafter{\mTmp}}% -\def \moduleName {#2}% + \StrSubstitute{#1}{-}{}[\mTmp]% + \def \moduleCode {\expandafter\MakeUppercase\expandafter{\mTmp}}% + \def \moduleName {#2}% }% \newcommand{\examperiod}[1]{% -\setcounter{tmp}{\the\year}% -\ifnum \the\month>8% -\stepcounter{tmp}% -\newcommand{\examYear}{\arabic{tmp}}% -\else% -\newcommand{\examYear}{\arabic{tmp}}% -\fi% -\newcommand{\welSemesterText}{Arholiadau Diwedd Semester\ \welSemester}% -\newcommand{\engSemesterText}{End of Semester \engSemester\ Examinations}% -\ifthenelse{\equal{#1}{s1}}{% -\def \welSemester {Un}% -\def \engSemester {One}% -\def \welExamMonth {IONAWR}% -\def \engExamMonth {JANUARY}% -}{}% -\ifthenelse{\equal{#1}{s2}}{% -\def \welSemester {Dau}% -\def \engSemester {Two}% -\def \welExamMonth {MAI}% -\def \engExamMonth {MAY}% -}{}% -\ifthenelse{\equal{#1}{resit}}{% -\renewcommand{\welSemesterText}{Arholiadau Atodol}% -\renewcommand{\engSemesterText}{Supplementary Examination}% -\def \welExamMonth {AWST}% -\def \engExamMonth {AUGUST}% -}{}% + \setcounter{tmp}{\the\year}% + \ifnum \the\month>8% + \stepcounter{tmp}% + \newcommand{\examYear}{\arabic{tmp}}% + \else% + \newcommand{\examYear}{\arabic{tmp}}% + \fi% + \newcommand{\welSemesterText}{Arholiadau Diwedd Semester\ \welSemester}% + \newcommand{\engSemesterText}{End of Semester \engSemester\ Examinations}% + \ifthenelse{\equal{#1}{s1}}{% + \def \welSemester {Un}% + \def \engSemester {One}% + \def \welExamMonth {IONAWR}% + \def \engExamMonth {JANUARY}% + }{}% + \ifthenelse{\equal{#1}{s2}}{% + \def \welSemester {Dau}% + \def \engSemester {Two}% + \def \welExamMonth {MAI}% + \def \engExamMonth {MAY}% + }{}% + \ifthenelse{\equal{#1}{resit}}{% + \renewcommand{\welSemesterText}{Arholiadau Atodol}% + \renewcommand{\engSemesterText}{Supplementary Examination}% + \def \welExamMonth {AWST}% + \def \engExamMonth {AUGUST}% + }{}% } \newcommand{\timeallowed}[1]{% -\def \timeAllowed {#1}% + \def \timeAllowed {#1}% } \newcommand{\guidance}[1]{% -\def \guidance@a {#1}% -\def \guidance@b {#1}% + \def \guidance@a {#1}% + \def \guidance@b {#1}% } \newcommand{\guidancea}[1]{% -\def \guidance@a {#1}% + \def \guidance@a {#1}% } \newcommand{\guidanceb}[1]{% -\def \guidance@b {#1}% + \def \guidance@b {#1}% } % ******************************************************************* @@ -422,99 +433,122 @@ % ******************************************************************* \renewcommand{\maketitle}{% -\ifx\timeAllowed\undefined% -\ClassError{bangorexam}{The time allowed for this exam has not been defined (missing \backslash timealllowed?).}% -\fi% -\ifx\engExamMonth\undefined% -\ClassError{bangorexam}{The exam period for this exam has not been set (missing \backslash examperiod?).}% -\fi% -\ifx\moduleCode\undefined% -\ClassError{bangorexam}{The module details for this exam have not been specified (missing \backslash module?).}% -\fi% -\ifx\welSchool\undefined% -\ClassError{bangorexam}{The academic school setting this exam has not been defined (missing \backslash school?).}% -\fi% - -\begin{center} -\bfseries -\huge -PRIFYSGOL\\ -\large\mbox{}\\ -\huge -BANGOR\\ -\large\mbox{}\\ -\huge -UNIVERSITY - -\vfill -\Large -\welSchool \\ -\engSchool -\end{center} -\medskip -\large -\begin{tabular}{C{0.5\textwidth}C{0.5\textwidth}} -{\bf \welSemesterText\par\welExamMonth\ \examYear}\par\vspace*{\bigskipamount} -Amser a ganiateir:~\timeAllowed~awr &% -{\bf \engSemesterText\par\engExamMonth\ \examYear}\par\vspace*{\bigskipamount} -Time allowed:~\timeAllowed~hours -\end{tabular} - -\vspace*{20mm} -\LARGE -\begin{center} -{\bf \moduleCode\\ -\mbox{}\\ -\moduleName} - -\vfill -\large -{\welTypeText} \\ -{\engTypeText} \\ -\ - -\medskip -{\bf Total marks \total{all}} -\vfill -\end{center} + \ifx\timeAllowed\undefined% + \ClassError{bangorexam}{The time allowed for this exam has not been defined (missing timealllowed?)}% + \fi% + \ifx\engExamMonth\undefined% + \ClassError{bangorexam}{The exam period for this exam has not been set (missing examperiod?)}% + \fi% + \ifx\moduleCode\undefined% + \ClassError{bangorexam}{The module details for this exam have not been specified (missing module?)}% + \fi% + \ifx\welSchool\undefined% + \ClassError{bangorexam}{The academic school setting this exam has not been defined (missing school?)}% + \fi% + + \begin{center} + \bfseries + \huge + PRIFYSGOL\\ + \large\mbox{}\\ + \huge + BANGOR\\ + \large\mbox{}\\ + \huge + UNIVERSITY + + \vfill + \Large + \welSchool \\ + \engSchool + \end{center} + \medskip + \large + \begin{tabular}{C{0.5\textwidth}C{0.5\textwidth}} + {\bf \welSemesterText\par\welExamMonth\ \examYear}\par\vspace*{\bigskipamount} + Amser a ganiateir:~\timeAllowed~awr &% + {\bf \engSemesterText\par\engExamMonth\ \examYear}\par\vspace*{\bigskipamount} + Time allowed:~\timeAllowed~hours + \end{tabular} + + \vspace*{20mm} + \LARGE + \begin{center} + {\bf \moduleCode\\ + \mbox{}\\ + \moduleName} + + \vfill + \large + {\welTypeText} \\ + {\engTypeText} \\ + \ + + \medskip + {\bf Total marks \total{all}\\ + Cyfanswm Marciau \total{all}} + \vfill + \end{center} } \AtBeginDocument{ -\begin{coverpages} -\setlength{\hoffset}{0mm} -\setlength{\marginparwidth}{0pt} -\maketitle -\end{coverpages} -\pointsinrightmargin + \begin{coverpages} + \setlength{\hoffset}{0mm} + \setlength{\marginparwidth}{0pt} + \maketitle + \end{coverpages} + \pointsinrightmargin + \ifthenelse{\equal{\examtype}{twofour}}{ + \clearpage + {% + \LARGE + \textbf{\moduleCode: \quad \moduleName} + + \vspace*{8mm} + \large + \ifcsdef{guidance@a}{\normalsize\par\guidance@a}{}% + } + \vspace*{8mm} + }{}% } % ******************************************************************* % Section Commands % ******************************************************************* -\newcommand{\hassectiona}{false}% -\newcommand{\hassectionb}{false}% +\newcounter{seca} +\newcounter{secb} \newcommand{\inDoc}{none}% \newcommand{\sectiona} {% -\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{\\sectiona used in a 'two from four' exam.}}{}% -\ifthenelse{\equal{\hassectiona}{true}}{\ClassError{bangorexam}{There is already a \\sectiona in this exam.}}{}% -\renewcommand{\hassectiona}{true}% -\renewcommand{\inDoc}{secA}% -\clearpage -{% -\LARGE -\textbf{\moduleCode: \quad \moduleName} - -\vspace*{8mm} -\large -\sectionAHeader -\ifcsdef{guidance@a}{\normalsize\par\guidance@a}{}% -} -\vspace*{8mm} + \ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{Section A defined in a 'two from four' exam}\relax}{}% + \ifnumcomp{\value{seca}}{>}{0} + { + \ClassError{bangorexam}{There is already a Section A in this exam}\relax% + } + { + \stepcounter{seca}\relax% + } + \renewcommand{\inDoc}{secA}% + \clearpage + {% + \LARGE + \textbf{\moduleCode: \quad \moduleName} + + \vspace*{8mm} + \large + \sectionAHeader + \ifcsdef{guidance@a}{\normalsize\par\guidance@a}{}% + } + \vspace*{8mm} } \newcommand{\sectionb}{% -\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{\\sectionb used in a 'two from four' exam.}}{} -\ifthenelse{\equal{\hassectionb}{true}}{\ClassError{bangorexam}{There is already a \\sectionb in this exam.}}{} -\renewcommand{\hassectionb}{true} +\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{Section B defined in a 'two from four' exam}\relax}{} + \ifnumcomp{\value{secb}}{>}{0} + { + \ClassError{bangorexam}{There is already a Section B in this exam}\relax% + } + { + \stepcounter{secb}\relax% + } \renewcommand{\inDoc}{secB} \clearpage {% @@ -559,7 +593,23 @@ Time allowed:~\timeAllowed~hours \ifnumcomp{\value{sectionb}}{=}{#1}% {}% {% - \ClassError{bangorexam}{Section B question \arabic{question} does not have an equal number of points (Existing Section B question worth \arabic{sectionb})}% + \ClassError{bangorexam}{Section B question \arabic{question} does not have an equal number of points (Existing Section B question worth \arabic{sectionb})}\relax% + }% + }% + {}% + \edef\mytemp{{\examtype}}% + \expandafter\ifstrequal\mytemp{twofour}% + {% + \ifnumcomp{\value{tf}}{=}{0}% + {% + \addtocounter{tf}{#1}% + \addtocounter{all}{#1}% + \addtocounter{all}{#1}}% + {}% + \ifnumcomp{\value{tf}}{=}{#1}% + {}% + {% + \ClassError{bangorexam}{Question \arabic{question} does not have an equal number of points (Existing question(s) worth \arabic{tf})}\relax% }% }% {}% @@ -573,6 +623,35 @@ Time allowed:~\timeAllowed~hours \newcommand{\pointsdec}[1]{% \pointname{#1}\patchqnumaddpoints } + +% ******************************************************************* +% End of document validation +% ******************************************************************* + +\AtEndDocument{% + \edef\mytemp{{\examtype}}% + \expandafter\ifstrequal\mytemp{twofour}% + {% + \edef\mytmp{\numquestions}% + \expandafter\ifstrequal\mytmp{4}% + {\relax}% + {% + \ClassError{bangorexam}{There is/are only (\numquestions) question(s) defined, there should be four}\relax% + }% + }{% + \ifnumcomp{\value{seca}}{=}{0}% + {% + \ClassError{bangorexam}{There is no Section A defined in this exam}\relax% + }% + {\relax}% + \ifnumcomp{\value{secb}}{=}{0}% + {% + \ClassError{bangorexam}{There is no Section B defined in this exam}\relax% + }% + {\relax}% + }% +} + % \end{macrocode}%\iffalse % \begin{macrocode} % diff --git a/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls b/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls index 7f6030d316f..be0b9d44c5a 100644 --- a/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls +++ b/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls @@ -39,11 +39,11 @@ %% Right bracket \] Circumflex\^ Underscore\_ %% Grave accent \` Left brace\{ Vertical bar \| %% Right brace \} Tilde \~} -\def\version{1.0.0} +\def\version{1.1.0} \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{bangorexam}[2016/10/03 \version C. Gray] +\ProvidesClass{bangorexam}[2016/10/17 \version{}C. Gray] \RequirePackage[dvipsnames]{xcolor} @@ -56,7 +56,6 @@ \RequirePackage{color} \RequirePackage{etoolbox} \RequirePackage{graphicx} -\RequirePackage{ifthen} \RequirePackage{letltxmacro} \RequirePackage{newpxtext,newpxmath} \RequirePackage{totcount} @@ -65,33 +64,37 @@ \RequirePackage{courier} +\newcommand{\engATypeText}{Answer {\bf Section A} (compulsory) and {\bf any two} questions from {\bf Section B}.}% +\newcommand{\welATypeText}{Atebwch {\bf Adran A} (gorfodol) ac {\bf unrhyw ddau} gwestiwn o {\bf Adran B}.}% +\newcommand{\engBTypeText}{Answer \textbf{two} out of four questions.}% +\newcommand{\welBTypeText}{Atebwch \textbf{ddau} o'r pedwar cwestiwn.}% +\newcommand{\sectionAHeader}{\textbf{SECTION A} --- Answer \textbf{ALL} questions (Total marks \total{sectiona})}% +\newcommand{\sectionBHeader}{\textbf{SECTION B} --- Answer any \textbf{TWO} questions (\total{sectionb} marks each)}% + + \DeclareOption{welsh}{% \newcommand{\welsh}{true}% +\renewcommand{\sectionAHeader}{\textbf{ADRAN A} --- Atebwch BOB cwestiwn (Cyfanswm marciau \total{sectiona})}% +\renewcommand{\sectionBHeader}{\textbf{ADRAN B} --- Atebwch unrhyw DDAU chwestiwn (\total{sectionb} marc yr un)}% }% +\newcommand{\engTypeText}{} +\newcommand{\welTypeText}{} \DeclareOption{ab}{% -\newtotcounter{sectiona}% -\newtotcounter{sectionb} \newcommand{\examtype}{ab}% -\newcommand{\engTypeText}{Answer {\bf Section A} (compulsory) and {\bf any two} questions from {\bf Section B}.}% -\newcommand{\welTypeText}{Atebwch {\bf Adran A} (gorfodol) ac {\bf unrhyw ddau} gwestiwn o {\bf Adran B}.}% -\newcommand{\sectionAHeader}{\textbf{ADRAN A} --- Atebwch BOB cwestiwn (Cyfanswm marciau \total{sectiona})}% -\newcommand{\sectionBHeader}{\textbf{ADRAN B} --- Atebwch unrhyw DDAU chwestiwn (\total{sectionb} marc yr un)}% -\ifx\welsh\undefined% -\renewcommand{\sectionAHeader}{\textbf{SECTION A} --- Answer \textbf{ALL} questions (Total marks \total{sectiona})}% -\renewcommand{\sectionBHeader}{\textbf{SECTION B} --- Answer any \textbf{TWO} questions (\total{sectionb} marks each)}% -\fi% +\renewcommand{\engTypeText}{\engATypeText} +\renewcommand{\welTypeText}{\welATypeText} }% \DeclareOption{twofour}{% \newcommand{\examtype}{twofour}% -\newcommand{\engTypeText}{Answer \textbf{two} out of four questions.}% -\newcommand{\welTypeTest}{Atebwch \textbf{ddau} o'r pedwar cwestiwn.}% +\renewcommand{\engTypeText}{\engBTypeText} +\renewcommand{\welTypeText}{\welBTypeText} }% \DeclareOption{answers}{\PassOptionsToClass{\CurrentOption}{exam}}% \DeclareOption{draft}{\PassOptionsToClass{\CurrentOption}{exam}}% \ProcessOptions\relax% \ifx\examtype\undefined% -\ClassError{bangorexam}{An exam type option has not been defined; use ab or twofour in the class options.}% +\ClassError{bangorexam}{An exam type option has not been defined; use ab or twofour in the class options}% \fi% \LoadClass[a4paper,twoside,11pt,addpoints]{exam}% @@ -101,14 +104,18 @@ \pagestyle{headandfoot}% \coverfooter{}{}{\iflastpage{}{/ troi drosodd\\/ turn over}{}}% -\footer{}{}{\oddeven{}{\iflastpage{}{/ troi drosodd / turn over}}}% +\footer{}{}{\oddeven{}{\iflastpage{}{/ troi drosodd\\/ turn over}}}% \newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} \SolutionEmphasis{\color{red}} +\CorrectChoiceEmphasis{\bfseries\color{red}} \newcounter{tmp} \newtotcounter{all} +\newtotcounter{tf} +\newtotcounter{sectiona} +\newtotcounter{sectionb} \newcommand{\school}[2] {% \def \engSchool {\expandafter\MakeUppercase\expandafter{#1}}% @@ -169,16 +176,16 @@ \renewcommand{\maketitle}{% \ifx\timeAllowed\undefined% -\ClassError{bangorexam}{The time allowed for this exam has not been defined (missing \backslash timealllowed?).}% +\ClassError{bangorexam}{The time allowed for this exam has not been defined (missing timealllowed?)}% \fi% \ifx\engExamMonth\undefined% -\ClassError{bangorexam}{The exam period for this exam has not been set (missing \backslash examperiod?).}% +\ClassError{bangorexam}{The exam period for this exam has not been set (missing examperiod?)}% \fi% \ifx\moduleCode\undefined% -\ClassError{bangorexam}{The module details for this exam have not been specified (missing \backslash module?).}% +\ClassError{bangorexam}{The module details for this exam have not been specified (missing module?)}% \fi% \ifx\welSchool\undefined% -\ClassError{bangorexam}{The academic school setting this exam has not been defined (missing \backslash school?).}% +\ClassError{bangorexam}{The academic school setting this exam has not been defined (missing school?)}% \fi% \begin{center} @@ -220,7 +227,8 @@ Time allowed:~\timeAllowed~hours \ \medskip -{\bf Total marks \total{all}} +{\bf Total marks \total{all}\\ + Cyfanswm Marciau \total{all}} \vfill \end{center} } @@ -231,15 +239,32 @@ Time allowed:~\timeAllowed~hours \maketitle \end{coverpages} \pointsinrightmargin +\ifthenelse{\equal{\examtype}{twofour}}{ +\clearpage +{% +\LARGE +\textbf{\moduleCode: \quad \moduleName} + +\vspace*{8mm} +\large +\ifcsdef{guidance@a}{\normalsize\par\guidance@a}{}% +} +\vspace*{8mm} +}{}% } -\newcommand{\hassectiona}{false}% -\newcommand{\hassectionb}{false}% +\newcounter{seca} +\newcounter{secb} \newcommand{\inDoc}{none}% \newcommand{\sectiona} {% -\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{\\sectiona used in a 'two from four' exam.}}{}% -\ifthenelse{\equal{\hassectiona}{true}}{\ClassError{bangorexam}{There is already a \\sectiona in this exam.}}{}% -\renewcommand{\hassectiona}{true}% +\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{Section A defined in a 'two from four' exam}\relax}{}% +\ifnumcomp{\value{seca}}{>}{0} +{ +\ClassError{bangorexam}{There is already a Section A in this exam}\relax% +} +{ +\stepcounter{seca}\relax% +} \renewcommand{\inDoc}{secA}% \clearpage {% @@ -255,9 +280,14 @@ Time allowed:~\timeAllowed~hours } \newcommand{\sectionb}{% -\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{\\sectionb used in a 'two from four' exam.}}{} -\ifthenelse{\equal{\hassectionb}{true}}{\ClassError{bangorexam}{There is already a \\sectionb in this exam.}}{} -\renewcommand{\hassectionb}{true} +\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{Section B defined in a 'two from four' exam}\relax}{} +\ifnumcomp{\value{secb}}{>}{0} +{ +\ClassError{bangorexam}{There is already a Section B in this exam}\relax% +} +{ +\stepcounter{secb}\relax% +} \renewcommand{\inDoc}{secB} \clearpage {% @@ -299,7 +329,23 @@ Time allowed:~\timeAllowed~hours \ifnumcomp{\value{sectionb}}{=}{#1}% {}% {% - \ClassError{bangorexam}{Section B question \arabic{question} does not have an equal number of points (Existing Section B question worth \arabic{sectionb})}% + \ClassError{bangorexam}{Section B question \arabic{question} does not have an equal number of points (Existing Section B question worth \arabic{sectionb})}\relax% + }% + }% + {}% + \edef\mytemp{{\examtype}}% + \expandafter\ifstrequal\mytemp{twofour}% +{% + \ifnumcomp{\value{tf}}{=}{0}% + {% + \addtocounter{tf}{#1}% + \addtocounter{all}{#1}% + \addtocounter{all}{#1}}% + {}% + \ifnumcomp{\value{tf}}{=}{#1}% + {}% + {% + \ClassError{bangorexam}{Question \arabic{question} does not have an equal number of points (Existing question(s) worth \arabic{tf})}\relax% }% }% {}% @@ -313,6 +359,32 @@ Time allowed:~\timeAllowed~hours \newcommand{\pointsdec}[1]{% \pointname{#1}\patchqnumaddpoints } + + +\AtEndDocument{% +\edef\mytemp{{\examtype}}% + \expandafter\ifstrequal\mytemp{twofour}% + {% + \edef\mytmp{\numquestions}% +\expandafter\ifstrequal\mytmp{4}% +{\relax}% +{% +\ClassError{bangorexam}{There is/are only (\numquestions) question(s) defined, there should be four}\relax% +}% + }{% + \ifnumcomp{\value{seca}}{=}{0}% + {% +\ClassError{bangorexam}{There is no Section A defined in this exam}\relax% +}% + {\relax}% + \ifnumcomp{\value{secb}}{=}{0}% + {% +\ClassError{bangorexam}{There is no Section B defined in this exam}\relax% +}% + {\relax}% + }% +} + \endinput %% %% End of file `bangorexam.cls'. -- cgit v1.2.3