Debian Codegraph @

texmf-dist/doc/latex/exam-randomizechoices/exam-randomizechoices-doc.tex

raw
1 % !TeX encoding = UTF-8
2 % !TeX TS-program = pdflatex
3 % !TeX spellcheck = en_GB
4
5 %%--------------------------------------------------------------------
6 %%--------------------------------------------------------------------
7 %% exam-randomizechoices-doc.tex
8 %%
9 %% This is the user's guide for the exam-randomizechoices package,
10 %% by Jesse op den Brouw
11 %%
12 %% The package itself is in the file exam-randomizechoices.sty.
13
14
15 %% Copyright (c)2021, Jesse E. J. op den Brouw
16 %%
17 %% This work may be distributed and/or modified under the
18 %% conditions of the LaTeX Project Public License, either version 1.3
19 %% of this license or (at your option) any later version.
20 %% The latest version of this license is in
21 %% http://www.latex-project.org/lppl.txt
22 %% and version 1.3 or later is part of all distributions of LaTeX
23 %% version 2003/12/01 or later.
24 %%
25 %% This work consists of the files exam-randomizechoices.sty,
26 %% exam-randomizechoices.tex and exam-randomizechoices-doc.tex
27
28 %% This software is provided 'as is', without warranty of any kind,
29 %% either expressed or implied, including, but not limited to, the
30 %% implied warranties of merchantability and fitness for a
31 %% particular purpose.
32
33 %% Jesse op den Brouw
34 %% Department of Electrical Engineering
35 %% The Hague University of Applied Sciences
36 %% Rotterdamseweg 137, 2628 AL, Delft
37 %% Netherlands
38 %% [email protected]
39
40 %% The newest version of this package should always be available
41 %% from GitHub: https://github.com/jesseopdenbrouw/exam-randomizechoices
42
43 %--------------------------------------------------------------------
44 %--------------------------------------------------------------------
45
46 \documentclass[12pt,a4paper]{exam}
47
48 \newcommand{\styversion}{0.2}
49 \newcommand{\stydate}{July 31, 2021}
50 \newcommand{\docdate}{July 31, 2021}
51
52 \usepackage{mathtools}
53 %\usepackage{amssymb}
54
55 %% Set input encoding to UTF-8
56 %\usepackage[utf8]{inputenc}
57 %% Use T1 output font encoding
58 \usepackage[T1]{fontenc}
59
60 %% Set page layout
61 \usepackage[a4paper,left=1.0in,right=1.0in,top=1.0in,bottom=1.31in,footskip=0.4in]{geometry}
62
63 %% Use package enumitem
64 \usepackage{enumitem}
65
66 %% Load English spelling
67 \usepackage[english]{babel}
68
69 %% Nice tables
70 \usepackage{tabu}
71
72 %% Colors
73 \usepackage[x11names]{xcolor}
74
75 %% Use the Charter font + math symbols
76 \usepackage[scaled=0.9]{nimbusmono}
77 \usepackage[bitstream-charter]{mathdesign}
78 %% Use microtype
79 \usepackage[stretch=10]{microtype}
80
81 \usepackage{listings}
82 \usepackage{textcomp}
83
84 \lstset{ %
85 language=[AlLaTeX]TeX,
86 basicstyle=\ttfamily,
87 numbers=left,
88 numberstyle=\tiny\color{gray},
89 stepnumber=1,
90 numbersep=8pt,
91 showspaces=false,
92 showstringspaces=false,
93 showtabs=false,
94 frame=lines,
95 rulecolor=\color{gray},
96 tabsize=4,
97 captionpos=b,
98 breaklines=true,
99 breakatwhitespace=true,
100 title=\lstname,
101 upquote=true,
102 aboveskip=0.99\baselineskip,
103 belowskip=-.99\baselineskip,
104 escapeinside={(*}{*)},
105 }
106
107 \usepackage[colorlinks,linkcolor=blue]{hyperref}
108
109 \usepackage{titlesec}
110 \usepackage{titletoc}
111 \titleformat{\section}{\fontfamily{phv}\selectfont\large\bfseries}{\thesection}{1em}{}
112 \titleformat{\subsection}{\fontfamily{phv}\selectfont\bfseries}{\thesubsection}{1em}{}
113 \titlespacing*{\section}{0pt}{\baselineskip}{\aftersubsection}
114 \titlespacing*{\paragraph}{0pt}{1.0ex plus 1ex minus .2ex}{1.5em}
115 \newlength{\aftersubtitle}
116 \setlength{\aftersubtitle}{1.2\baselineskip}
117 \newlength{\aftersubsection}
118 \setlength{\aftersubsection}{\aftersubtitle}
119 \addtolength{\aftersubsection}{-\baselineskip}
120 \titlespacing*{\subsection}{0pt}{.8\baselineskip}{\aftersubsection}
121 \titlespacing*{\subsubsection}{0pt}{.6\baselineskip}{0pt}
122
123 %% parskip et al.
124 \usepackage{parskip}
125
126 %% filecontents
127 %\usepackage{filecontents}
128
129 %% The randomization package
130 \usepackage[randomize,nokeeplast]{exam-randomizechoices}
131
132 %% Set seed
133 \setrandomizerseed{1}
134
135 % In case we're not using hyperref.sty:
136 \providecommand{\texorpdfstring}[2]{#1}
137 % The following can be used in \section commands
138 % without generating pdf warnings:
139 \newcommand{\bs}{\texorpdfstring{\char`\\}{}}
140
141 % Redefine \LaTeX a bit...
142 \makeatletter
143 \DeclareRobustCommand{\LaTeX}{L\kern-.25em%
144 {\sbox\z@ T%
145 \vbox to\ht\z@{\hbox{\check@mathfonts
146 \fontsize\sf@size\z@
147 \math@fontsfalse\selectfont
148 A}%
149 \vss}%
150 }%
151 \kern-.05em%
152 \TeX}
153 \makeatother
154
155
156 %---------------------------------------------------------------------
157 %---------------------------------------------------------------------
158 %---------------------------------------------------------------------
159 %---------------------------------------------------------------------
160
161 \begin{document}
162 \raggedbottom
163
164 \cfoot[]{Page \thepage\ of \numpages}
165
166 \title{The \texttt{exam-randomizechoices} package\\[2ex]\normalsize \LaTeX{} package for creating random placed choices in multiple choice \\environments using the \texttt{exam} document class}
167
168 \author{Jesse op den Brouw\\
169 Department of Electrical Engineering\\
170 The Hague University of Applied Sciences\\
171 Delft, Netherlands\\
172 \href{mailto:[email protected]}{[email protected]}\\[\bigskipamount]
173 Copyright \copyright \the\year\ Jesse op den Brouw\\
174 All rights reserved}
175
176 \date{\docdate}
177
178 \maketitle
179
180 \thispagestyle{empty}
181
182 %% We like the metric system...
183 \vspace*{2cm}
184
185 \begin{center}
186 \small
187 This is the user's guide for version~\styversion{} [\stydate] of the
188 \verb|exam-randomizechoices| package.
189 \end{center}
190
191 \clearpage
192 \tableofcontents
193
194 \clearpage
195
196
197 \section{Introduction}
198 This document describes the \LaTeX\ \texttt{exam-randomizechoices} package.
199 The package provides the user with four new multiple choice typesetting
200 environments which place the content in a random order. It can (only) be used
201 in combination with the \texttt{exam} document class. It can only
202 randomize the placement of choices in multiple choice questions. The questions
203 themselves can't be randomized with this package.
204
205 Furthermore, the package provides a simple answer key table typesetter and has
206 a command for writing the answer keys to an external file.
207
208 \subsection{License and warranty}
209 This work may be distributed and/or modified under the
210 conditions of the \LaTeX{} Project Public
211 License, either version~1.3 of this
212 license or (at your option) any later version. The latest version
213 of this license is in \url{http://www.latex-project.org/lppl.txt}
214 and version 1.3 or later is part of all distributions of \LaTeX{}
215 version 2003/12/01 or later.
216
217 This work has the LPPL maintenance status ``author-maintained''.
218
219 This work consists of the files \texttt{exam-randomizechoices.sty},
220 \texttt{exam-randomizechoices.tex} and \texttt{exam-randomizechoices-doc.tex}
221
222 This software is provided `as is', without warranty of any kind,
223 either expressed or implied, including, but not limited to, the
224 implied warranties of merchantability and fitness for a
225 particular purpose.
226
227 \subsection{Where to find}
228 The development version of this package is available on GitHub. See
229
230 %\url{https://bitbucket.org/jesseopdenbrouw/exam-randomizechoices/}
231 \url{https://github.com/jesseopdenbrouw/exam-randomizechoices}
232
233 \subsection{Acknowledgements}
234 The author wishes to thank the developers of the \verb|exam| document
235 class and the \verb|mcexam|, \verb|environ|, \verb|etoolbox| and \verb|pgffor|
236 packages.
237
238 \subsection{Warning}
239 This package is experimental, so it could possibly break \LaTeX{}
240 compilation. Use this package with care. Please report any problems
241 to the author.
242
243 Please use a recent version of the \texttt{exam} document class. This
244 package is tested with version 2.603 which is available in most distributions.
245 Testing with version 2.606\$\bs beta\$ is planned.
246
247 \subsection{A word about reading this document}
248 This document uses terminology which is described below:
249
250 \begin{itemize}
251 \item If you encounter the term ``the standard multiple choice environments'',
252 you should read this as ``the \texttt{choices}, \texttt{oneparchoices},
253 \texttt{checkboxes} and \texttt{oneparcheckboxes} environments''.
254
255 \item If you encounter the term ``the new multiple choice environments'',
256 you should read this as ``the \texttt{randomizechoices}, \texttt{randomizeoneparchoices},
257 \texttt{randomizecheckboxes} and \texttt{randomizeoneparcheckboxes} environments''.
258
259 \item If you encounter the term ``\texttt{*choices}'', you should read this as
260 ``\texttt{choices}, \texttt{oneparchoices}, \texttt{randomizechoices} and \texttt{randomizeoneparchoices}''.
261
262 \item If you encounter the term ``\texttt{*checkboxes}'', you should read this as
263 ``\texttt{checkboxes}, \texttt{oneparcheckboxes}, \texttt{randomizecheckboxes} and
264 \texttt{randomizeoneparcheckboxes}''.
265
266 \item If you encounter the term ``command'' in the context of a backslash followed
267 by a series of characters, you can read this as ``macro''. The official \TeX-name
268 is ``control sequence''.
269 \end{itemize}
270
271
272 \section{Using the \texttt{exam} class}
273 This section provides a limited introduction to the \texttt{exam} document
274 class. As a novice user, please read on. If you are a experienced user,
275 you may skip this section.
276
277 The \verb|exam| document class is a powerful class to create exams
278 with \LaTeX{}. Both open questions and multiple choice questions are
279 supported. For multiple choice questions we can differentiate between
280 enumerated lists or checkbox lists. The class documentation states%
281 \footnote{See \url{https://ctan.org/tex-archive/macros/latex/contrib/exam}.}:
282
283 \begin{quote}
284 The file \verb"exam.cls" provides the \verb"exam" document class,
285 which attempts to make it easy for even a \LaTeX{} novice to prepare
286 exams. Specifically, \verb"exam.cls" sets the page layout so that
287 there are one inch margins\index{margins} all around (no matter what
288 size paper you're using) and provides commands that make it easy to
289 format questions, create flexible headers and footers, change the
290 margins, and create grading tables. In more detail:
291 \begin{itemize}
292 \item The class will automatically format and number the questions,
293 parts of questions, subparts of parts, and subsubparts of subparts.
294 \item You can include the point value\index{points} of each question
295 (or part, or subpart, or subsubpart), with your choice of having the
296 point values printed at the beginning of the text of the question,
297 opposite that in the left margin, opposite that in the right margin,
298 or in the right margin opposite the end of the question.
299 \item The class will add up the total points for each question (and
300 all of its parts, subparts, and subsubparts) and the total
301 points\index{points!total} on each page, and make those totals
302 available in macros.
303 \item You can have the class print a grading table, indexed either by
304 question number or by page number.
305 \item You specify the header in three parts: One part to be left
306 justified, one part to be centered, and one part to be right
307 justified, and one or all of these can be omitted.
308 \item The footer is also specified in three parts: Left justified,
309 centered, and right justified.
310 \item The header and footer for the first page can be different from
311 the ones used on other pages.
312 \item Both headers and footers can contain more than one line. To
313 accommodate headers and footers with several lines, simple commands
314 are provided to enlarge the part of the page devoted to the header
315 and/or footer, and these commands can give one amount of space on
316 the first page and a different amount of space on all other pages.
317 \item Macros are defined to enable you to state the total number of
318 pages in the exam and to change the
319 header and/or footer that appears on the last page of the exam .
320 \item Macros are defined so that the headers and footers can vary
321 depending on whether the current page begins a new question or
322 continues a question that started on an earlier page (and, if one
323 continues onto the current page, to say what the number of that
324 question is). Macros are also defined so that the headers and
325 footers can vary depending on whether a question is complete on the
326 current page or continues on to the next page (and, if one
327 continues, to say what the number of that question is).
328 \item You can have a horizontal rule at the base of the header and/or
329 at the top of the footer.
330 \item The exam can begin with one or more cover pages, which are
331 numbered separately from the main pages of the exam and which can
332 have headers and footers different from the ones in the main pages
333 of the exam.
334 \item You can include solutions in your \LaTeX{} file and have these
335 solutions either printed or ignored (or replaced automatically by
336 space in which the students can write their answers) depending on a
337 single command.
338 \end{itemize}
339 \end{quote}
340
341 Furthermore, not stated in this excerpt, you can typeset bonus questions
342 with bonus points and grading tables with bonus points.
343
344 You can load the \texttt{exam} document class the usual way. An example
345 might be:
346
347 \begin{lstlisting}
348 \documentclass[a4paper,12pt,addpoints]{exam}
349 \end{lstlisting}
350
351 which loads the \texttt{exam} document class. The paper size is set to
352 A4 (297 mm $\times$ 210 mm, 11.7~in $\times$ 8.3 in), the document is
353 typeset with a 12 points font and the question points are calculated.
354
355
356 \subsection{Typesetting multiple choice questions}
357 Then, within the document body and between \texttt{\bs begin\{questions\}} and
358 \texttt{\bs end\{questions\}}, you enter the questions. Only multiple choice
359 questions are considered here. The \texttt{exam} document class provides four types
360 of multiple choice question environments:
361
362 \begin{description}[labelindent=2ex]
363 \item[\texttt{choices}] The given choices are typeset in a linear, vertical list.
364 Each given choice is prepended with a label name which can be set to uppercase
365 letter, lowercase letter, Roman numerals (uppercase and lowercase) and the Greek
366 alphabet\footnote{Provided by the \texttt{exam} document class.}.
367
368 \item[\texttt{oneparchoices}] The given choices are typeset in a linear, horizontal list.
369 Long lists are split over multiple lines.
370 Each given choice is prepended with a label name which can be set to uppercase
371 letter, lowercase letter, Roman numerals (uppercase and lowercase) and the Greek
372 alphabet.
373
374 \item[\texttt{checkboxes}] The given choices are typeset in a linear, vertical list.
375 Each given choice is prepended with a checkbox, which defaults to a big circle.
376
377 \item[\texttt{oneparcheckboxes}] The given choices are typeset in a linear, horizontal
378 list. Long lists are split over multiple lines.
379 Each given choice is prepended with a checkbox, which defaults to a big circle.
380
381 \end{description}
382
383 Within the environments, the
384 commands \texttt{\bs choice} and \texttt{\bs CorrectChoice} designate the
385 typesetting material. The difference between the two commands is discussed
386 in Section~\ref{sec:solutions}.
387
388 Examples of the four environments are given below.
389
390 \subsection{The \texttt{choices} environment}
391
392 An example of a question with the \texttt{choices} environment is:
393
394 \begin{lstlisting}
395 \question[5] What is the result of $1+1$?
396
397 \begin{choices}
398 \choice 1
399 \CorrectChoice 2
400 \choice 3
401 \choice 4
402 \end{choices}
403 \end{lstlisting}
404
405 which is typeset as:
406 \enlargethispage{\baselineskip}
407 \begin{questions}
408 \setcounter{question}{0}
409 \question[5] What is the result of $1+1$?
410
411 \begin{choices}
412 \choice 1
413 \CorrectChoice 2
414 \choice 3
415 \choice 4
416 \end{choices}
417 \end{questions}
418
419 \subsection{The \texttt{oneparchoices} environment}
420
421 An example of a question with the \texttt{oneparchoices} environment is:
422
423 \begin{lstlisting}
424 \question[5] What is the result of $2+2$?
425
426 \begin{oneparchoices}
427 \choice 1
428 \choice 2
429 \choice 3
430 \CorrectChoice 4
431 \end{oneparchoices}
432 \end{lstlisting}
433
434 which is typeset as:
435
436 \begin{questions}
437 \setcounter{question}{1}
438 \question[5] What is the result of $2+2$?
439
440 \begin{oneparchoices}
441 \choice 1
442 \choice 2
443 \choice 3
444 \CorrectChoice 4
445 \end{oneparchoices}
446 \end{questions}
447
448 Furthermore, the \texttt{exam} document class provides two ways of typesetting
449 checkbox questions.
450
451 \subsection{The \texttt{checkboxes} environment}
452
453 An example of a vertically aligned checkbox environment is:
454
455 \begin{lstlisting}
456 \question[5] What is the result of $1+2$?
457
458 \begin{checkboxes}
459 \choice 1
460 \choice 2
461 \CorrectChoice 3
462 \choice 4
463 \end{checkboxes}
464 \end{lstlisting}
465
466 which typesets to:
467
468 \begin{questions}
469 \setcounter{question}{2}
470 \question[5] What is the result of $1+2$?
471
472 \begin{checkboxes}
473 \choice 1
474 \choice 2
475 \CorrectChoice 3
476 \choice 4
477 \end{checkboxes}
478 \end{questions}
479
480 \subsection{The \texttt{onecheckboxes} environment}
481
482 The \texttt{oneparcheckboxes} environment typesets the choices
483 in al linear, horizontal way. An example is given below:
484
485
486 \begin{lstlisting}
487 \question[5] What is the result of $1+2$?
488
489 \begin{oneparcheckboxes}
490 \choice 1
491 \choice 2
492 \CorrectChoice 3
493 \choice 4
494 \end{oneparcheckboxes}
495 \end{lstlisting}
496
497 which typesets to:
498
499 \begin{questions}
500 \setcounter{question}{3}
501 \question[5] What is the result of $1+2$?
502
503 \begin{oneparcheckboxes}
504 \choice 1
505 \choice 2
506 \CorrectChoice 3
507 \choice 4
508 \end{oneparcheckboxes}
509 \end{questions}
510
511 Other types of questions are not considered here.
512
513 \subsection{Typesetting solutions}
514 \label{sec:solutions}
515 Please note the use of the \texttt{\bs choice} and \texttt{\bs CorrectChoice}
516 commands. A \texttt{\bs choice} typesets as an item in the list with no special markup.
517 A \texttt{\bs CorrectChoice} typesets an item in the list with special markup if
518 the \texttt{exam} document class option \texttt{answers} is given, otherwise it
519 typesets the same way a \texttt{\bs choice}. This special
520 markup defaults to boldface for the \texttt{choices} and \texttt{oneparchoices}
521 environments:
522
523 \begin{lstlisting}
524 \question[5] What is the result of $2+2$?
525
526 \begin{choices}
527 \choice 1
528 \choice 2
529 \choice 3
530 \CorrectChoice 4
531 \end{choices}
532 \end{lstlisting}
533
534 which is typesets as:
535
536 \printanswers
537
538 \begin{questions}
539 \setcounter{question}{4}
540 \question[5] What is the result of $2+2$?
541
542 \begin{choices}
543 \choice 1
544 \choice 2
545 \choice 3
546 \CorrectChoice 4
547 \end{choices}
548 \end{questions}
549
550 Note that item D is typeset in boldface. The \texttt{checkboxes} and \texttt{oneparcheckboxes}
551 environments use a \emph{surd}\footnote{A surd is a simplistic form of a square root sign.}:
552
553 \begin{lstlisting}
554 \question[5] What is the result of $1+2$?
555
556 \begin{oneparcheckboxes}
557 \choice 1
558 \choice 2
559 \CorrectChoice 3
560 \choice 4
561 \end{oneparcheckboxes}
562 \end{lstlisting}
563
564 which typesets to:
565
566 \begin{questions}
567 \setcounter{question}{5}
568 \question[5] What is the result of $1+2$?
569
570 \begin{oneparcheckboxes}
571 \choice 1
572 \choice 2
573 \CorrectChoice 3
574 \choice 4
575 \end{oneparcheckboxes}
576 \end{questions}
577
578 \noprintanswers
579
580
581 \section{Using the package \texttt{exam-randomizechoices}}
582 Although the \texttt{exam} document class is a very powerful tool to
583 create exams, it does not provide options to typeset the content of the
584 standard multiple choice environments in a random order\footnote{It
585 also doesn't provides options to randomize questions.}. This package
586 addresses this situation.
587
588 \subsection{New multiple choice environments}
589 Basically, this package provides the user with four new multiple choice
590 environments:
591
592 \begin{description}[labelindent=2ex]
593 \item[\texttt{randomizechoices}] This is the randomizing counterpart of the
594 \texttt{choices} environment. It typesets the given items in a random order.
595
596 \item[\texttt{randomizeoneparchoices}] This is the randomizing counterpart of the
597 \texttt{oneparchoices} environment. It typesets the given items in a random order.
598
599 \item[\texttt{randomizecheckboxes}] This is the randomizing counterpart of the
600 \texttt{checkboxes} environment. It typesets the given items in a random order.
601
602 \item[\texttt{randomizeoneparcheckboxes}] This is the randomizing counterpart of the \linebreak
603 \texttt{oneparcheckboxes} environment. It typesets the given items in a random order.
604
605 \end{description}
606
607
608 \subsection{Using the new multiple choice environments}
609 We will discuss the \texttt{randomizechoices} environment only. The other
610 environment work alike.
611
612 You can use the new multiple choice environments in the same way as the non-randomizing counterparts.
613 So an example of the \texttt{randomizechoices} environment might be:
614
615 \begin{lstlisting}
616 \question[5] What is the result of $1+1$?
617
618 \begin{randomizechoices}
619 \choice 1
620 \CorrectChoice 2
621 \choice 3
622 \choice 4
623 \end{randomizechoices}
624 \end{lstlisting}
625
626 which \emph{possibly} is typeset as:
627
628 \begin{questions}
629 \setcounter{question}{6}
630 \question[5] What is the result of $1+1$?
631
632 \begin{randomizechoices}
633 \choice 1
634 \CorrectChoice 2
635 \choice 3
636 \choice 4
637 \end{randomizechoices}
638 \end{questions}
639
640 Here we can see that the resulting output is typeset in a different order
641 then the choices are given. We say \emph{possibly} because the output
642 depends on the state of the pseudo random generator (see Section~\ref{sec:seeding}).
643
644 \subsection{Arguments to the new multiple choice environments}
645 The new multiple choice environments accept (a combination of) the following optional arguments
646 which are local to the environment currently being typeset:
647
648 \begin{description}[labelindent=2ex]
649 \item[randomize] The typesetting material is randomized. This is the default
650 behaviour of the package.
651 \item[norandomize] Randomization is turned off.
652 Useful if you wish to see the typesetting in the given order.
653 \item[keeplast] The last given item in the entered order is not part of the
654 randomization process. This way you can keep the last item always the last item.
655 \item[nokeeplast] The last given item is used in the randomization process. This
656 is the default behaviour of the package.
657
658 \end{description}
659
660 Sometimes you want the last given item to stick on its place. This is useful
661 if you want to use a choice item if none of the other choices are correct:
662
663 \begin{lstlisting}
664 \question[5] What is the result of $2+5$?
665
666 \begin{randomizechoices}[keeplast]
667 \choice 1
668 \choice 2
669 \choice 3
670 \CorrectChoice None of the above answers is correct.
671 \end{randomizechoices}
672 \end{lstlisting}
673
674 which possibly is typeset as:
675
676 \begin{questions}
677 \setcounter{question}{7}
678 \question[5] What is the result of $1+1$?
679
680 \begin{randomizechoices}[keeplast]
681 \choice 1
682 \choice 2
683 \choice 3
684 \CorrectChoice None of the above answers are correct.
685 \end{randomizechoices}
686 \end{questions}
687
688 Note that the last item can also be a \texttt{\bs choice} command. Also note
689 that if randomization is turned off, the \texttt{keeplast} option has no effect.
690
691 \subsection{Loading the package}
692 The package is loaded using the well-known \texttt{\bs{usepackage}} command:
693
694 \begin{lstlisting}
695 \usepackage[(* \emph{\textrm{option list}} *)]{exam-randomizechoices}
696 \end{lstlisting}
697
698 The package depends on the \texttt{exam} document class being loaded beforehand. If this
699 is not the case, the package will throw an error and stops the compilation
700 immediately.
701
702
703 \subsection{Package options}
704
705 The options in \emph{\textrm{option list}} can be any combination of:
706
707 \begin{description}[labelindent=2ex]
708 \item[randomize] This option globally turns on the randomizing of the choices given for all
709 available typesetting environments. Randomization is turned on by default.
710
711 \item[norandomize] This option globally turns off the randomizing of the choices for all
712 available typesetting environments. This option is useful for inspecting the resulting
713 PDF output file with typesetting the choices in the order they were entered.
714
715 \item[keeplast] This option globally turns on the preservation of the last entered
716 item in the new environments.
717
718 \item[nokeeplast] This option globally turns off the preservation of the last entered
719 item in the new environments. This is the default behaviour.
720
721 \item[overload] This option makes the standard multiple choice environments behave
722 the same as the new environment counterparts, i.e.\@ the the standard multiple choice
723 environments are overloaded (or redefined). This is useful if you wish to use an old
724 exam and randomize the choices of the questions.
725
726 \item[nooverload] This option suppresses the overloading of the standard multiple choice
727 environments so you have to use the new multiple choice environments if you want to
728 randomize the choices to the questions. Overloading is turned off by default.
729
730 \item[\texttt{debug}] This option causes the package to emit a lot of debug messages.
731 The messages are written to the log file by the \texttt{\bs{PackageWarning}}
732 command. Most IDE's, such as TeXMaker, will display the messages in the transcript pane.
733 Debug is turned off by default. There is no \texttt{nodebug} option.
734
735 \end{description}
736
737 If you load the package with no options, it behaves as:
738
739 \begin{lstlisting}
740 \usepackage[randomize,nokeeplast,nooverload]{exam-randomizechoices}
741 \end{lstlisting}
742
743
744 \subsection{Overloading the standard multiple choice environments}
745 If the package option \texttt{overload} is in effect, the standard multiple choice
746 environments are overloaded (or redefined) by the new multiple choice environments,
747 i.e. the standard multiple choice environment behave the same as their
748 randomizing counterparts. This way the user can typeset old exams or when creating
749 an exam from a repository of (old) questions. Please note that the overloaded
750 multiple choice environments now accept arguments just as their randomizing
751 counterparts do.
752
753
754 \subsection{Seeding the pseudo random generator}
755 \label{sec:seeding}
756 To get a consistent randomization, you must seed the pseudo random generator
757 with the same seed every time you compile your document. You can set the
758 seed using the \texttt{\bs setrandomizerseed} macro. The macro has a mandatory
759 argument that is an integer between 0 and $2^{31}-1$, \TeX's largest integer.
760 Internally, the PGF macro \texttt{\bs pgfmathsetseed} is called, and it is
761 flagged that you applied a seed. If you fail to do so, the seeding value is
762 \texttt{\bs time}$\times$\texttt{\bs year} as stated by the PFG manual%
763 \footnote{Version 3.1.9a, page 1046.}. \LaTeX\ compilers keep track of
764 time by an integer that holds the minutes counted since midnight. The integer is
765 incremented every time the time passes a minute boundary. So the scenario
766 can be that you compile your document a couple of times with no apparent
767 differences between runs. But if the time passes a minute boundary, the
768 next time you compile your document you'll see that the environment items
769 have been rearranged.
770
771 \subsection{Printing the key table}
772 The package provides the typesetting of a basic key table in vertical direction.
773 Please note that only the environments \texttt{randomizechoices},
774 \texttt{randomizeoneparchoices}, \texttt{choices} (if overloaded) and
775 \texttt{oneparchoices} (if overloaded) can have valid keys in the key table.
776 The \texttt{*checkboxes} environments can't
777 have keys because of the typesetting regime used by the \texttt{exam}
778 document class. The \texttt{*choices} environments use an internal counter
779 to keep track of the choice currently being typeset. Using this counter, a
780 label can be provided with a \texttt{\bs label} command.
781 The \texttt{*checkboxes} environments don't use an internal counter so
782 labelling them would lead to a reference to the current question (or part,
783 or sub part or sub-sub part). Labelling the correct choices (with the
784 \texttt{\bs CorrectChoice} command) is automatically handled by the
785 package.
786
787 At the end of the exam, issue the commands:
788
789 \begin{lstlisting}
790 \ifprintanswers
791 \printkeytable
792 \fi
793 \end{lstlisting}
794
795 to print the key table. The \texttt{\bs ifprintansers} command is only true if the
796 \texttt{exam} document class \texttt{ansers} option is set, thereby preventing
797 accidental typesetting the key table. If an correct choice can't be labelled, the
798 table entry will contain \textbf{??}, otherwise it will contain the used typesetting scheme
799 (which is \texttt{\bs Alph} by default).
800 The key table is typeset using the \texttt{tabular}
801 environment, so it can be wrapped in a \texttt{table} environment.
802
803 The \texttt{\bs printkeytable} macro accepts an optional range as in:
804 \begin{lstlisting}
805 \printkeytable[21-40]
806 \end{lstlisting}
807
808 It will typeset only the keys in this range. This is useful for generating
809 side-by-side key tables. The start question number may be omitted, in which
810 case the table starts at 1. The end question number may be omitted, in which
811 case the table will be typeset up to the last question.
812
813 An example of a key table is presented below. Note the \textbf{??} in the
814 Key column. This is the result of using the standard multiple choice
815 environments (they are not overloaded, so no label is applied).
816
817 Usage of \texttt{\bs printkeytable}
818
819 \printkeytable
820
821 Usage of \texttt{\bs printkeytable[...-...]}
822
823 \printkeytable[1-3]\quad\printkeytable[4-6]\quad\printkeytable[7-8]
824
825 The text in the table header row can be changed using two command: the command
826 \texttt{\bs keylistquestionname} sets the text above the question numbers, which
827 defaults to ``Question'', the command \texttt{\bs keylistkeyname} sets the text
828 above the keys, which defaults to ``Key''. A typical use could be:
829
830 \begin{lstlisting}
831 \keylistquestionname{Exercise}
832 \keylistkeyname{Answer Key}
833 \end{lstlisting}
834
835 \subsection{Saving the keys to a macro}
836 It is possible to save the question numbers and the corresponding keys to
837 a macro. Please note that only the environments \texttt{randomizechoices},
838 \texttt{randomizeoneparchoices}, \texttt{choices} (if overloaded) and
839 \texttt{oneparchoices} (if overloaded) can have valid keys in the key list.
840
841 Saving a key list file is started by the command:
842
843 \begin{lstlisting}
844 \savekeylist[(*\textsl{\textrm{command name}}*)]
845 \end{lstlisting}
846
847 The optional argument is the macro name, including the \bs. if none is
848 supplied, it defaults to \texttt{\bs keylist}
849 The key list itself is constructed as a comma-separated list. The question
850 number and answer keys are separated with a `/'. This makes it easy to
851 parse the list with PGF's \texttt{\bs foreach} command (using \texttt{\bs
852 mykeylist} as command name):
853
854 \savekeylist[\mykeylist]
855
856 \begin{lstlisting}
857 \foreach \num/\key in \mykeylist {
858 \textcolor{green!\num0!red} {question \num\ has key \key} \\
859 }
860 \end{lstlisting}
861
862 which typesets to:
863
864 \foreach \num/\key in \mykeylist {
865 \textcolor{green!\num0!red} {question \num\ has key \key} \\
866 }
867
868 \subsection{Writing the keys to a file}
869 The package provides the writing of the keys to the file.
870 Please note that only the environments \texttt{randomizechoices},
871 \texttt{randomizeoneparchoices}, \texttt{choices} (if overloaded) and
872 \texttt{oneparchoices} (if overloaded) can have valid keys in the key list.
873
874 Writing a key list file is started by the command:
875
876 \begin{lstlisting}
877 \writekeylist[(*\textsl{\textrm{filename}}*)]{(*\textsl{\textrm{command name}}*)}
878 \end{lstlisting}
879
880 The optional parameter \emph{filename} is the name of the file. If you don't
881 provide a filename, \texttt{\bs jobname.keylist} will be used,
882 where \texttt{\bs jobname} is the name of your \LaTeX{} file you are compiling.
883 The \emph{command name} is used in the key list file. An example of a key list file
884 is presented below. In essence, the file contains a \texttt{\bs gdef} command
885 that assigns the key list to the supplied command name (in this case
886 \texttt{\bs mykeylist}).
887
888 \writekeylist{\mykeylist}
889 %\vspace*{\baselineskip}
890 \lstinputlisting[caption=]{\jobname.keylist}
891
892 \vspace*{1.5\baselineskip}
893 The key list itself is constructed as a comma-separated list. The question
894 number and answer keys are separated with a `/'. This makes it easy to
895 parse the list with PGF's \texttt{\bs foreach} command:
896
897 \begin{lstlisting}
898 \input{\jobname.keylist}
899
900 \foreach \num/\key in \mykeylist {
901 \textcolor{red!\num0!blue} {question \num\ has key \key} \\
902 }
903 \end{lstlisting}
904
905 Executing this code results in:
906
907 \input{\jobname.keylist}
908
909 \foreach \num/\key in \mykeylist {
910 \textcolor{red!\num0!blue} {question \num\ has key \key} \\
911 }
912
913 The key list file can safely be deleted. It is generated each time the
914 \texttt{\bs writekeylist} command is executed. Edits to the file are lost.
915
916 \subsection{There should be only one correct answer}
917 As stated in the title of this section, each multiple choice question
918 should have one, and only one correct answer. The packages issues a
919 warning if a question has zero or more than one correct answer, but it
920 doesn't stop compilation. If a question has no correct answer there
921 will be a \textbf{??} in the printed key table and a ? in the key list
922 file. If a question has two or more correct answers, the last correct
923 answer being typeset will be printed in the key table and is written to
924 the key list file.
925
926 Also note that using the \textsl{parts} environment to typeset multiple
927 multiple choice questions is not supported because the automatic
928 labelling mechanism supports only at the question level.
929
930 \subsection{Verbatim environments}
931 Verbatim environments such as \texttt{verbatim} and \texttt{lstlistings}
932 are \emph{not} supported in the new and overloaded standard multiple
933 choice environments. This is due to the way the contents of these environments
934 are collected. The contents is first read by \TeX{} and spaces at the end
935 of a line are removed, and the end-of-line character is replaced by a space.
936 This will disrupt the formatted code in the verbatim environments.
937 There is extensive discussion on StackExchange on how to tackle this problem.
938 One could use a \texttt{verbatimbox} environment which puts the contents in
939 a box, or one could use the \texttt{VerbatimOut} environment which writes
940 the contents to a file for later inclusion. A portable solution would
941 be to write contents to (separate) files and include them. In the following
942 example using the \texttt{filecontents*} environment, four temporary files
943 are created and included using the \verb|\lstinputlisting| macro.
944
945 \begin{lstlisting}
946 % Use \usepackage{filecontents} in preamble
947 %
948 \question[5]
949 Which of the four alternative computes the sum of the integers 1
950 to 10 (inclusive)?
951
952 \begin{filecontents*}{\jobname a.c}
953 sum = 0;
954 for (i=0; i<10; i++) {
955 sum += i;
956 }
957 \end{filecontents*}
958 \begin{filecontents*}{\jobname b.c}
959 sum = 0;
960 for (i=1; i<11; i++) {
961 sum += i;
962 }
963 \end{filecontents*}
964 \begin{filecontents*}{\jobname c.c}
965 sum = 0; i = 11;
966 while (i>0) {
967 sum +- i;
968 i--;
969 }
970 \end{filecontents*}
971 \begin{filecontents*}{\jobname d.c}
972 sum = 0; i = 0;
973 do {
974 sum += i;
975 i++;
976 } while (i<10);
977 \end{filecontents*}
978
979 \begin{randomizechoices}
980 \choice \lstinputlisting{\jobname a.c}\par % please use \par otherwise label get clobbered
981 \CorrectChoice \lstinputlisting{\jobname b.c}\par
982 \choice \lstinputlisting{\jobname c.c}\par
983 \choice \lstinputlisting{\jobname d.c}\par
984 \end{randomizechoices}
985 \end{lstlisting}
986
987 which will typically typeset to:
988
989 \begin{questions}
990 \setcounter{question}{8}
991 \question[5]
992 Which of the four alternative computes the sum of the integers 1 to 10 (inclusive)?
993
994 \begin{filecontents*}{\jobname a.c}
995 sum = 0;
996 for (i=0; i<10; i++) {
997 sum += i;
998 }
999 \end{filecontents*}
1000 \begin{filecontents*}{\jobname b.c}
1001 sum = 0;
1002 for (i=1; i<11; i++) {
1003 sum += i;
1004 }
1005 \end{filecontents*}
1006 \begin{filecontents*}{\jobname c.c}
1007 sum = 0; i = 11;
1008 while (i>0) {
1009 sum +- i;
1010 i--;
1011 }
1012 \end{filecontents*}
1013 \begin{filecontents*}{\jobname d.c}
1014 sum = 0; i = 0;
1015 do {
1016 sum += i;
1017 i++;
1018 } while (i<10);
1019 \end{filecontents*}
1020
1021 \begin{randomizechoices}
1022 \choice \lstinputlisting[caption=,frame=none,numbers=none]{\jobname a.c}\par % please use \par otherwise label get clobbered
1023 \CorrectChoice \lstinputlisting[caption=,frame=none,numbers=none]{\jobname b.c}\par
1024 \choice \lstinputlisting[caption=,frame=none,numbers=none]{\jobname c.c}\par
1025 \choice \lstinputlisting[caption=,frame=none,numbers=none,belowskip=0pt]{\jobname d.c}\par
1026 \end{randomizechoices}
1027
1028 \end{questions}
1029
1030 Please note that the \texttt{\bs verb} command is also not supported by the package
1031 but \texttt{\bs lstinline} command is.
1032
1033 %% An example, translated to English from a Dutch exam
1034 %%on the ATmega32 microcontroller chip:
1035 %%
1036 %%\begin{lstlisting}
1037 %%\question[5]
1038 %%The individual pins of Port D can be configured as input or output.
1039 %%The single bits of Port D are called PD7, PD6, PD5, PD4, PD3, PD2,
1040 %%PD1 and PD0. Which of the following alternatives configures PD0, PD1,
1041 %%PD6 and PD7 as output and the remaining pins as input?
1042 %%
1043 %%\begin{randomizechoices}
1044 %%\choice \lstinline|out DDRD,0x3c|
1045 %%\CorrectChoice \lstinline|ldi r20,0xc3| \par \lstinline|out DDRD,r20|
1046 %%\choice \lstinline|out PORTD,0x3c|
1047 %%\choice \lstinline|ldi r20,195| \par \lstinline|PORTD,r20|
1048 %%\end{randomizechoices}
1049 %%\end{lstlisting}
1050 %%
1051 %%typesets possibly to:
1052 %%
1053 %%\begin{questions}
1054 %%\setlength{\parskip}{0pt}
1055 %%\setcounter{question}{8}
1056 %%\question[5]
1057 %%The individual pins of Port D can be configured as input or output. The single bits
1058 %%of Port D are called PD7, PD6, PD5, PD4, PD3, PD2, PD1 and PD0. Which of the
1059 %%following alternatives configures PD0, PD1, PD6 and PD7 as output and the remaining
1060 %%pins as input?
1061 %%
1062 %%%%Original Dutch text
1063 %%%%De individuele pinnen van Port D kunnen als ingang of uitgang geconfigureerd worden. De
1064 %%%%enkelvoudige bits van Port D worden PD7, PD6, PD5, PD4, PD3, PD2, PD1, PD0 genoemd.
1065 %%%%Welk van de volgende alternatieven configureert PD0, PD1, PD6 en PD7 als uitgang en de
1066 %%%%overige pinnen als ingang?
1067 %%%
1068 %%%\hspace*{\baselineskip}
1069 %%
1070 %%\begin{randomizechoices}[norandomize]
1071 %% \choice \lstinline|out DDRD,0x3c|
1072 %% \CorrectChoice \lstinline|ldi r20,0xc3| \par \lstinline|out DDRD,r20|
1073 %% \choice \lstinline|out PORTD,0x3c|
1074 %% \choice \lstinline|ldi r20,195| \par \lstinline|PORTD,r20|
1075 %%\end{randomizechoices}
1076 %%\end{questions}
1077
1078 \subsection{Accessing the internal labels}
1079 Each \texttt{\bs question} command is accompanied with a label of the form
1080 \texttt{question@}$x$ as provided by the \texttt{exam} document class, where
1081 $x$ is the decimal number of the question. Within the the environments
1082 \texttt{randomizechoices}, \texttt{randomizeoneparchoices}, \texttt{choices}
1083 (if overloaded) and \texttt{oneparchoices} (if overloaded), a
1084 \texttt{\bs CorrectChoice} command is provided with a label (by this package)
1085 of the form \texttt{question@}$x$%
1086 \texttt{@correctchoice} where $x$ is again the decimal number of the question.
1087 The user can access these labels by using the \texttt{\bs ref} command as shown
1088 below:
1089
1090 \begin{lstlisting}
1091 The question number is~\ref{question@9} and the correct answer
1092 is~\ref{question@9@correctchoice}.
1093 \end{lstlisting}
1094
1095 which typesets to:
1096
1097 The question number is~\ref{question@9} and the correct answer
1098 is~\ref{question@9@correctchoice}.
1099
1100 %There is no need to change the cat code of `@'.
1101
1102 \subsection{Error messages}
1103 The package will throw you some error messages in case something is wrong. The
1104 message below is printed only at start up.
1105
1106 \begin{description}[labelindent=2ex]
1107 \item[\texttt{The exam class is not loaded. Emergency stop!}] --- You didn't load
1108 the \texttt{exam} document class prior to loading the package. As a result of that,
1109 the package can't continue and stops compiling your document. Note that a document
1110 class can be based on the \texttt{exam} document class and will load it for you.
1111
1112 \end{description}
1113
1114 The next messages will only be printed if the new multiple choice environments
1115 are used \emph{or} if the standard multiple choice environments are used when
1116 overloaded:
1117
1118 \begin{description}
1119 \item[\texttt{You should NOT define \string\inaccessible. Emergency stop!}] ---
1120 The packages relies on the fact that \texttt{\bs inaccessible} is not defined. It is
1121 used by the list parser to designate \texttt{\bs CorrectChoice} and
1122 \texttt{\bs correctchoice}. Normally, a user doesn't define this command.
1123 As a result of that, the package can't continue and stops compiling your document.
1124
1125 %% Next two are turned into warningz
1126 %%%\item[\texttt{You need exactly one \string\CorrectChoice, I found} $x$
1127 %%% \texttt{in question} $y$] --- You should provide only one correct
1128 %%%answer in a multiple choice question. Compilation does continue.
1129 %%%
1130 %%%\item[\texttt{You need at least two choices in question} $x$] --- You didn't
1131 %%%provide two or more choices, so there's nothing to choose from. Compilation
1132 %%%does continue.
1133
1134 \item[\texttt{Something's wrong, perhaps a missing \string\choice\ or \string\CorrectChoice\ or ...}] --- You used text before an initial \texttt{\bs choice}, \texttt{\bs CorrectChoice}
1135 or \texttt{\bs correctchoice}. Analogue to the famous missing \texttt{\bs item} messages.
1136 Compilation does continue.
1137
1138 \item[\texttt{Cannot write key list file}] --- Writing of files is disabled so the key list file can't be generated. Compilation does continue.
1139
1140 \end{description}
1141
1142
1143
1144 \section{Some internal details of the package}
1145 This section provides some internal details on the operation of the package.
1146
1147 \subsection{Used packages}
1148 The package loads the following packages:
1149
1150 \begin{description}[labelindent=2ex]
1151 \item[\texttt{environ}] This package is used for defining the new environments. It provides
1152 the powerful \texttt{NewEnviron} and \texttt{RenewEnviron} commands.
1153 \item[\texttt{etoolbox}] This package provides some useful commands, notably on the parsing of lists.
1154 \item[\texttt{pgffor}] This package provides the powerful \texttt{\bs foreach} loop
1155 construct. In turn, this package loads the \texttt{pgfmath} package which supplies
1156 the \texttt{\bs pgfmathsetseed} and \linebreak \texttt{\bs pgfmathrandominteger} commands.
1157 \end{description}
1158
1159 \subsection{Defining the \texttt{randomize*} environments}
1160 Defining the \texttt{randomize*} environments is done with the \texttt{NewEnviron}
1161 and \texttt{RenewEnviron} commands. As an example we discuss the
1162 \texttt{randomizechoices} environment.
1163
1164 We define this environment as follows (not overloaded):
1165
1166 \begin{lstlisting}
1167 \NewEnviron{randomizechoices}[1][]{
1168 %%
1169 %% Create a random list
1170 \erc@createrandomlist[#1]%
1171 %%
1172 %% Start the choices environment
1173 \begin{choices}%
1174 % Execute the list
1175 \erc@typesetchoices%
1176 \end{choices}%
1177 }
1178 \end{lstlisting}
1179
1180 Now the \texttt{NewEnviron} command has a very useful property in that
1181 when expanded it places its content in the command \texttt{\bs BODY}.
1182 So when the environment is used as in:
1183
1184 \begin{lstlisting}
1185 \begin{randomizechoices}
1186 \choice one
1187 \choice two
1188 \CorrectChoice three
1189 \choice four
1190 \end{randomizechoices}
1191 \end{lstlisting}
1192
1193 the \texttt{\bs BODY} command now contains (comments and newlines are stripped by \TeX):
1194
1195 \begin{lstlisting}
1196 \choice one \choice two \CorrectChoice three \choice four
1197 \end{lstlisting}
1198
1199 Using the command as in:
1200
1201 \begin{lstlisting}
1202 \BODY
1203 \end{lstlisting}
1204
1205 simply expands the command. Now all the \texttt{randomize*} environments
1206 are defined this way, so we need a generic command that parses \texttt{\bs BODY} and
1207 provides a command that contains the randomized version of \texttt{\bs BODY}. This is
1208 handled by the command \texttt{\bs erc@createrandomlist}. What \texttt{\bs erc@createrandomlist}
1209 basically does is:
1210
1211 \begin{enumerate}
1212 \item Parses the supplied options and sets internal flags for later use.
1213 \item Replaces every occurrence of \texttt{\bs CorrectChoice} and
1214 \texttt{\bs correctchoice} in \texttt{\bs BODY}
1215 with \texttt{\bs choice \bs inaccessible}.
1216 \item Disassembles \texttt{\bs BODY} into a set of commands by splitting on the list
1217 separator \texttt{\bs choice}. \texttt{\bs choice} is removed.
1218 \item Randomizes the order of the set of commands.
1219 \item Assembles the set of commands to the new command \texttt{\bs erc@typesetchoices},
1220 thereby appending a \texttt{\bs label} to the correct choice. The ``command''
1221 \texttt{\bs inaccessible} is replaced by \texttt{\bs CorrectChoice}. The
1222 other commands are prepended with \texttt{\bs choice}.
1223 \end{enumerate}
1224
1225 Of course this behaviour can be altered by options. For example, if the option
1226 \texttt{norandomize} is passed, \texttt{\bs BODY} is not randomized but labelling still
1227 takes place.
1228
1229 Please note: We need to replace \texttt{\bs CorrectChoice} with \texttt{\bs choice \bs inaccessible}
1230 because the list parser can only handle one list separator at a time. The very misunderstood command
1231 \texttt{\bs inaccessible}\footnote{This sequence of characters sometimes appear in error messages
1232 generated by \LaTeX.} is likely not to be entered by the user but if the user enters \texttt{\bs inaccessible}
1233 directly after a \texttt{\bs choice} command, this is converted to \texttt{\bs CorrectChoice}
1234 in step 5. Of course this is not a bug, but a feature.
1235
1236 After \texttt{\bs erc@createrandomlist} has done it's job, the command \texttt{\bs erc@typesetchoices}
1237 is simply expanded within a \texttt{choices} environment.
1238
1239 Now if the global \texttt{overload} option is in effect, some more trickery is needed. First, a copy
1240 of the \texttt{choices} environment is created using \texttt{\bs let}:
1241
1242 \begin{lstlisting}
1243 %% Save choices environment
1244 \let\@oldchoices\choices
1245 \let\end@oldchoices\endchoices
1246 \end{lstlisting}
1247
1248 Using \texttt{\bs let} doesn't create problems, because the \texttt{choices} environment
1249 doesn't support options. See \url{https://tex.stackexchange.com/questions/116670/}.
1250 Next, the \texttt{\bs choices} environment is redefined:
1251
1252 \begin{lstlisting}
1253 %% Renew the choices environment
1254 \RenewEnviron{choices}[1][]{
1255
1256 %% Create a random list
1257 \erc@createrandomlist[#1]
1258
1259 %% Start the choices environment
1260 \begin{@oldchoices}
1261 % Execute the list
1262 \erc@typesetchoices
1263 \end{@oldchoices}
1264 }
1265 \end{lstlisting}
1266
1267 Note that now the \texttt{\bs choices} environment can handle the same options as the
1268 \texttt{randomizechoices} environment.
1269
1270 \subsection{Note on the key table}
1271 The code of the key table is first collected using a series of \texttt{\bs gappto} and
1272 \texttt{\bs xappto} commands. Using these commands is far more easy then typesetting it
1273 directly from the package. See \url{https://tex.stackexchange.com/questions/367979/}
1274 why. Notably the use of \texttt{\bs begin}, \texttt{\bs foreach} and \texttt{\bs hline}
1275 is problematic.
1276
1277 \subsection{Verbatim environments}
1278 Verbatim environments are currently not supported. This is due to the way \texttt{\bs NewEviron}
1279 collects its contents. A \texttt{\bs NewEnviron} is not really an environment at all, but a
1280 command. One solution is to write the contents to a file and then include the file. This is
1281 being investigated. See
1282 % \url{https://tex.stackexchange.com/questions/51239/verbatim-in-environ-s-body}.
1283 \url{https://tex.stackexchange.com/questions/51239/}.
1284
1285 Also the \texttt{\bs verb} command is not supported, but \texttt{\bs lstinline} is.
1286
1287 \section{A personal note}
1288 I've been using the \texttt{exam} document class for five years now. What I like most
1289 is the consistent typesetting of my exams. I don't use sub parts and sub-sub parts
1290 because in my opinion this not the right way to prepare an exam. I've written a
1291 department consistent class that provides the department's cover pages and some
1292 other typesetting trickery. This class is used by a small core of \TeX\ users. Regrettably,
1293 the majority of my colleagues use Word *cough*.
1294
1295 \end{document}