diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/ran_toks/examples |
Initial commit
Diffstat (limited to 'macros/latex/contrib/ran_toks/examples')
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/db1.tex | 76 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/db2.tex | 65 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/db3.tex | 65 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/db4.tex | 65 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/mc-db.tex | 75 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/mytext.verb | 1 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/ran_toks.tex | 95 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/random_tst.tex | 103 | ||||
-rw-r--r-- | macros/latex/contrib/ran_toks/examples/random_tst_qz.tex | 115 |
9 files changed, 660 insertions, 0 deletions
diff --git a/macros/latex/contrib/ran_toks/examples/db1.tex b/macros/latex/contrib/ran_toks/examples/db1.tex new file mode 100644 index 0000000000..45a8b67124 --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/db1.tex @@ -0,0 +1,76 @@ +% +% First DB, uses ran_toks and eqexam +% +\bRTVToks{DB1-} + +\begin{rtVW} +\begin{problem}[5] +DB1: First: Which is correct? +\begin{answers}{4} +\bChoices[nCols=1,random,label=db1-1] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\begin{solution} +It is obvious that the answer is `\useSavedAns{db1-1}', that is, alternative \useSavedAlts{db1-1} is correct. +\end{solution} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB1: Second: Which is correct? +\begin{answers}{4} +\bChoices[nCols=1,random,label=db1-2] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\begin{solution} +According to the guy sitting next to me, the answer might be \useSavedAlts{db1-2} +\end{solution} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB1: Third: Which is correct? +\begin{answers}{4} +\bChoices[nCols=1,random,label=db1-3] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\begin{solution} +I know the answer in advance to be \useSavedAlts{db1-3}, but don't tell anyone. +\end{solution} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB1: Fourth: Which is correct? +\begin{answers}{4} +\bChoices[nCols=1,random,label=db1-4] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\begin{solution} +After meditating in the lotus position on this question for many hours, we determine that the correct answer is \textbf{\useSavedAltsAns{db1-4}}. +\end{solution} +\end{problem} +\end{rtVW} + +\eRTVToks + +\endinput diff --git a/macros/latex/contrib/ran_toks/examples/db2.tex b/macros/latex/contrib/ran_toks/examples/db2.tex new file mode 100644 index 0000000000..dc18b86faa --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/db2.tex @@ -0,0 +1,65 @@ +% +% Second DB, uses ran_toks and eqexam +% + +\bRTVToks{DB2-} + +\begin{rtVW} +\begin{problem}[5] +DB2: First: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB2: Second: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB2: Third: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB2: Fourth: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\eRTVToks + +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/ran_toks/examples/db3.tex b/macros/latex/contrib/ran_toks/examples/db3.tex new file mode 100644 index 0000000000..1948692f1f --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/db3.tex @@ -0,0 +1,65 @@ +% +% Third DB, uses ran_toks and eqexam +% + +\bRTVToks{DB3-} + +\begin{rtVW} +\begin{problem}[5] +DB3: First: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB3: Second: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB3: Third: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB3: Fourth: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\eRTVToks + +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/ran_toks/examples/db4.tex b/macros/latex/contrib/ran_toks/examples/db4.tex new file mode 100644 index 0000000000..64b1d241ef --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/db4.tex @@ -0,0 +1,65 @@ +% +% Fourth DB, uses ran_toks and eqexam +% + +\bRTVToks{DB4-} + +\begin{rtVW} +\begin{problem}[5] +DB4: First: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB4: Second: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB4: Third: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +DB4: Fourth: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\eRTVToks + +\endinput
\ No newline at end of file diff --git a/macros/latex/contrib/ran_toks/examples/mc-db.tex b/macros/latex/contrib/ran_toks/examples/mc-db.tex new file mode 100644 index 0000000000..0e8ceab7b7 --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/mc-db.tex @@ -0,0 +1,75 @@ +\documentclass{article} +\usepackage[allowrandomize,nosolutions, + forpaper,pointsonleft,noparttotals]{eqexam} +\usepackage{ran_toks} + +\useLastAsSeed +% To reproduce the same pseudo-random sequence, you need to supply a seed +%\useThisSeed{1125676795} + +\examNum{1} +\title[T\nExam]{Test \nExam} +\author{D. P. Story} +\subject[MC]{My Course} +\date{Spring \the\year} +\keywords{Test~\nExam, Section 001} + +\university +{% + THE UNIVERSITY OF AKRON\\ + Theoretical and Applied Mathematics +} +\email{dpstory@uakron.edu} + +% Input the DB files used in the demo file +\useTheseDBs{db1,db2,db3,db4} + + +\begin{document} +\maketitle + +\begin{exam}{Part1} + +\begin{instructions} +Solve each without error. Passing is 100\%. + +\medskip\noindent +This part demonstrates how to not only randomly pull problems (two from each of the DB files) at random, but +to randomize the order they are listed in the exam. +\end{instructions} + +\ranToks{myExam}{% + {\useRanTok[DB1-]{1}} + {\useRanTok[DB1-]{2}} + {\useRanTok[DB2-]{1}} + {\useRanTok[DB2-]{2}} + {\useRanTok[DB3-]{1}} + {\useRanTok[DB3-]{2}} + {\useRanTok[DB4-]{1}} + {\useRanTok[DB4-]{2}} +} +\displayListRandomly{myExam} + +\end{exam} + +\begin{exam}{Part2} + +\begin{instructions} +In this part, we take the same two problems from each of the four DB files, but do not randomize +the order of the questions. +\end{instructions} + +\useRanTok[DB1-]{1} +\useRanTok[DB1-]{2} +\useRanTok[DB2-]{1} +\useRanTok[DB2-]{2} +\useRanTok[DB3-]{1} +\useRanTok[DB3-]{2} +\useRanTok[DB4-]{1} +\useRanTok[DB4-]{2} + +\end{exam} + +\end{document} + + diff --git a/macros/latex/contrib/ran_toks/examples/mytext.verb b/macros/latex/contrib/ran_toks/examples/mytext.verb new file mode 100644 index 0000000000..82865ace47 --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/mytext.verb @@ -0,0 +1 @@ +Hello \verb!$%$#$^~_! world! diff --git a/macros/latex/contrib/ran_toks/examples/ran_toks.tex b/macros/latex/contrib/ran_toks/examples/ran_toks.tex new file mode 100644 index 0000000000..e10238aa5a --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/ran_toks.tex @@ -0,0 +1,95 @@ +\documentclass{article} +\usepackage{ran_toks} +\usepackage{ifthen} + +\useThisSeed{606574325} % comment out this line, and uncomment next line to get ... +%\useLastAsSeed % a new pseudo-random sequence each time you compile. + +% Other useful switches +%\ranToksOn % the default +%\ranToksOff + +\parindent0pt \parskip6pt +\def\cs#1{\texttt{\char`\\#1}} + +\begin{document} +\begin{center}\bfseries + Test file for \textsf{ran\_toks} Package\\[3pt] + D. P. Story +\end{center} + +Test of the \verb!\ranToks! command. + +\ranToks{myPals}{% + {Jim}{Richard}{Don} + {Alex}{Tom}{J\"{u}rgen} +} +I have {\nToksFor{myPals}} pals, they are \useRanTok{1}, \useRanTok{2}, +\useRanTok{3}, \useRanTok{4}, {\useRanTok{5}} and \useRanTok{6}. (Listed +in the order of best friend to least best friend.) + +Test of the \verb!\bRTVToks!/\verb!\eRTVToks! pair of commands, which encloses +\texttt{rtVW} environments. + +\bRTVToks{myThoughts}% +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +Roses are red and violets are blue, +I've forgotten the rest, have you too? +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I gave up saying bad things like +\verb!$#%%%^*%^&#$@#! when I was just a teenager. +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I am a good guy, pass it on! The code for this last sentence is, +\begin{verbatim} +%#$% I am a good guy, pass it on! ^&*&^* +\end{verbatim} +How did that other stuff get in there? +\end{minipage} +\end{rtVW} +\eRTVToks +\begin{enumerate} + \displayListRandomly[\item]{myThoughts} +\end{enumerate} +Use \verb!\useRTName! command when another list separates the current +position from the list you want to use. Here we want to use the list named +\texttt{myPals}, but since that definition, a new list named +\texttt{myThoughts} was declared. + +\useRTName{myPals} +List of pals: \useRanTok{1}, \useRanTok{2}, \useRanTok{3}, +\useRanTok{4}, \useRanTok{5}, and \useRanTok{6}. + +For mixing lists. it might be easier to use the optional parameter: +{\useRanTok[myPals]{1}} and \useRanTok[myThoughts]{1} + +The \cs{rtTokByNum} can retrieve an item from the list in its declared order; +eg, from the \texttt{myPals} list, the first and last are +{\rtTokByNum[myPals]{1}} and \rtTokByNum[myPals]{\nToksFor{myPals}}. + +We demonstrate the command \cs{reorderRanToks} and the optional parameters of \cs{displayListRandomly}: +\begin{quote}\reorderRanToks{myPals}% +List of pals: \displayListRandomly[\ifnum\i=\last\space and \fi][\ifnum\i=\last.\else,\fi\space]{myPals} +\end{quote} +The reordering is global, so \displayListRandomly[\ifnum\i=\last\space and \fi][\ifnum\i=\last\else, \fi]{myPals} +are listed in the same order as above, and different from the original random order seen in the second paragraph +of this document. + +Without the Oxford comma: My pals are +\displayListRandomly[\ifnum\i=\last and \fi][\ifnum\i=\last.\else\ifnum\i=\lessone\relax\space\else, \fi\fi]{myPals} + +The following is the same logic but uses the syntax of the \textsf{ifthen} package: My pals are +\displayListRandomly[\ifthenelse{\i=\last}{and }{}][\ifthenelse{\i=\last}{.}{\ifthenelse{\i=\lessone}{\space}{, }}]{myPals} + +Test the \cs{copyRanToks} command: +\copyRanToks{myPals}{myPals1}\displayListRandomly[\ifthenelse{\i=\last}{and }{}][\ifthenelse{\i=\last}{.}{\ifthenelse{\i=\lessone}{\space}{, }}]{myPals1} +This does not change the order of the \texttt{myPals} list, which is still +\displayListRandomly[\ifnum\i=\last\space and \fi][\ifnum\i=\last.\else,\fi\space]{myPals} + +\end{document} diff --git a/macros/latex/contrib/ran_toks/examples/random_tst.tex b/macros/latex/contrib/ran_toks/examples/random_tst.tex new file mode 100644 index 0000000000..1f64c79907 --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/random_tst.tex @@ -0,0 +1,103 @@ +% +% This demo file shows how to randomize the questions of an exam created +% by the eqexam package. +% +\documentclass{article} +\usepackage[allowrandomize,nosolutions, + forpaper,pointsonleft,noparttotals]{eqexam} +\usepackage{ran_toks} + +\useLastAsSeed +%\useThisSeed{452836675} % fi,t,f,s + +\examNum{1} +\title[T\nExam]{Test \nExam} +\author{D. P. Story} +\subject[MC]{My Course} +\date{Spring \the\year} +\keywords{Test~\nExam, Section 001} + +\university +{% + THE UNIVERSITY OF AKRON\\ + Theoretical and Applied Mathematics +} +\email{dpstory@uakron.edu} + +\begin{document} +\maketitle + + +\begin{exam}{Exam\nExam} + +\begin{instructions} +Solve each problem without error. +\end{instructions} + +\bRTVToks{Exam\nExam} + +\begin{rtVW} +\begin{problem}[5] +First: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +Second: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +Third: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\begin{rtVW} +\begin{problem}[5] +Fourth: Which is correct? +\begin{answers}{4} +\bChoices[nCols=2,random] + \Ans1 True\eAns + \Ans0 False\eAns + \Ans0 Maybe\eAns + \Ans0 Perhaps\eAns +\eChoices +\end{answers} +\end{problem} +\end{rtVW} + +\eRTVToks + +% Ok, now display this questions in a random order. +\displayListRandomly{Exam\nExam} + + +\end{exam} + +\end{document} diff --git a/macros/latex/contrib/ran_toks/examples/random_tst_qz.tex b/macros/latex/contrib/ran_toks/examples/random_tst_qz.tex new file mode 100644 index 0000000000..3ca3c4043e --- /dev/null +++ b/macros/latex/contrib/ran_toks/examples/random_tst_qz.tex @@ -0,0 +1,115 @@ +% +% 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} + +% When using cross-referencing and \useLastAsSeed, the cross-references are never up to date. +% Once you randomize, read the auxiliary file (\jobname_rt.save), copy the first seed listed +% and paste in as the argument of \useThisSeed. Compile a few more times to bring cross-refereces +% up to date. +%\useLastAsSeed +\useThisSeed{1327548830} + +\rowsepDefault{3pt} + + +\begin{document} + +\begin{quiz*}{myRandomQuiz} + Riddle me this. +\begin{questions} + \item Try to guess the correct answer. + \begin{answers}{2} + \bChoices[random] + \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 10 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*} + +\end{document} |