Debian Codegraph @

texmf-dist/doc/latex/ran_toks/examples/rt-tst-qz.tex

raw
1 %
2 % This demo file shows how to randomize the choices of a quiz created
3 % by the exerquiz package, where the choices have verbatim text.
4 %
5 % The questions themselves are not randomized, but they can be, see random_tst.tex
6 % to see how to do this.
7 %
8 \documentclass{article}
9 \usepackage[designiv]{web}
10 \usepackage[allowrandomize,showgrayletters]{exerquiz}
11 \usepackage{ran-toks} % alt pkg name
12
13 % \previewOn\pmpvOn
14
15 % When using cross-referencing and \useLastAsSeed, the cross-references are never up to date.
16 % Once you randomize, read the auxiliary file (\jobname_rt.sav), copy the first seed listed
17 % and paste in as the argument of \useThisSeed. Compile a few more times to bring cross-references
18 % up to date.
19 %\useLastAsSeed
20 \useThisSeed{955908747}
21
22 \rowsepDefault{3pt}
23
24
25 \begin{document}
26
27 \begin{quiz*}{myRandomQuiz}
28 Riddle me this.
29 \begin{questions}
30 \item Try to guess the correct answer.
31 \begin{answers}{2}
32 \bChoices[random=true]
33 \Ans0 1 a choice\eAns
34 \Ans1\label{eq} 2 another choice\eAns
35 \Ans0 3 still another choice\eAns
36 \Ans0 4 another\eAns
37 \Ans0 5 incoming\eAns
38 \Ans0 6 more choices\eAns
39 \Ans0 7 another still\eAns
40 \Ans0 8 too many\eAns
41 \Ans0 9 choices\eAns
42 \Ans0 10 \input{mytext.verb}\eAns
43 \eFreeze
44 \Ans0 11 None of these\eAns
45 \eChoices
46 \end{answers}
47 \end{questions}
48 \end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz
49
50
51 \newpage
52
53 \bRTVToks{myChoices}
54 \begin{rtVW}
55 \verb!$ true $!
56 \end{rtVW}
57 \begin{rtVW}
58 \verb!~ false %!
59 \end{rtVW}
60 \begin{rtVW}
61 \verb!% maybe ^!
62 \end{rtVW}
63 \begin{rtVW}
64 \verb!$& perhaps #$!
65 \end{rtVW}
66 \eRTVToks
67
68 \begin{quiz*}{myQuiz}
69 Solve each.
70 \begin{questions}
71
72 \item Which is true? (Answer: \hyperref[rtAns3]{(\REF*{rtAns3})})
73 \useRTName{myChoices}
74 \begin{manswers}*{1}
75 \bChoices[random=true,label=rtAns]
76 \Ans{1}\label{rtAns3} \rtTokByNum{1}\eAns
77 \Ans{0} Wow, \rtTokByNum{2}, this is great!\eAns
78 \Ans{0} \rtTokByNum{3}\eAns
79 \Ans{0} \rtTokByNum{4}\eAns
80 \eFreeze
81 \Ans{1} Hello mom!\eAns
82 \eChoices
83 \end{manswers}
84 \begin{solution}
85 The answer is \useSavedAlts{rtAns}, or to be more precise,
86 \useSavedAltsAns{rtAns}. \hyperref[rtAns3]{(\REF*{rtAns3})}
87 \end{solution}
88
89 \item Which is true? (Ans: \hyperref[rtAns1]{(\REF*{rtAns1})})
90 \useRTName{myChoices}
91 \begin{answers}*{3}
92 \bChoices[random,nCols=2]
93 \Ans{1}\label{rtAns1} \rtTokByNum{1}\eAns
94 \Ans{0} \rtTokByNum{2}\eAns
95 \Ans{0} \rtTokByNum{3}\eAns
96 \Ans{0} \rtTokByNum{4}\eAns
97 \eChoices
98 \end{answers}
99 \begin{solution}
100 The answer is \hyperref[rtAns1]{(\REF*{rtAns1})} found in the
101 \nameref{rtAns1} on page~\pageref{rtAns1}.
102 \end{solution}
103
104 \item Which is true?
105 \useRTName{myChoices}
106 \begin{answers}{3}
107 \bChoices[random]
108 \Ans{1} \rtTokByNum{1}\eAns
109 \Ans{0} \rtTokByNum{2}\eAns
110 \Ans{0} \rtTokByNum{3}\eAns
111 \Ans{0} \rtTokByNum{4}\eAns
112 \eChoices
113 \end{answers}
114 \end{questions}
115 \end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz
116
117 \end{document}