-
Notifications
You must be signed in to change notification settings - Fork 0
/
examx-styles.dtx
1560 lines (1431 loc) · 53.6 KB
/
examx-styles.dtx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% \iffalse meta-comment
%
% Copyright (C) 2022 by Sebastien Laclau
% -----------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in:
%
% https://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% \fi
%
% \iffalse
% \section{Identification}
%
% Announce the file name and its version:
%
% \begin{macrocode}
%<default&all>\ProvidesFile{examx-default.clo}
%<OCRALevel&all>\ProvidesFile{examx-OCRALevel.clo}
%<OCRALevel&answerbook>\ProvidesFile{examx-OCRALevelanswerbook.clo}
%<OCRALevel&formulaesheet>\ProvidesFile{examx-OCRALevelformulae.clo}
%<EdexcelGCSE&all>\ProvidesFile{examx-EdexcelGCSE.clo}
%<advanced&answerbook>\ProvidesFile{examx-advancedanswerbook.clo}
%<veryadvanced&answerbook>\ProvidesFile{examx-veryadvancedanswerbook.clo}
%<WellyOCR&covers>\ProvidesFile{examx-WellyOCRcovers.clo}
%<*driver>
\ProvidesFile{examx-styles.dtx}
%</driver>
[2022/05/09 v1.1.3
%<!driver> standard latex class option file]
%<*driver>
]
\documentclass{ltxdoc}
% \end{macrocode}
% Some things do not need indexing.
% \begin{macrocode}
\DoNotIndex{\AtEndOfClass, \AtEndEnvironment}
\DoNotIndex{\def, \gdef, \xdef, \let, \relax, \newif, \newcommand,
\renewcommand, \NewDocumentCommand, \RenewDocumentCommand}
\DoNotIndex{\,, \\, \vspace, \par, \baselineskip}
\DoNotIndex{\hline}
\DoNotIndex{\normalsize, \large, \Large, \LARGE, \huge}
\DoNotIndex{\bfseries, \textsc, \textcolor, \rm, \bf}
\DoNotIndex{\csname{else}, \cs{fi}}
\DoNotIndex{\csname{loop}, \csname{repeat}, \foreach, \breakforeach,
\m, \n, \x, \s}
\DoNotIndex{\begin, \end}
\DoNotIndex{\arabic, \alph, \Alph}
\DoNotIndex{\newcounter, \setcounter, \pgfmathsetcounter, \addtocounter}
\DoNotIndex{\lpos, \mpos, \rpos, \blankrow, \pageendrule,
\pagestartrule}
\DoNotIndex{\csname, \endcsname}
% \end{macrocode}
% We do want an index, using line numbers, and a change log.
% \begin{macrocode}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
% \end{macrocode}
% The following code retrieves the date and version information from
%the file.
% \begin{macrocode}
\GetFileInfo{examx-styles.dtx}
% \end{macrocode}
% Here are some commonly used abbreviations:
% \begin{macrocode}
\input{examx-ltxdoc-commands.def}
% \end{macrocode}
% We also want the full details.
% \begin{macrocode}
\begin{document}
\DocInput{examx-styles.dtx}
\PrintIndex
\PrintChanges
\end{document}
%</driver>
% \end{macrocode}
%
% \fi
%
% \CheckSum{0}
%
% \changes{v1.0}{2022/01/31}{Initial version}
% \changes{v1.1.1}{2022/02/03}{Start of semver}
% \changes{v1.1.2}{2022/03/10}{Implemented \Lopt{fourside}}
%
%
%
% \title{Styles for the \textsf{examx} class\thanks{This document
% corresponds to \file{examx-styles.dtx}~\fileversion,
% dated \filedate.}}
% \author{Sebastien Laclau \\ \texttt{[email protected]} \\ \texttt{[email protected]}}
%
% \maketitle
%
% \tableofcontents
%
% \StopEventually{}
% \section{The {\sc docstrip} modules}
%
% The following modules are used in the implementation to direct
% {\sc docstrip} in generating the external files. The first set refer
%to styles, complete or incomplete. The next set are secondary guards
%used to separate between parts of a style and the whole style.
%Finally,
%there is the driver guard:
% \begin{center}
% \begin{tabular}{p{0.3\textwidth}p{0.6\textwidth}}
% default & produce the style used by default \\
% OCRALevel & imitates the style of an OCR A Level
%paper \\
% WellyOCR & incomplete style used for covers only
%\\
% advanced & incomplete style used for answerbook
%only \\
% veryadvanced & incomplete style used for answerbook
%only \\
% \hline
% all & included in the complete style \\
% covers & included in the cover style \\
% answerbook & included in the answer book style \\
% formulaesheet & included in the formulae sheet style
%\\
% answerbookbackcover & used to include the default answer
%book back covers in other styles \\
% \hline
% driver & produce a documentation driver file
% \end{tabular}
% \end{center}
%
%\section{Complete styles}
%\subsection{Default style}
% \begin{macrocode}
%<*default>
%<*all>
\solndots
\renewcommand{\questionpaperend}{
\footer{}{}{}
\begin{center}
\ifprintanswers {\bfseries END OF MARKSCHEME} \else {\bfseries
END OF QUESTION PAPER} \fi
\oddeven{\newpage {\bfseries This page is intentionally
blank}}{}
\ifexamx@fourside
\ifnum\the\numexpr(\thepage/4)*4-\thepage\relax=2
\newpage {\bfseries This page is intentionally blank}
\newpage {\bfseries This page is intentionally blank}
\fi
\fi
\end{center}
}
%</all>
% \end{macrocode}
%\subsubsection{Answer book}
% \begin{macrocode}
%<*answerbookbackcover|answerbook|all>
\renewcommand{\answerbookbackcover}{
\begin{center}
\large\bfseries ADDITIONAL ANSWER SPACE
\end{center}
If additional space is required, you should use the following lined
page(s). The question number(s) must be clearly shown in the
margin(s).
\fillwithdottedlines{\stretch{1}}
\ifexamx@fourside
\ifnum\the\numexpr(\thepage/4)*4-\thepage\relax=2
\newpage
\fillwithdottedlines{\stretch{1}}
\newpage
\fillwithdottedlines{\stretch{1}}
\fi
\fi
}
\renewcommand{\doubleanswerbookbackcover}{
\begin{center}
\large\bfseries ADDITIONAL ANSWER SPACE
\end{center}
If additional space is required, you should use the following lined
page(s). The question number(s) must be clearly shown in the
margin(s).
\fillwithdottedlines{\stretch{1}}
\newpage
\fillwithdottedlines{\stretch{1}}
\ifexamx@fourside
\ifnum\the\numexpr(\thepage/4)*4-\thepage=2
\newpage
\fillwithdottedlines{\stretch{1}}
\newpage
\fillwithdottedlines{\stretch{1}}
\fi
\fi
}
%</answerbookbackcover|answerbook|all>
%</default>
% \end{macrocode}
%\subsection{OCRALevel style}
%\subsubsection{Initial code}
% The initial code configures various features of the examx
%class.
% \begin{macrocode}
%<*OCRALevel>
%<*all>
\@alwaysdroppointsatright
\soln
\sisetup{inter-unit-product = \,}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\setmathfont[math-style=ISO,bold-style=ISO]{TeX Gyre Termes Math}
\setsansfont{Arial}
\titleformat{\section}{\bfseries\centering}{Section \Alph{section}:
}{0pt}{}[\@storequestiondata{\arabic{section}}{1}{-1}{0}{\relax}
\label{sec:\Alph{section}}%
]
\newgeometry{left=0.86 in,right=1.14 in,top=1 in,bottom=1 in}
\savegeometry{main}
\newgeometry{left=0.68 in,right=0.68 in,top=1 in,bottom=1 in}
\savegeometry{answerbook}
\loadgeometry{main}
\footer{}{}{\bfseries\oddeven{Turn over}{}}
\header{}{\bfseries \thepage}{}
\renewcommand{\questionstart}{
\ifprintanswers \else
\begin{center}
Answer {\bfseries all} the questions.
\end{center}
\fi
}
\renewcommand{\questionshook}{\setlength{\itemsep}{1in}}
\renewcommand{\partshook}{\setlength{\topsep}{\baselineskip}
\setlength{\itemsep}{\baselineskip}}
\renewcommand{\solnorhook}{
\renewcommand{\partshook}{\setlength{\itemsep}{\baselineskip}}
}
\renewcommand{\questionlabel}{\bfseries\thequestion.}
\renewcommand{\partlabel}{\bfseries(\thepartno)}
\renewcommand{\subpartlabel}{\bfseries(\thesubpart)}
\renewcommand{\subsubpartlabel}{\bfseries(\thesubsubpart)}
\pointname{}
\pointformat{\bfseries[\thepoints]}
\renewcommand{\vec}[1]{{\bf#1}}
\newcommand{\detailedreasoning}{\textbf{In this question you must show detailed reasoning.} \par }
%</all>
\RequirePackage{lscape}
\RequirePackage{afterpage}
\RequirePackage{multirow}
\RequirePackage{enumitem}
\RequirePackage{xstring}
\RequirePackage{microtype}
% \end{macrocode}
%
%\subsubsection{Covers}
%\begin{macro}{\examcover}
% This code redefines the front cover of the question paper.
% \begin{macrocode}
%<*covers|all>
\renewcommand{\examcover}{
\newgeometry{top=1.5cm, bottom=1cm, left=2.8cm, right=2.2cm}
\thispagestyle{empty}
\if\@logo\relax\else\includegraphics[height=2cm]{\@logo}\fi
\vspace{2mm}
{\sffamily
{\LARGE \textbf{\@examdate}}
\vspace{8pt}
{\Large \textbf{\@examtitle}}
\vspace{8pt}
{\large \unless\if\@examcode\relax\textbf{\@examcode} $\quad$\fi\@examtopic}
\vspace{8pt}
{\normalsize \textbf{Time allowed: \@examtime}}
\vspace{12pt}
\begin{tikzpicture}
\node[draw, text width=7.87cm, text depth=4.19cm, rounded corners] at (0,0) {
{\footnotesize
\textbf{You must have:}
\ifanswerbook$\bullet$ Printed Answer Booklet \\ \fi
\ifcalculatorrequired$\bullet$ a scientific or graphical calculator \\ \fi
\ifcalculator
\vspace*{.5cm}
\textbf{You may use:}
$\bullet$ a scientific or graphical calculator \\
\fi
}
};
\end{tikzpicture}
\vspace{0.6cm}
\small
\textbf{INSTRUCTIONS}
\begin{itemize}[nolistsep]
\item Use black ink. You can use a HB pencil but only for graphs and diagrams.
\item Write your answer to each question in the space provided in the \textbf{Printed Answer Booklet.} If you need extra space use the lined pages at the end of the Printed Answer Booklet. The question numbers must be clearly shown.
\item Fill in the boxes on the front of the Printed Answer Booklet.
\item Answer \textbf{all} the questions.
\item Where appropriate, your answer should be supported with working. Marks might be given for using a correct method, even if your answer is wrong.
\item Give non-exact numerical answers correct to 3 significant figures unless a different degree of accuracy is specified in the question
\ifcalculator \item You are permitted to use a
scientific or graphical calculator in this paper.
\else \unless\ifcalculatorrequired \item You are not permitted to use a calculator in this paper. \fi \fi
\item The acceleration due to gravity is denoted by $\grav\,\unit{\m\per\s\squared}$. Unless otherwise instructed, when a numerical value is needed, use $\grav=9.8$.
\item Do \textbf{not} send this Question Paper for marking. Keep it in the centre or recycle it.
\end{itemize}
\vspace{4mm}
\small
\textbf{INFORMATION}
\begin{itemize}[nolistsep]
\item The total mark for this paper is {\bfseries \thetotalpoints}.
\item The marks for each question are shown in
brackets {\bfseries [ ]}.
\item This document consists of {\bfseries
\pageref{lastpageofquestionpaper}} pages.
\unless\if\@extrainfo\relax
\item {\let \\ \item \@extrainfo}
\fi
\end{itemize}
\vspace{4mm}
\small
\textbf{ADVICE}
\begin{itemize}[nolistsep]
\item Read each question carefully before you start an answer.
\if\@extraadvice\relax\else
\item {\let \\ \item \@extraadvice}
\fi
\end{itemize}
\vfill
\hfill{\footnotesize \textbf{Turn over}}}
\newpage
\loadgeometry{main}
\ifprintanswers \else \ifexamx@formulae
\formulaesheet \fi \fi
}
% \end{macrocode}
%\end{macro}
%\begin{macro}{\answerbookcover}
% This code redefines the front cover of the answer book.
% \begin{macrocode}
\renewcommand{\answerbookcover}{
\newgeometry{top=1.5cm, bottom=1cm, left=2.8cm, right=2.2cm}
\thispagestyle{empty}
\if\@logo\relax\else\includegraphics[height=2cm]{\@logo}\fi
\vspace{2mm}
{\sffamily
{\LARGE \textbf{\@examdate}}
\vspace{8pt}
{\Large \textbf{\@examtitle}}
\vspace{8pt}
{\large \unless\if\@examcode\relax\textbf{\@examcode} $\quad$\fi\@examtopic}
\vspace{8pt}
{\large Printed Answer Book}
\vspace{8pt}
{\normalsize \textbf{Time allowed: \@examtime}}
\vspace{12pt}
\begin{tikzpicture}
\node[draw, text width=7.87cm, text depth=3.18cm, rounded corners] at (0,0) {
{\footnotesize
\textbf{You must have:}
$\bullet$ Question Paper \\
\ifcalculatorrequired$\bullet$ a scientific or graphical calculator \\ \fi
\ifcalculator
\vspace*{.5cm}
\textbf{You may use:}
$\bullet$ a scientific or graphical calculator \\
\fi
}
};
\end{tikzpicture}
\setlength{\fboxsep}{0pt}
\newcommand\abox{%
\raisebox{-3mm}{\framebox[9.4mm]{\vline width 0mm height 9.4mm}}%
}
\begin{tikzpicture}
\node[draw, text width=15.6cm, text depth=4.60cm, rounded corners=0.5cm, inner sep=0.3cm] at (0,0) {
\normalsize {\small Please write clearly in black ink. \textbf{Do not write in the barcodes.}}
\vspace{0.5cm}
Centre number \abox\abox\abox\abox\abox \enspace\enspace\thinspace Candidate number \abox\abox\abox\abox
\vspace{0.8cm}
First name(s) \hspace{\stretch{1}} \rule{10cm}{0.15mm}
\vspace{0.4cm}
Last name \hspace{\stretch{1}} \rule{10cm}{0.15mm}
};
\end{tikzpicture}
\small
\textbf{INSTRUCTIONS}
\begin{itemize}[nolistsep]
\item Use black ink. You can use a HB pencil but only for graphs and diagrams.
\item Write your answer to each question in the space provided in the \textbf{Printed Answer Booklet.} If you need extra space use the lined pages at the end of the Printed Answer Booklet. The question numbers must be clearly shown.
\item Fill in the boxes on the front of the Printed Answer Booklet.
\item Answer \textbf{all} the questions.
\item Where appropriate, your answer should be supported with working. Marks might be given for using a correct method, even if your answer is wrong.
\item Give non-exact numerical answers correct to 3 significant figures unless a different degree of accuracy is specified in the question
\ifcalculator \item You are permitted to use a
scientific or graphical calculator in this paper.
\else \unless\ifcalculatorrequired \item You are not permitted to use a calculator in this paper. \fi \fi
\item The acceleration due to gravity is denoted by $\grav\,\unit{\m\per\s\squared}$. Unless otherwise instructed, when a numerical value is needed, use $\grav=9.8$.
\end{itemize}
\vspace{4mm}
\small
\textbf{INFORMATION}
\begin{itemize}[nolistsep]
\item The total mark for this paper is {\bfseries \thetotalpoints}.
\item The marks for each question are shown in
brackets {\bfseries [ ]}.
\item This document consists of {\bfseries
\pageref{LastPage}} pages.
\unless\if\@extrainfo\relax
\item {\let \\ \item \@extrainfo}
\fi
\end{itemize}
\vspace{4mm}
\small
\textbf{ADVICE}
\begin{itemize}[nolistsep]
\item Read each question carefully before you start an answer.
\if\@extraadvice\relax\else
\item {\let \\ \item \@extraadvice}
\fi
\end{itemize}
\vfill
\hfill{\footnotesize \textbf{Turn over}}}
\newpage
\loadgeometry{main}
}
%</covers|all>
% \end{macrocode}
%\end{macro}
%\changes{v1.13}{2022/05/23}{Added cover for OCR A Level -- thanks to JCB}
%\subsubsection{Formulae sheet}
%\begin{macro}{\formulaesheet}
% This code redefines the formulae sheet.
% \begin{macrocode}
%<*formulaesheet|all>
\newgeometry{left=0.86 in,right=0.86 in,top=1 in,bottom=1 in}
\savegeometry{formulaesheet}
\loadgeometry{main}
\def\preheading{\vspace{0.15 in}}
\def\postheading{\vspace{0.08 in}}
\newcommand{\heading}[1]{\preheading {\bfseries #1} \par \postheading}
\newcommand{\topheading}[1]{{\large\bfseries #1} \par}
\input{examx-formulae.def}
\newcommand{\mechformulaesheet}{
\loadgeometry{formulaesheet}
\mechformulae
\loadgeometry{main}
}
\newcommand{\pureformulaesheet}{
\loadgeometry{formulaesheet}
\pureformulae
\loadgeometry{main}
}
\newcommand{\statsformulaesheet}{
\loadgeometry{formulaesheet}
\statsformulae
\loadgeometry{main}
}
\newcommand{\formulaebookcover}{
\thispagestyle{empty}
\begin{center}
\Huge \bfseries Formulae book
\end{center}
\clearpage
}
\newcommand{\formulaebook}{
\setcounter{page}{1}
\formulaebookcover
\loadgeometry{formulaesheet}
\pureformulae
\statsformulae
\criticalvalues
\chisquared
\wilcoxon
\mechformulae
\discreteformulae
\additionalpureformulae
\loadgeometry{main}
}
%</formulaesheet|all>
% \end{macrocode}
%\changes{v1.1.3}{2022/05/06}{Added mech and stats formulae commands}
%\changes{v1.1.3}{2022/05/11}{Added discrete and additional pure
%formulae commands}
%\changes{v1.1.3}{2022/05/11}{Separated stats tables to own commands}
%\end{macro}
%\begin{macro}{\configureformulae}
% This macro replaces the standard formulae sheet with
%|\bespokeformulaesheets| and configures the aforementioned macro.
% \begin{macrocode}
\newif\ifno \nofalse
\newif\ifadd \addfalse
\newif\ifincludemech \includemechfalse
\newif\ifincludepure \includepurefalse
\newif\ifincludestats \includestatsfalse
\newif\ifincludechisquared \includechisquaredfalse
\newif\ifincludecriticalvalues \includecriticalvaluesfalse
\newif\ifincludewilcoxon \includewilcoxonfalse
\newif\ifincludediscrete \includediscretefalse
\newif\ifincludeadditional \includeadditionalfalse
\pgfkeys{/no/.code=\notrue}
\pgfkeys{/add/.code=\addtrue}
\pgfkeys{/pure/.code=\includepuretrue}
\pgfkeys{/statistics/.code=\includestatstrue}
\pgfkeys{/tables/.code=\includecriticalvaluestrue\includechisquaredtrue
\includewilcoxontrue}
\pgfkeys{/critical values/.code=\includecriticalvaluestrue}
\pgfkeys{/chisquared/.code=\includechisquaredtrue}
\pgfkeys{/wilcoxon/.code=\includewilcoxontrue}
\pgfkeys{/mechanics/.code=\includemechtrue}
\pgfkeys{/discrete/.code=\includediscretetrue}
\pgfkeys{/additional/.code=\includeadditionaltrue}
\newcommand{\configureformulae}[1][]{
\pgfkeys{#1}
\ifno
\renewcommand{\formulaesheet}{}
\else
\renewcommand{\formulaesheet}{\bespokeformulaesheets}
\fi
}
% \end{macrocode}
%\changes{v1.1.3}{2022/05/11}{Created macro}
%\end{macro}
%\begin{macro}{\bespokeformulaesheets}
% This macro produces a collection of formulae sheets depending on the values of the switches above.
% \begin{macrocode}
\let\oldformulaesheet\formulaesheet
\newcommand{\bespokeformulaesheets}{
\loadgeometry{formulaesheet}
\ifadd\oldformulaesheet\fi
\ifincludepure\pureformulae\fi
\ifincludestats\statsformulae\fi
\ifincludecriticalvalues\criticalvalues\fi
\ifincludechisquared\chisquared\fi
\ifincludewilcoxon\wilcoxon\fi
\ifincludemech\mechformulae\fi
\ifincludediscrete\discreteformulae\fi
\ifincludeadditional\additionalpureformulae\fi
\loadgeometry{main}
}
% \end{macrocode}
%\changes{v1.1.3}{2022/05/11}{Created macro}
%\end{macro}
%\changes{v1.0a}{2022/02/02}{Moved the definition of the OCR A Level
%formulae sheet to this file}
%\subsubsection{Answer book}
% The remaining code concerns the answer book.
%\begin{macro}{numberofquestions}
%\begin{macro}{maxlinesinpage}
%\begin{macro}{currentline}
%\begin{macro}{questionnumber}
%\begin{macro}{numlinesinquestion}
%\begin{macro}{numblanklinesinquestion}
%\begin{macro}{partlevel}
%\begin{macro}{linesleft}
%\begin{macro}{lastques}
%\begin{macro}{lastpart}
%\begin{macro}{tempa}
%\begin{macro}{tempb}
%\begin{macro}{tempc}
%\begin{macro}{\ifquestioncomplete}
% We begin by defining several counters, the names of the first eleven
%are self-explanatory, the remaining three are used as loop counters.
%We
%also define a switch used to check if a question has had all its lines
%written.
% \begin{macrocode}
%<*answerbook|all>
\newcounter{numberofquestions}
\newcounter{maxlinesinpage}
\setcounter{maxlinesinpage}{31}
\newcounter{currentline}
\newcounter{questionnumber}
\newcounter{numlinesinquestion}
\newcounter{numblanklinesinquestion}
\newcounter{partlevel}
\newcounter{linesleft}
\newcounter{lastques}
\newcounter{lastpart}
\newcounter{tempa}
\newcounter{tempb}
\newcounter{tempc}
\newif\ifquestioncomplete
% \end{macrocode}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
%\end{macro}
% We then define some constants used in the layout of the answer
%book. We also define some macros used to avoid repetition of commands.
% \begin{macrocode}
\def\lpos{0 in}
\def\mpos{0.59 in}
\def\rpos{6.89 in}
\def\lineheight{.76}
\newcommand{\blankrow}{
\draw (\mpos,-1-\thecurrentline)--(\rpos,-1-\thecurrentline);
\draw (\lpos,-\thecurrentline)--(\lpos,-1-\thecurrentline);
\draw (\mpos,-\thecurrentline)--(\mpos,-1-\thecurrentline);
\draw (\rpos,-\thecurrentline)--(\rpos,-1-\thecurrentline);
}
\newcommand{\pagestartrule}{
\draw (\lpos,0)--(\rpos,0);
}
\newcommand{\pageendrule}[1][\themaxlinesinpage]{
\draw (\lpos,-#1)--(\rpos,-#1);
}
% \end{macrocode}
%\begin{macro}{\answerbookpages}
% This is the main definition of this section. We begin by defining
%some helper macros to convert the data stored by |\storequestiondata|
%to counter values.
% \begin{macrocode}
\renewcommand{\answerbookpages}{
\newcounter{int}
\newcounter{arraycard}
\def\arrayLength##1{%
\setcounter{arraycard}{0}%
\foreach \x in ##1{%
\stepcounter{arraycard}%
}%
%
}
\newcommand{\setcountertoarraylength}[2]{
\arrayLength{##2}
\setcounter{##1}{\thearraycard}
}
% \end{macrocode}
% Then, we clear the footer and reset the page geometry.
% \begin{macrocode}
\footer{}{}{}
\loadgeometry{answerbook}
% \end{macrocode}
% Next, we initialize our counters: \Lcount{numberofquestions} to
%the length of the array holding question numbers and the remainder to
%one or zero as needed for looping.
%
% We also define some new macros to hold our arrays in order to
%acesss their contents.
% \begin{macrocode}
\setcountertoarraylength{numberofquestions}{\@questionorpartnumber}
\addtocounter{numberofquestions}{-1}
\xdef\qs{{\@questionorpartnumber}}
\xdef\lines{{\@lines}}
\xdef\ip{{\@partlevel}}
\xdef\blanklines{{\@blanklines}}
\setcounter{numlinesinquestion}{0}
\setcounter{numblanklinesinquestion}{0}
\setcounter{int}{1}
\setcounter{tempa}{1}
\setcounter{linesleft}{0}
% \end{macrocode}
% Now the main loop begins. This loop repeats once for each page in
%the answer book by comparing \Lcount{tempa} to
%\Lcount{numberofquestions}. The first step is to fill the page with
%blank lines.
% \begin{macrocode}
\loop
\begin{center}
\begin{tikzpicture}[yscale=\lineheight]
\pagestartrule
\setcounter{currentline}{0}
\foreach \n in {1,...,\themaxlinesinpage}{
\blankrow
\addtocounter{currentline}{1}
}
\pageendrule
% \end{macrocode}
% Next, we reset \Lcount{currentline} to 0 and reset \Lcount{int} to
%\Lcount{tempa}. We then loop through questions with array index at
%least the value of \Lcount{int}.
% \begin{macrocode}
\setcounter{currentline}{0}
\setcounter{int}{\thetempa}
\foreach \n in {\theint,...,\thenumberofquestions}{
% \end{macrocode}
% For each question, we store the question number and part level. If
%the previous question has non-zero lines left (only relevant at the
%start of a page) we write continued and set
%\Lcount{numlinesinquestion}
%to \Lcount{linesleft}. Otherwise we draw a thick line to end the
%previous part if necessary (and not the start of a page) and store the
%number of lines and the number of blank lines in the question.
% \begin{macrocode}
\pgfmathsetcounter{questionnumber}{\qs[\n]}
\pgfmathsetcounter{partlevel}{\ip[\n]}
\ifnum \thelinesleft>0
\draw[draw=none]
(\mpos,-1)--(\rpos,-1)node[pos=0.08,above]{\bfseries
(continued)};
\setcounter{numlinesinquestion}{\thelinesleft}
\else
\ifnum \thecurrentline=0 \else \ifnum \thepartlevel>-1
\draw[very thick]
(\lpos,-\thecurrentline)--(\rpos,-\thecurrentline);
\fi \fi
\pgfmathsetcounter{numlinesinquestion}{\lines[\n]}
\ifnum\thenumlinesinquestion=-1
\setcounter{numlinesinquestion}
{\themaxlinesinpage-\thecurrentline}
\fi
\pgfmathsetcounter{numblanklinesinquestion}{\blanklines[\n]}
\fi
% \end{macrocode}
% Then, if we are not at the end of the page, we check the type of
%question (part, question, or section). If it is a section, we
%overwrite
%some lines and label the section.
% \begin{macrocode}
\ifnum \thecurrentline=\themaxlinesinpage \else
\ifnum \thepartlevel=-1
\draw
(\lpos,-1-\thecurrentline)--(\rpos,-1-\thecurrentline)
node[pos=0.5,above]{\bfseries
Section \Alph{questionnumber}:
\nameref{sec:\Alph{questionnumber}}};
\ifnum \thecurrentline=0 \draw[white,thick]
(\lpos,0)--(\rpos,0);
\else \draw[thick] (\lpos,-\thecurrentline)--(\rpos,-\thecurrentline);\fi
\draw[white,thick]
(\lpos,-\thecurrentline)--(\lpos,-1-\thecurrentline);
\draw[white,thick]
(\mpos,-\thecurrentline)--(\mpos,-1-\thecurrentline);
\draw[white,thick]
(\rpos,-\thecurrentline)--(\rpos,-1-\thecurrentline);
\fi
% \end{macrocode}
% If it is a question, we store the question number as
%\Lcount{lastques} and write the question number if the question has
%non-zero lines.
% \begin{macrocode}
\ifnum \thepartlevel=0
\setcounter{lastques}{\thequestionnumber}
\ifnum \thenumlinesinquestion=0 \else
\draw[draw=none]
(\lpos,-1-\thecurrentline)--(\mpos,-1-\thecurrentline)
node[pos=0.65,above]{\bfseries\thelastques}; \fi
\fi
% \end{macrocode}
% Finally, if it is a part we write the the question number (from
%\Lcount{lastques}) and the part number.
% \begin{macrocode}
\ifnum \thepartlevel=1
\setcounter{lastpart}{\thequestionnumber}
\draw[draw=none]
(\lpos,-1-\thecurrentline)--(\mpos,-1-\thecurrentline)
node[pos=0.65,above]{\bfseries
\thelastques(\alph{lastpart})};
\fi
\fi
% \end{macrocode}
% We then overwrite any lines which need to be left blank.
% \begin{macrocode}
\ifnum\thenumblanklinesinquestion>0
\foreach \l in {2,...,\thenumblanklinesinquestion}{
\draw[white,thick]
(\mpos+0.2pt,1-\l-\thecurrentline)--
(\rpos-0.2pt,1-\l-\thecurrentline);
}
\fi
% \end{macrocode}
% \begin{macrocode}
\ifnum\thepartlevel=-1\else
\ifnum\thepartlevel=0
\def\filename{\thequestionnumber.tex}
\else\ifnum\thepartlevel=1
\def\filename{\thelastques(\alph{lastpart}).tex}
\else\ifnum\thepartlevel=2
\def\filename{na}
\fi\fi\fi\fi
\ifabookimages
\InputIfFileExists{\imagefilename\filename}{
}{
}
\fi
% \end{macrocode}
% We then increment \Lcount{currentline} by
%\Lcount{numlinesinquestion} and set \Lcount{linesleft} to 0.
% \begin{macrocode}
\addtocounter{currentline}{\thenumlinesinquestion}
\setcounter{linesleft}{0}
% \end{macrocode}
% If there are too many lines in the question, we store the number
%of excess lines as \Lcount{linesleft} and write answer space continued
%on next page. Otherwise, we increment \Lcount{tempa}. We also
%increment it if the current question finished exactly on the last line
%however we still break the loop as there is no room for more questions.
% \begin{macrocode}
\unless\ifnum \thecurrentline<\themaxlinesinpage
\addtocounter{linesleft}{\thecurrentline}
\addtocounter{linesleft}{-\themaxlinesinpage}
\ifnum\thelinesleft>0
\draw[draw=none]
(\mpos,-\themaxlinesinpage)--(\rpos,-\themaxlinesinpage)
node[pos=0.77,above]{\bfseries
(answer space continued on next
page)};
\else\addtocounter{tempa}{1}\fi
\breakforeach
\else
\addtocounter{tempa}{1}
\fi
% \end{macrocode}
% We now set \Lcount{tempb} to the part level of the next question
%(if there is a next question). If it is zero, so the next question is
%a question not a part, and this question is not a section, break the
%loop to start a new page. This ensures questions start on a new page
%if the flag |\if@startquestiononnewpageinanswerbook| is set.
% \begin{macrocode}
\setcounter{tempb}{\n}
\addtocounter{tempb}{1}
\unless\ifnum\thetempb>\thenumberofquestions
\pgfmathsetcounter{tempb}{\ip[\thetempb]}
\ifnum \thetempb=0\ifnum \thepartlevel=-1 \else
\if@startquestiononnewpageinanswerbook\breakforeach\fi
\fi \fi \fi
}
% \end{macrocode}
% Finally, we draw a thick line to end the page if this is the end of
%a part. If needed, we write turn over.
% \begin{macrocode}
\ifnum \thelinesleft=0
\draw[very thick]
(\lpos,-\themaxlinesinpage)--(\rpos,-\themaxlinesinpage);
\fi
\oddeven{\draw[draw=none]
(\mpos,-1-\themaxlinesinpage)--(\rpos,-1-\themaxlinesinpage)
node[pos=0.9,above]{\sffamily \bfseries Turn over};}{}
\end{tikzpicture}
\end{center}
\newpage
\unless\ifnum \thetempa>\thenumberofquestions
\repeat
\loadgeometry{main}
}
% \end{macrocode}
%\end{macro}
%
%\begin{macro}{\answerbookbackcover}
%\begin{macro}{\doubleanswerbookbackcover}
% \begin{macrocode}
\renewcommand{\answerbookbackcover}{
\loadgeometry{answerbook}
\begin{center}
\large\bfseries ADDITIONAL ANSWER SPACE
\end{center}
If additional space is required, you should use the following
lined page(s). The question number(s) must be clearly shown
in the margin(s).
\begin{center}
\begin{tikzpicture}[yscale=\lineheight]
\pagestartrule
\setcounter{currentline}{0}
\foreach \n in {1,...,21}{
\blankrow
\addtocounter{currentline}{1}
}
\pageendrule[21]
\end{tikzpicture}
\end{center}
\ifexamx@fourside
\ifnum\the\numexpr4*(\thepage/4)-\thepage\relax=2
\newpage
\begin{center}
\begin{tikzpicture}[yscale=\lineheight]
\pagestartrule
\setcounter{currentline}{0}
\foreach \n in {1,...,\themaxlinesinpage}{
\blankrow
\addtocounter{currentline}{1}
}
\pageendrule[\themaxlinesinpage]
\end{tikzpicture}
\end{center}
\newpage
\begin{center}
\begin{tikzpicture}[yscale=\lineheight]
\pagestartrule
\setcounter{currentline}{0}
\foreach \n in {1,...,28}{
\blankrow
\addtocounter{currentline}{1}
}
\pageendrule[28]
\end{tikzpicture}
\end{center}
\fi
\fi
\loadgeometry{main}
}
\renewcommand{\doubleanswerbookbackcover}{
\loadgeometry{answerbook}
\begin{center}
\large\bfseries ADDITIONAL ANSWER SPACE
\end{center}
If additional space is required, you should use the following
lined page(s). The question number(s) must be clearly shown
in the margin(s).
\begin{center}
\begin{tikzpicture}[yscale=\lineheight]
\pagestartrule
\setcounter{currentline}{0}
\foreach \n in {1,...,25}{
\blankrow
\addtocounter{currentline}{1}
}
\pageendrule[25]
\end{tikzpicture}
\end{center}
\ifexamx@fourside
\ifnum\the\numexpr\thepage-4*(\thepage/4)\relax=1
\newpage
\begin{center}
\begin{tikzpicture}[yscale=\lineheight]
\pagestartrule
\setcounter{currentline}{0}
\foreach \n in {1,...,\themaxlinesinpage}{