summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ran_toks/examples/rt-tst-qz.tex
blob: 07be7738833da3a4eebaa00ca1763682d9317128 (plain)
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
%
% This demo file shows how to randomize the choices of a quiz created
% by the exerquiz package, where the choices have verbatim text.
%
% The questions themselves are not randomized, but they can be, see random_tst.tex
% to see how to do this.
%
\documentclass{article}
\usepackage[designiv]{web}
\usepackage[allowrandomize,showgrayletters]{exerquiz}
\usepackage{ran-toks} % alt pkg name

% \previewOn\pmpvOn

% When using cross-referencing and \useLastAsSeed, the cross-references are never up to date.
% Once you randomize, read the auxiliary file (\jobname_rt.sav), copy the first seed listed
% and paste in as the argument of \useThisSeed. Compile a few more times to bring cross-references
% up to date.
%\useLastAsSeed
\useThisSeed{955908747}

\rowsepDefault{3pt}


\begin{document}

\begin{quiz*}{myRandomQuiz}
    Riddle me this.
\begin{questions}
    \item Try to guess the correct answer.
    \begin{answers}{2}
    \bChoices[random=true]
        \Ans0 1 a choice\eAns
        \Ans1\label{eq} 2 another choice\eAns
        \Ans0 3 still another choice\eAns
        \Ans0 4 another\eAns
        \Ans0 5 incoming\eAns
        \Ans0 6 more choices\eAns
        \Ans0 7 another still\eAns
        \Ans0 8 too many\eAns
        \Ans0 9 choices\eAns
        \Ans0 10 \input{mytext.verb}\eAns
        \eFreeze
        \Ans0 11 None of these\eAns
    \eChoices
    \end{answers}
\end{questions}
\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz


\newpage

\bRTVToks{myChoices}
\begin{rtVW}
\verb!$ true $!
\end{rtVW}
\begin{rtVW}
\verb!~ false %!
\end{rtVW}
\begin{rtVW}
\verb!% maybe ^!
\end{rtVW}
\begin{rtVW}
\verb!$& perhaps #$!
\end{rtVW}
\eRTVToks

\begin{quiz*}{myQuiz}
Solve each.
\begin{questions}

    \item Which is true? (Answer: \hyperref[rtAns3]{(\REF*{rtAns3})})
\useRTName{myChoices}
\begin{manswers}*{1}
\bChoices[random=true,label=rtAns]
    \Ans{1}\label{rtAns3} \rtTokByNum{1}\eAns
    \Ans{0} Wow, \rtTokByNum{2}, this is great!\eAns
    \Ans{0} \rtTokByNum{3}\eAns
    \Ans{0} \rtTokByNum{4}\eAns
\eFreeze
    \Ans{1} Hello mom!\eAns
\eChoices
\end{manswers}
\begin{solution}
The answer is \useSavedAlts{rtAns}, or to be more precise,
\useSavedAltsAns{rtAns}. \hyperref[rtAns3]{(\REF*{rtAns3})}
\end{solution}

    \item Which is true? (Ans: \hyperref[rtAns1]{(\REF*{rtAns1})})
\useRTName{myChoices}
\begin{answers}*{3}
    \bChoices[random,nCols=2]
        \Ans{1}\label{rtAns1} \rtTokByNum{1}\eAns
        \Ans{0} \rtTokByNum{2}\eAns
        \Ans{0} \rtTokByNum{3}\eAns
        \Ans{0} \rtTokByNum{4}\eAns
    \eChoices
\end{answers}
\begin{solution}
The answer is \hyperref[rtAns1]{(\REF*{rtAns1})} found in the
\nameref{rtAns1} on page~\pageref{rtAns1}.
\end{solution}

    \item Which is true?
\useRTName{myChoices}
\begin{answers}{3}
    \bChoices[random]
        \Ans{1} \rtTokByNum{1}\eAns
        \Ans{0} \rtTokByNum{2}\eAns
        \Ans{0} \rtTokByNum{3}\eAns
        \Ans{0} \rtTokByNum{4}\eAns
    \eChoices
\end{answers}
\end{questions}
\end{quiz*}\quad\ScoreField\currQuiz\CorrButton\currQuiz

\end{document}