summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/ran_toks/examples
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/ran_toks/examples')
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/db1.tex76
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/db2.tex65
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/db3.tex65
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/db4.tex65
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/mc-db.tex75
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex46
6 files changed, 378 insertions, 14 deletions
diff --git a/Master/texmf-dist/doc/latex/ran_toks/examples/db1.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/db1.tex
new file mode 100644
index 00000000000..45a8b671246
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/ran_toks/examples/db2.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/db2.tex
new file mode 100644
index 00000000000..dc18b86faad
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/ran_toks/examples/db3.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/db3.tex
new file mode 100644
index 00000000000..1948692f1f8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/ran_toks/examples/db4.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/db4.tex
new file mode 100644
index 00000000000..64b1d241ef3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/ran_toks/examples/mc-db.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/mc-db.tex
new file mode 100644
index 00000000000..0e8ceab7b7d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/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/Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex
index 9bbe5ef985d..e10238aa5a7 100644
--- a/Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex
+++ b/Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex
@@ -1,14 +1,16 @@
\documentclass{article}
\usepackage{ran_toks}
+\usepackage{ifthen}
-%\useThisSeed{606574325}
-\useLastAsSeed
-%\rtdebugtrue
-%\ranToksOn
+\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
@@ -26,8 +28,8 @@ 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 and of the
-\texttt{rtVW} environment.
+Test of the \verb!\bRTVToks!/\verb!\eRTVToks! pair of commands, which encloses
+\texttt{rtVW} environments.
\bRTVToks{myThoughts}%
\begin{rtVW}
@@ -53,11 +55,8 @@ How did that other stuff get in there?
\end{rtVW}
\eRTVToks
\begin{enumerate}
- \item \useRanTok{1}
- \item \useRanTok{2}
- \item \useRanTok{3}
+ \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
@@ -70,8 +69,27 @@ List of pals: \useRanTok{1}, \useRanTok{2}, \useRanTok{3},
For mixing lists. it might be easier to use the optional parameter:
{\useRanTok[myPals]{1}} and \useRanTok[myThoughts]{1}
-The \verb!\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}}.
+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}