summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bangorexam
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-10-09 22:05:14 +0000
committerKarl Berry <karl@freefriends.org>2017-10-09 22:05:14 +0000
commit23af24470baf53702b88e463e7417e6daf136d2b (patch)
tree50d7d90d266c7af2e9413a5acd0c5a28a3f37abb /Master/texmf-dist/tex/latex/bangorexam
parent3632dda64505cbe7a67e1b1f0f517c7623198257 (diff)
bangorexam (9oct17)
git-svn-id: svn://tug.org/texlive/trunk@45507 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bangorexam')
-rw-r--r--Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls65
1 files changed, 40 insertions, 25 deletions
diff --git a/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls b/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls
index 92ba16031b6..6af1d8e97e7 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.2.2 }
+\def\version{1.3.0 }
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{bangorexam}[2017/04/11 \version C. Gray]
+\ProvidesClass{bangorexam}[2017/10/06 \version C. Gray]
\RequirePackage[dvipsnames]{xcolor}
@@ -55,6 +55,7 @@
\RequirePackage{array}
\RequirePackage{color}
\RequirePackage{etoolbox}
+\RequirePackage{forloop}
\RequirePackage{graphicx}
\RequirePackage{letltxmacro}
\RequirePackage{newpxtext,newpxmath}
@@ -64,38 +65,47 @@
\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{\engATypeText}{Answer {\bf Section A} (compulsory) and {\bf any \arabic{qN}} questions from {\bf Section B}.}%
+\newcommand{\welATypeText}{Atebwch {\bf Adran A} (gorfodol) ac {\bf unrhyw \arabic{qN}} gwestiwn o {\bf Adran B}.}%
+\newcommand{\engBTypeText}{Answer any \textbf{\arabic{qN}} questions.}%
+\newcommand{\welBTypeText}{Atebwch unrhyw \textbf{\arabic{qN}} o'r pedwar cwestiwn.}%
\newcommand{\engCTypeText}{Answer all questions.}%
\newcommand{\welCTypeText}{Atebwch bob 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)}%
+\newcommand{\sectionBHeader}{\textbf{SECTION B} --- Answer any \textbf{\arabic{qN}} questions (\total{sectionb} marks each)}%
\newcommand{\sectionAOnlyHeader}{Answer \textbf{ALL} questions (Total marks \total{sectiona})}%
\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)}%
+\renewcommand{\sectionBHeader}{\textbf{ADRAN B} --- Atebwch unrhyw \textbf{\arabic{qN}} chwestiwn (\total{sectionb} marc yr un)}%
\renewcommand{\sectionAOnlyHeader}{Atebwch \textbf{BOB} cwestiwn (Cyfanswm marciau \total{sectiona})}%
}%
+\newcounter{qN}
+\newcommand{\nfrom}[1]{\setcounter{qN}{#1}}
\newcommand{\engTypeText}{}
\newcommand{\welTypeText}{}
\DeclareOption{ab}{%
\newcommand{\examtype}{ab}%
\renewcommand{\engTypeText}{\engATypeText}%
\renewcommand{\welTypeText}{\welATypeText}%
+\nfrom{2}%
}%
\DeclareOption{aonly}{%
\newcommand{\examtype}{aonly}%
\renewcommand{\engTypeText}{\engCTypeText}%
\renewcommand{\welTypeText}{\welCTypeText}%
-\renewcommand{\sectionAHeader}{\sectionAOnlyHeader}
+\renewcommand{\sectionAHeader}{\sectionAOnlyHeader}%
}%
\DeclareOption{twofour}{%
-\newcommand{\examtype}{twofour}%
+\newcommand{\examtype}{nfrom}%
+\renewcommand{\engTypeText}{\engBTypeText}%
+\renewcommand{\welTypeText}{\welBTypeText}%
+\nfrom{2}%
+}%
+\DeclareOption{nfrom}{%
+\newcommand{\examtype}{nfrom}%
\renewcommand{\engTypeText}{\engBTypeText}%
\renewcommand{\welTypeText}{\welBTypeText}%
}%
@@ -104,7 +114,7 @@
\ProcessOptions\relax%
\ifx\examtype\undefined%
-\ClassError{bangorexam}{An exam type option has not been defined; use ab, aonly, or twofour in the class options.}%
+\ClassError{bangorexam}{An exam type option has not been defined; use ab, aonly, or nfrom in the class options.}%
\fi%
\LoadClass[a4paper,twoside,11pt,addpoints]{exam}%
@@ -129,6 +139,7 @@
\newcounter{lq}
\newcounter{lqp}
\setcounter{lq}{-1}
+\newcounter{loopnu}
\newcommand{\school}[2] {%
\def \engSchool {\expandafter\MakeUppercase\expandafter{#1}}%
@@ -253,7 +264,7 @@ Time allowed:~\timeAllowed~hours
\end{coverpages}
\setcounter{page}{2}
\pointsinrightmargin
-\ifthenelse{\equal{\examtype}{twofour}}{
+\ifthenelse{\equal{\examtype}{nfrom}}{
\clearpage
{%
\LARGE
@@ -272,7 +283,7 @@ Time allowed:~\timeAllowed~hours
\newcounter{secb}
\newcommand{\inDoc}{none}%
\newcommand{\sectiona} {%
-\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{Section A defined in a 'two from four' exam.}\relax}{}%
+\ifthenelse{\equal{\examtype}{nfrom}}{\ClassError{bangorexam}{Section A defined in a 'n-from' exam.}\relax}{}%
\ifnumcomp{\value{seca}}{>}{0}
{
\ClassError{bangorexam}{There is already a Section A in this exam.}\relax%
@@ -295,7 +306,7 @@ Time allowed:~\timeAllowed~hours
}
\newcommand{\sectionb}{%
-\ifthenelse{\equal{\examtype}{twofour}}{\ClassError{bangorexam}{Section B defined in a 'two from four' exam.}\relax}{}
+\ifthenelse{\equal{\examtype}{nfrom}}{\ClassError{bangorexam}{Section B defined in an 'n-from' exam.}\relax}{}
\ifthenelse{\equal{\examtype}{aonly}}{\ClassError{bangorexam}{Section B defined in an 'A only' exam.}\relax}{}
\ifnumcomp{\value{secb}}{>}{0}
{
@@ -362,8 +373,8 @@ Time allowed:~\timeAllowed~hours
\ifnumcomp{\value{sectionb}}{=}{0}%
{%
\addtocounter{sectionb}{#1}%
- \addtocounter{all}{#1}%
- \addtocounter{all}{#1}}%
+ \forloop{loopnu}{0}{\value{loopnu} < \value{qN}}{%
+ \addtocounter{all}{#1}}}%
{}%
\ifnumcomp{\value{sectionb}}{=}{#1}%
{}%
@@ -376,13 +387,13 @@ Time allowed:~\timeAllowed~hours
}%
{}%
\edef\mytemp{{\examtype}}%
- \expandafter\ifstrequal\mytemp{twofour}%
+ \expandafter\ifstrequal\mytemp{nfrom}%
{%
\ifnumcomp{\value{tf}}{=}{0}%
{%
\addtocounter{tf}{#1}%
- \addtocounter{all}{#1}%
- \addtocounter{all}{#1}}%
+ \forloop{loopnu}{0}{\value{loopnu} < \value{qN}}{%
+ \addtocounter{all}{#1}}}%
{}%
\ifnumcomp{\value{tf}}{=}{#1}%
{}%
@@ -411,14 +422,18 @@ Time allowed:~\timeAllowed~hours
\AfterEndDocument{%
\edef\mytemp{{\examtype}}%
- \expandafter\ifstrequal\mytemp{twofour}%
+ \expandafter\ifstrequal\mytemp{nfrom}%
{%
\edef\mytmp{\numquestions}%
-\expandafter\ifstrequal\mytmp{4}%
-{\relax}%
-{%
-\ClassError{bangorexam}{There is/are only (\numquestions) question(s) defined, there should be four.}\relax%
-}%
+\expandafter\ifnum\value{numquestions}>\value{qN}%
+\relax%
+\else%
+\ifnum\value{numquestions}=\value{qN}%
+\relax%
+\else%
+\ClassError{bangorexam}{There is/are only (\numquestions) question(s) defined, there should be at least \arabic{qN}.}\relax%
+\fi
+\fi%
}{%
\ifnumcomp{\value{seca}}{=}{0}%
{%