diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/bangorexam')
-rw-r--r-- | Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls | 134 |
1 files changed, 103 insertions, 31 deletions
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'. |