diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/bangorexam/README.txt | 14 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf | bin | 181698 -> 182901 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx | 87 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls | 65 |
4 files changed, 105 insertions, 61 deletions
diff --git a/Master/texmf-dist/doc/latex/bangorexam/README.txt b/Master/texmf-dist/doc/latex/bangorexam/README.txt index 2d299cbb4ca..f9cdd1f8d64 100644 --- a/Master/texmf-dist/doc/latex/bangorexam/README.txt +++ b/Master/texmf-dist/doc/latex/bangorexam/README.txt @@ -1,7 +1,7 @@ Bangor University Computer Science Department Exam Document Class Cameron Gray <c.gray@bangor.ac.uk> -March 14, 2017 +October 6, 2017 Abstract Starting with the 2016/17 academic year, the Computer Science department at @@ -16,15 +16,17 @@ to produce an examination paper, including examiner’s copies with solutions in The document class is activated (or loaded) using the usual LATEX command \documentclass{bangorexam}. The class requires one of the following options to control which ‘style’ of exam paper is produced. -[ab] - produces a compulsory Section A and a ‘two from three’ Section B exam. +[ab] - produces a compulsory Section A and an ‘n-from’ Section B exam. This type defaults to 2 required to match previous behaviour. [aonly] - produces a single section, all questions compulsory exam. -[twofour] - produces a single part ‘two from four’ exam. +[nfrom] - produces a single part ‘n-from’ exam. The ‘answers’ option controls the inclusion of solutions as part of the output. \documentclass[ab]{bangorexam} - produces the student form of a Section A/B exam paper. -\documentclass[ab,answers]{bangorexam} - produces the examiner form of the -paper. + +\documentclass[ab]{bangorexam} - produces the student form of a Section A/B exam paper. +\documentclass[aonly]{bangorexam} - produces the student form of an exam paper where all questions are compulsory. +\documentclass[nfrom]{bangorexam} - produces the student form of an exam paper with a single section but n-from the total questions. \documentclass[ab,answers]{bangorexam} - produces the examiner form of the paper. 2 Usage - Preamble Macros @@ -39,6 +41,8 @@ set important aspects such as the module code and title. \timeallowed{hours} The amount of time allowed in hours. This should be the numerical part only, e.g. \timeallowed{1\half} or \timeallowed{3}. +\nfrom{number} The number of compulsory questions from the selection available in the options part of the exam. + 3 Usage - Body Macros Various macros exist to typeset the questions within the exam paper. The macros listed diff --git a/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf b/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf Binary files differindex e0d47f87b85..c7e7d8abafb 100644 --- a/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf +++ b/Master/texmf-dist/doc/latex/bangorexam/bangorexam.pdf diff --git a/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx b/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx index 499a0b21e37..e50e0ede6fe 100644 --- a/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx +++ b/Master/texmf-dist/source/latex/bangorexam/bangorexam.dtx @@ -40,7 +40,7 @@ \end{document} %</driver> %\fi -%\CheckSum{589} +%\CheckSum{627} %\RecordChanges %\changes{v1.0}{2016/09/26}{Initial version.} %\changes{v1.1}{2016/10/17}{Added two from four exam mode.} @@ -52,10 +52,11 @@ %\changes{v1.2.0}{2017/03/14}{Added A-Only Exam Type.} %\changes{v1.2.1}{2017/04/11}{Corrected a spelling mistake in Welsh.} %\changes{v1.2.2}{2017/06/26}{Changed resit description to 'Summer' due to change in regulations.} +%\changes{v1.3.0}{2017/10/06}{Replaced exam types with generalised n-from forms, with or without a compulsory Section A.} %\pagestyle{fancy} %\title{Bangor University Computer Science Department\\ Exam Document Class} %\author{Cameron Gray \texttt{<c.gray@bangor.ac.uk>}} -%\date{March 14, 2017} +%\date{October 6, 2017} %\maketitle % %\begin{abstract} @@ -74,12 +75,12 @@ %|\documentclass{bangorexam}|. The class requires one of the following options %to control which `style' of exam paper is produced. % -%\oarg{ab} - produces a compulsory Section A and a `two from three' Section B -%exam. +%\oarg{ab} - produces a compulsory Section A and a `n-from' Section B +%exam. This type defaults to 2 required to match previous behaviour. % %\oarg{aonly} - produces a single section, all questions compulsory exam. % -%\oarg{twofour} - produces a single part `two from four' exam. +%\oarg{nfrom} - produces a single part `n-from' exam. % %The `answers' option controls the inclusion of solutions as part of the %output. @@ -90,6 +91,9 @@ %|\documentclass[aonly]{bangorexam}| - produces the student form of an exam %paper where all questions are compulsory. % +%|\documentclass[nfrom]{bangorexam}| - produces the student form of an exam +%paper with a single section but n-from the total questions. +% %|\documentclass[ab,answers]{bangorexam}| - produces the examiner form of the %paper. % @@ -111,7 +115,7 @@ % %\DescribeMacro{\examperiod\marg{resit\textbar{}s1\textbar{}s2}} Specifies %the period of the exam, s1 for January/End of Semester 1, s2 for May/End of -%Semester 2, or resit for Supplementary exams (August Resits). +%Semester 2, or resit for Supplementary exams (Summer Resits). % %\ \\ % @@ -121,6 +125,11 @@ % %\ \\ % +%\DescribeMacro{\nfrom\marg{number}} The number of compulsory questions from +%the selection available in the options part of the exam. +% +%\ \\ +% %\section{Usage - Body Macros} %Various macros exist to typeset the questions within the exam paper. The %macros listed here are provided to comply with Bangor University's style and @@ -287,11 +296,11 @@ %\end{macrocode} %\fi %\begin{macrocode} -\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] % Based on the Exam document class by Philip S. Hirschhorn % Developed/Adapted for Bangor University by C. Gray @@ -305,6 +314,7 @@ \RequirePackage{array} \RequirePackage{color} \RequirePackage{etoolbox} +\RequirePackage{forloop} \RequirePackage{graphicx} \RequirePackage{letltxmacro} \RequirePackage{newpxtext,newpxmath} @@ -317,14 +327,14 @@ % 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{\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})}% % ******************************************************************* @@ -336,26 +346,35 @@ \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})}% }% % Exam Type % ------------------------------------------------------------------- +\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}% }% @@ -364,7 +383,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}% @@ -398,6 +417,8 @@ \newcounter{lq} \newcounter{lqp} \setcounter{lq}{-1} +\newcounter{loopnu} + \newcommand{\school}[2] {% \def \engSchool {\expandafter\MakeUppercase\expandafter{#1}}% @@ -525,7 +546,7 @@ \end{coverpages} \setcounter{page}{2} \pointsinrightmargin - \ifthenelse{\equal{\examtype}{twofour}}{ + \ifthenelse{\equal{\examtype}{nfrom}}{ \clearpage {% \LARGE @@ -547,7 +568,7 @@ \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% @@ -570,7 +591,7 @@ } \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} { @@ -640,8 +661,8 @@ \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}% {}% @@ -654,13 +675,13 @@ }% {}% \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}% {}% @@ -695,14 +716,18 @@ \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}% {% 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}% {% |