summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bangorexam
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-10-09 22:59:03 +0000
committerKarl Berry <karl@freefriends.org>2016-10-09 22:59:03 +0000
commitca8c7aacb845a15368d8eb5901ad86a0d821c7ca (patch)
treef9b5bab83aee9611b4f3bcc7a938aad524c48423 /Master/texmf-dist/tex/latex/bangorexam
parent08b96c312c68a33902a948ab94b27b779eaed4cf (diff)
bangorexam (9oct16)
git-svn-id: svn://tug.org/texlive/trunk@42242 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/bangorexam')
-rw-r--r--Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls318
1 files changed, 318 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls b/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls
new file mode 100644
index 00000000000..7f6030d316f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/bangorexam/bangorexam.cls
@@ -0,0 +1,318 @@
+%%
+%% This is file `bangorexam.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bangorexam.dtx (with options: `bangorexam.cls,package')
+%%
+%% bangorexam.dtx
+%% Copyright 2016 Cameron Gray/Bangor University <c.gray@bangor.ac.uk>
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license of (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Cameron Gray <c.gray@bangor.ac.uk>.
+%%
+%% This work consists of the files bangorexam.dtx and bangorexam.ins and the derived
+%% file bangorexam.cls.
+%%
+%% \CharacterTable
+%% {Upper-case\A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits\0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar\$ Percent \% Ampersand \&
+%% Acute accent \' Left paren\( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals\= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex\^ Underscore\_
+%% Grave accent \` Left brace\{ Vertical bar \|
+%% Right brace \} Tilde \~}
+\def\version{1.0.0}
+
+\NeedsTeXFormat{LaTeX2e}
+
+\ProvidesClass{bangorexam}[2016/10/03 \version C. Gray]
+
+
+\RequirePackage[dvipsnames]{xcolor}
+\RequirePackage[T1]{fontenc}
+\RequirePackage[UKenglish]{babel}
+\RequirePackage[UKenglish]{isodate}
+\RequirePackage[utf8]{inputenc}
+
+\RequirePackage{array}
+\RequirePackage{color}
+\RequirePackage{etoolbox}
+\RequirePackage{graphicx}
+\RequirePackage{ifthen}
+\RequirePackage{letltxmacro}
+\RequirePackage{newpxtext,newpxmath}
+\RequirePackage{totcount}
+\RequirePackage{xstring}
+
+\RequirePackage{courier}
+
+
+\DeclareOption{welsh}{%
+\newcommand{\welsh}{true}%
+}%
+\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%
+}%
+\DeclareOption{twofour}{%
+\newcommand{\examtype}{twofour}%
+\newcommand{\engTypeText}{Answer \textbf{two} out of four questions.}%
+\newcommand{\welTypeTest}{Atebwch \textbf{ddau} o'r pedwar cwestiwn.}%
+}%
+\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.}%
+\fi%
+
+\LoadClass[a4paper,twoside,11pt,addpoints]{exam}%
+
+\setlength{\parindent}{0mm}%
+\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}%
+
+\pagestyle{headandfoot}%
+\coverfooter{}{}{\iflastpage{}{/ troi drosodd\\/ turn over}{}}%
+\footer{}{}{\oddeven{}{\iflastpage{}{/ troi drosodd / turn over}}}%
+
+\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
+
+\SolutionEmphasis{\color{red}}
+
+\newcounter{tmp}
+\newtotcounter{all}
+
+\newcommand{\school}[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}%
+}%
+\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}%
+}{}%
+}
+
+\newcommand{\timeallowed}[1]{%
+\def \timeAllowed {#1}%
+}
+
+\newcommand{\guidance}[1]{%
+\def \guidance@a {#1}%
+\def \guidance@b {#1}%
+}
+
+\newcommand{\guidancea}[1]{%
+\def \guidance@a {#1}%
+}
+
+\newcommand{\guidanceb}[1]{%
+\def \guidance@b {#1}%
+}
+
+
+\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}
+}
+\AtBeginDocument{
+\begin{coverpages}
+\setlength{\hoffset}{0mm}
+\setlength{\marginparwidth}{0pt}
+\maketitle
+\end{coverpages}
+\pointsinrightmargin
+}
+
+\newcommand{\hassectiona}{false}%
+\newcommand{\hassectionb}{false}%
+\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}
+}
+
+\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}
+\renewcommand{\inDoc}{secB}
+\clearpage
+{%
+\large
+\sectionBHeader
+\ifcsdef{guidance@b}{\normalsize\par\guidance@b}{}%
+}
+\vspace*{8mm}
+}
+
+\renewcommand{\questionshook}{%
+ \edef\mytemp{{\inDoc}}%
+ \expandafter\ifstrequal\mytemp{secB}{\addtocounter{question}{100}}{}%
+}
+
+\renewcommand{\thequestion}{%
+ \edef\mytemp{{\inDoc}}%
+ \setcounter{tmp}{0}%
+ \addtocounter{tmp}{\value{question}}%
+ \expandafter\ifstrequal\mytemp{secB}{\addtocounter{tmp}{-100}\arabic{tmp}}{\arabic{question}}%
+}
+
+\newcommand{\be@adduppoints}[1]{%
+ \edef\mytemp{{\inDoc}}%
+ \expandafter\ifstrequal\mytemp{secA}%
+ {%
+ \addtocounter{sectiona}{#1}%
+ \addtocounter{all}{#1}%
+ }%
+ {}%
+ \expandafter\ifstrequal\mytemp{secB}%
+ {%
+ \ifnumcomp{\value{sectionb}}{=}{0}%
+ {%
+ \addtocounter{sectionb}{#1}%
+ \addtocounter{all}{#1}%
+ \addtocounter{all}{#1}}%
+ {}%
+ \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})}%
+ }%
+ }%
+ {}%
+}
+
+\newcommand{\patchqnumaddpoints}{%
+\be@adduppoints{\totalpoints}%
+}
+\pointformat{[\thepoints]}
+\pointname{\null\patchqnumaddpoints}
+\newcommand{\pointsdec}[1]{%
+\pointname{#1}\patchqnumaddpoints
+}
+\endinput
+%%
+%% End of file `bangorexam.cls'.