summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-06-07 20:07:17 +0000
committerKarl Berry <karl@freefriends.org>2021-06-07 20:07:17 +0000
commit670905f37c1e8d5b5b8f33e9862b3f8d1f80d01f (patch)
treec06fa6e8b83580d326ed659c147d18d791c4f07d
parentb5aa568bfe59e8a263f4af85378326b50f915bc5 (diff)
ran_toks (7jun21)
git-svn-id: svn://tug.org/texlive/trunk@59515 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/README.md26
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/docs/ran_toks.pdfbin284544 -> 302970 bytes
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.pdfbin255885 -> 261526 bytes
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.tex151
-rw-r--r--Master/texmf-dist/doc/latex/ran_toks/examples/nested-matching.tex150
-rw-r--r--Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx55
-rw-r--r--Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty26
-rw-r--r--Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def1
8 files changed, 357 insertions, 52 deletions
diff --git a/Master/texmf-dist/doc/latex/ran_toks/README.md b/Master/texmf-dist/doc/latex/ran_toks/README.md
index 8c3b618c71c..d2de6b319cf 100644
--- a/Master/texmf-dist/doc/latex/ran_toks/README.md
+++ b/Master/texmf-dist/doc/latex/ran_toks/README.md
@@ -1,6 +1,6 @@
The ran_toks Package
Author: D. P. Story
-Dated: 2021-01-19
+Dated: 2021-06-06
This short package, with minimal requirements, defines macros for
randomizing a list of tokens. There are two approaches:
@@ -40,20 +40,22 @@ tokens in the myList list.
For users of AeB or eqexam, the latter structure can be used to randomize
the order of the questions on a quiz or exam.
-What's New (2021-01-19) A new option, usedbapp, was added to
-support a DB application. Extensive work was done on the DB
-application. Added \uniqueXDBChoicesOn, which if expanded, tries
-to choose a random token that has not already been chosen,
-across versions of a multi-version eqexam document. Changes are
-discussed in the documentation and in the new examples in the
-distribution.
+What's New (2021-06-06) Added support for nested \bRTVToks/\eRTVToks command
+ pairs. Demo files: ran_toks.tex and nested-matching.tex.
+
+What's New (2021-01-19) A new option, usedbapp, was added to support a DB
+ application. Extensive work was done on the DB application. Added
+ \uniqueXDBChoicesOn, which if expanded, tries to choose a random token that
+ has not already been chosen, across versions of a multi-version eqexam
+ document. Changes are discussed in the documentation and in the new
+ examples in the distribution.
What's New (2019-12-28) Defined \rtVWHook to insert at the top of the
-rtVW environment. Also created an alternate package name of ran-toks.
+ rtVW environment. Also created an alternate package name of ran-toks.
-What's new in v1.1: Added the convenience command \useTheseDBs to input files for
-an application to constructing exams (using eqexam) from a series of DB files. Refer to the
-new demo file mc-db.tex.
+What's new in v1.1: Added the convenience command \useTheseDBs to input files
+ for an application to constructing exams (using eqexam) from a series of DB
+ files. Refer to the new demo file mc-db.tex.
Enjoy!
diff --git a/Master/texmf-dist/doc/latex/ran_toks/docs/ran_toks.pdf b/Master/texmf-dist/doc/latex/ran_toks/docs/ran_toks.pdf
index bfc8e7bc9b2..815095a955f 100644
--- a/Master/texmf-dist/doc/latex/ran_toks/docs/ran_toks.pdf
+++ b/Master/texmf-dist/doc/latex/ran_toks/docs/ran_toks.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.pdf b/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.pdf
index 62ee68da81c..16146c1f6f7 100644
--- a/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.pdf
+++ b/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.tex b/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.tex
index 8f8b0c6246b..232c1980ca9 100644
--- a/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.tex
+++ b/Master/texmf-dist/doc/latex/ran_toks/docs/rantoks_man.tex
@@ -8,7 +8,8 @@
]{aeb_pro}
\usepackage{ran_toks}
-\useThisSeed{1441984427}
+\useThisSeed{227819015}
+%\useThisSeed{1441984427}
%\useLastAsSeed
%\useThisSeed{2001383846}
@@ -30,6 +31,7 @@
%\usepackage{makeidx}
%\makeindex
\usepackage{acroman}
+\usepackage[active]{srcltx}
\makeatletter
\def\eq@fititin#1{\noindent\unskip\nobreak\hfill\penalty50
@@ -77,17 +79,19 @@
\urlstyle{rm}
+\let\tops\texorpdfstring
+
\DeclareDocInfo
{
university={\AcroTeX.Net},
- title={\texorpdfstring{The \textsf{ran\_toks}}{The manual for the ran\_toks}
- Package\texorpdfstring{\\[6pt]\large}{: }
+ title={\tops{The \textsf{ran\_toks}}{The manual for the ran\_toks}
+ Package\tops{\\[6pt]\large}{: }
Randomizing the order of tokens},
author={D. P. Story},
email={dpstory@acrotex.net},
subject=Documentation for the ran\_toks package,
talksite={\url{www.acrotex.net}},
- version={1.3.1, 2021/01/19},
+ version={1.4, 2021/06/06},
Keywords={LaTeX, PDF, random, tokens, JavaScript, Adobe Acrobat},
copyrightStatus=True,
copyrightNotice={Copyright (C) \the\year, D. P. Story},
@@ -106,7 +110,7 @@
\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb}
\subsectionLayout{indent=-31.25pt,color=aeb}
\subsubsectionLayout{indent=0pt,color=aeb}
-\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}}
+\subsubDefaultDing{\tops{$\bullet$}{\textrm\textbullet}}
\def\exSrc{\makebox[0pt][r]{\large{\Pisymbol{webd}{157}}\enspace}}
@@ -241,7 +245,7 @@ There are two styles for defining a series of tokens to be randomized,
using either the \cs{ranToks} command or the \cs{bRTVToks}/\cs{eRTVToks}
pair. Each of these is discussed in the next two subsections.
-\subsection{The \texorpdfstring{\protect\cs{ranToks}}{\CMD{ranToks}} command}\label{s:ranToks}
+\subsection{The \tops{\protect\cs{ranToks}}{\CMD{ranToks}} command}\label{s:ranToks}
The \cs{ranToks} command was the original concept; declare a series of
tokens to be randomized.
@@ -334,13 +338,13 @@ An alternative to re-executing \cs{ranToks} is to use the \cs{reorderRanToks} co
\reorderRanToks{!ameta(name)}
\end{Verbatim}
\end{minipage}\eVerb Now, executing \verb~\reorderRanToks{myPals}~ and compiling the sentence again yields,
-``I have {\nToksFor{myPals}} pals, they are
+``I~have {\nToksFor{myPals}} pals, they are
\useRanTok{1}, \useRanTok{2}, \useRanTok{3}, \useRanTok{4},
{\useRanTok{5}} and \useRanTok{6}.'' For most applications, re-randomizing
the same token list in the same document is not very likely something you
need to do.
-The \cs{reorderRanToks\darg{\ameta{name}}} rearranges the list of tokens
+The \cs{reorderRanToks\darg{\ameta{name}}} command rearranges the list of tokens
associated with \ameta{name}, which may not be what you want; the
\cs{copyRanToks} command, on the other hand, makes a (randomized) copy of its
first required argument \ameta{name\SUB1} and saves it as \ameta{name\SUB2}, without
@@ -364,7 +368,7 @@ argument of a macro; this would exclude verbatim text created by \cs{verb}
and verbatim environments.
\subsection{The
-\texorpdfstring{\protect\cs{bRTVToks}/\protect\cs{eRTVToks}}
+\tops{\protect\cs{bRTVToks}/\protect\cs{eRTVToks}}
{\CMD{bRTVToks}/\CMD{eRTVToks}} pair of commands}\label{ss:RTVToks}
Sometimes the content to be randomized is quite large or contains verbatim
@@ -495,7 +499,6 @@ If we say \cs{reorderRanToks\darg{myThoughts}} and reissue the above list, we ob
The command \cs{copyRanToks} works for list created by
\cs{bRTVToks}/\penalty0\cs{bRTVToks} as well.
-
\paragraph*{On the \cs{displayListRandomly} command.}\label{para:DLR}
In the enumerate example immediately above, the items in the list are
explicitly listed as \cs{item \cs{useRanTok\darg{1}}} and so on; an
@@ -549,7 +552,131 @@ you modify the optional argument to get the same listing without the Oxford
comma? (\displayListRandomly[\ifnum\i=\last and \fi][\ifnum\i=\last.\else\ifnum\i=\lessone\relax\space\else, \fi\fi]{myPals})
Hint: a solution involves the other command \cs{lessone}.
+\subsubsection{Nested
+\tops{\protect\cs{bRTVToks}/\protect\cs{eRTVToks}}
+ {\CMD{bRTVToks}/\CMD{eRTVToks}} command pairs}\label{ss:NestedRTVToks}
+
+These is at least one example of using nested
+\cs{bRTVToks}/\allowbreak\cs{eRTVToks}. When nested
+\cs{bRTVToks}/\allowbreak\cs{eRTVToks} command pairs, use the \env{rtVWi}
+environment instead of the \env{rtVW} environment. The nested
+\cs{bRTVToks}/\allowbreak\cs{eRTVToks} pair is placed\FmtMP{placement} within
+a \env{rtWV} environment; in this way the contents of that \env{rtWV}
+environment, itself can be randomized. The \cs{displayListRandomly} (or
+\cs{useRanTok}) command is used to list out the nested items. See the next
+page for an example.
+
+\newpage
+
+\bRTVToks{Depth0}
+ \begin{rtVW}
+ Depth0: Item 1
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 2:
+ \bRTVToks{Depth1}
+ \begin{rtVWi}
+ Depth1: Item 1
+\end{rtVWi}
+ \begin{rtVWi}
+ Depth1: Item 2
+ \bRTVToks{Depth2}
+ \begin{rtVWii}
+ Depth2: Item 1
+\end{rtVWii}
+ \begin{rtVWii}
+ Depth2: Item 2
+\end{rtVWii}
+ \begin{rtVWii}
+ Depth2: Item 3
+\end{rtVWii}
+ \eRTVToks
+\begin{itemize}
+ \displayListRandomly[\item]{Depth2}
+\end{itemize}
+\end{rtVWi}
+ \begin{rtVWi}
+ Depth1: Item 3
+\end{rtVWi}
+\eRTVToks
+\begin{itemize}
+\displayListRandomly[\item]{Depth1}
+\end{itemize}
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 3
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 4
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 5
+\end{rtVW}
+\eRTVToks
+ \begin{enumerate}\small
+\displayListRandomly[\item]{Depth0}
+\end{enumerate}
+The verbatim listing for this example follows.
+\begin{Verbatim}[commandchars=!(),fontsize=\small]
+\bRTVToks{Depth0}
+ \begin{rtVW}
+ Depth0: Item 1
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 2:
+ \bRTVToks{Depth1} % !textsf(begin Depth2 within an rtVW env.)
+ \begin{rtVWi}
+ Depth1: Item 1
+\end{rtVWi}
+ \begin{rtVWi}
+ Depth1: Item 2
+ \bRTVToks{Depth2} % !textsf(begin Depth1 within an rtVWi env.)
+ \begin{rtVWii}
+ Depth2: Item 1
+\end{rtVWii}
+ \begin{rtVWii}
+ Depth2: Item 2
+\end{rtVWii}
+ \begin{rtVWii}
+ Depth2: Item 3
+\end{rtVWii}
+ \eRTVToks
+\begin{itemize}
+ \displayListRandomly[\item]{Depth2} % !textsf(display Depth2 toks)
+\end{itemize}
+\end{rtVWi}
+ \begin{rtVWi}
+ Depth1: Item 3
+\end{rtVWi}
+\eRTVToks
+\begin{itemize}
+\displayListRandomly[\item]{Depth1} % !textsf(display Depth1 toks)
+\end{itemize}
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 3
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 4
+\end{rtVW}
+ \begin{rtVW}
+ Depth0: Item 5
+\end{rtVW}
+\eRTVToks
+\begin{enumerate}
+\displayListRandomly[\item]{Depth0} % !textsf(display Depth0 toks)
+\end{enumerate}
+\end{Verbatim}
+Oops. Did I forget to mention that \pkg{ran\_toks} supports nested to a depth of two.
+
+Some authors like to indent nested things, but to avoid spurious spaces
+appearing, \cs{end\darg{rtVW}} (and \cs{end\darg{rtVWi}}) should be placed in
+the far left margin, as shown above. Recall the \env{rtVW} is a verbatim
+environment.
+The above example is reproduced in the \texttt{ran\_toks.tex} sample file found in the
+\texttt{examples} folder. Also found in that folder is \texttt{nested-matching.tex}, a \pkg{exerquiz}
+quiz that motivated creating nested \cs{bRTVToks}/\allowbreak\cs{eRTVToks} command pairs.
\section{Additional arguments and commands}\label{AddCmds}
@@ -633,7 +760,7 @@ The original list for \texttt{myPals} remains unchanged:
\displayListRandomly[\ifnum\i=\last\space and \fi(\the\i)~][\ifnum\i=\last.\else,\fi\space]{myPals}
The \cs{useRanTok} command---whether it operates on a randomized token list
-or not---behaves similarly to an array. Thus, if we wanted the extract
+or not---behaves similarly to an array. Thus, if we wanted to extract
the third entry of the non-randomized token list (array)
\texttt{myOriginalPals}, we do so by expanding the command
\verb!\useRanTok[myOriginalPals]{3}! to produce
@@ -752,7 +879,7 @@ The next step is to input your DB files. To do this, execute either of the comma
or perhaps in the preamble. The syntax is,
\bVerb\takeMeasure{\string\useTheseDBs\darg{\ameta{db\SUB{1}},\ameta{db\SUB{2}},...,\ameta{db\SUB{n}}}}%
\setlength\eflength{\bxSize}%
-\begin{minipage}{\bxSize}\kern0pt\def\1{\rlap{\sffamily\hskip\eflength(An alias for \cs{useTheseDBs})}}\relax
+\begin{minipage}{\bxSize}\def\1{\rlap{\sffamily\hskip\eflength(An alias for \cs{useTheseDBs})}}\kern0pt
\begin{Verbatim}[frame=single,commandchars=!()]
\useTheseDBs{!ameta(db!SUB(1)),!ameta(db!SUB(2)),...,!ameta(db!SUB(n))}
!1\useProbDBs{!ameta(db!SUB(1)),!ameta(db!SUB(2)),...,!ameta(db!SUB(n))}
diff --git a/Master/texmf-dist/doc/latex/ran_toks/examples/nested-matching.tex b/Master/texmf-dist/doc/latex/ran_toks/examples/nested-matching.tex
new file mode 100644
index 00000000000..c6886e2def1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/ran_toks/examples/nested-matching.tex
@@ -0,0 +1,150 @@
+\documentclass{article}
+\usepackage{amstext}
+\usepackage[forcolorpaper]{web}
+\usepackage[usesumrytbls,allowrandomize]{exerquiz}[2021/05/29]
+\usepackage{ran_toks}[2021/05/29]
+\usepackage{multicol}
+
+\DeclareQuiz{Qz1}
+
+\useRandomSeed{1294278923}
+%\useLastAsSeed
+
+\hypersetup{pdfpagemode=UseNone} % don't need to see bookmarks
+\hypersetup{pdfpagelayout=OneColumn}
+\reversemarginpar
+\showCreditMarkup
+
+%\previewOn\pmpvOn
+
+\useBeginQuizButton[\CA{Begin}]
+\useEndQuizButton[\CA{End}]
+\PTsHook{($\eqPTs^{\text{pts}}$)}
+\useMCCircles
+
+\newcommand{\presetMatch}{\Q{1}\AddAAKeystroke{event.change=event.change.toUpperCase();}\rectW{\widthof{AA}}}
+
+\begin{document}
+
+\bRTVToks{\currQuiz}
+
+\begin{quiz*}{\currQuiz}
+Solve each of these problems, passing is 100\%.
+\begin{questions}
+ \begin{rtVW}
+ \item\PTs{2} $9+8=\RespBoxMath{17}*{1}{.0001}{[0,1]}\cgBdry[1bp]
+ \CorrAnsButton{17}$
+ \begin{solution}
+ Blimey! Everyone knows that $ 9 + 8 = 17$, why don't you ? BTW, $17$ is my formerly favorite number.
+\end{solution}
+\end{rtVW}
+
+ \begin{rtVW}
+ \item\PTs{3} Which of the following are numbers?
+ \begin{manswers}*{6}
+ \bChoices[random=true]
+ \Ans[-1]{0}D\eAns
+ \Ans[1]{1}17\eAns
+ \Ans[-1]{0}P\eAns
+ \Ans[1]{1}88\eAns
+ \Ans[-1]{0}S\eAns
+ \Ans[1]{1}105\eAns
+ \eChoices
+ \end{manswers}
+ \begin{solution}
+ Which are numbers? 17, 88, and 105, silly
+\end{solution}
+\end{rtVW}
+
+ \begin{rtVW}
+ \item\PTs{3} $ \cos(\pi) = \RespBoxMath{-1}*{1}{.0001}{[0,1]}\cgBdry[1bp]
+ \CorrAnsButton{-1} $
+\begin{solution}
+$ \cos(\pi) = -1 $
+\end{solution}
+\end{rtVW}
+
+ \begin{rtVW}
+\item\PTs{4} $\displaystyle\frac{d}{dx}{\sin(x)}=\RespBoxMath{cos(x)}*{4}{.0001}{[0,1]}\cgBdry[1bp]
+ \CorrAnsButton{cos(x)} $
+\begin{solution}
+ $\displaystyle\frac{d}{dx}{\sin(x)}= \cos(x) $
+\end{solution}
+\end{rtVW}
+
+ \begin{rtVW}
+\hideCreditMarkup
+ \item\PTs{3} Match the last name of the U.S. President with his first
+ name in the right most two columns. Each problem is worth 1 point.
+
+\bRTVToks{RandomQzQuesB}
+\begin{rtVWi}
+ \PTs*{1}\RespBoxTxt[\presets{\presetMatch}\rectW{5mm}\MaxLen{1}]{0}{0}*{1}{\txtRef{willy}} Brandt
+ \begin{solution}
+ \underbar{Willy} Brandt
+\end{solution}
+\end{rtVWi}
+\begin{rtVWi}
+ \PTs*{1}\RespBoxTxt[\presets{\presetMatch}\rectW{5mm}\MaxLen{1}]{0}{0}*{1}{\txtRef{roman}} Herzog
+ \begin{solution}
+ \underbar{Roman} Herzog
+\end{solution}
+\end{rtVWi}
+\begin{rtVWi}
+ \PTs*{1}\RespBoxTxt[\presets{\presetMatch}\rectW{5mm}\MaxLen{1}]{0}{0}*{1}{\txtRef{konrad}} Adenauer
+ \begin{solution}
+ \underbar{Konrad} Adenauer
+\end{solution}
+\end{rtVWi}
+\eRTVToks
+\bRTVToks{RandomQzAltsB}
+\begin{rtVWi}
+ Gustav
+\end{rtVWi}
+\begin{rtVWi}
+ \label{konrad} Konrad
+\end{rtVWi}
+\begin{rtVWi}
+ \label{willy} Willy
+\end{rtVWi}
+\begin{rtVWi}
+ \label{roman} Roman
+\end{rtVWi}
+\begin{rtVWi}
+ Ludwig
+\end{rtVWi}
+\begin{rtVWi}
+ Hermann
+\end{rtVWi}
+\begin{rtVWi}
+ Karl
+\end{rtVWi}
+\begin{rtVWi}
+ J\"{u}rgen
+\end{rtVWi}
+\eRTVToks
+ \begin{multicols}{4}
+ \begin{questions}[labelwidthTo={\textbf{A}}]
+ \hideCreditMarkup
+ \renewcommand{\theeqquestionnoii}{\Alph{eqquestionnoii}}
+ \displayListRandomly[\item]{RandomQzAltsB}
+ \showCreditMarkup
+ \end{questions}
+ \end{multicols}
+ \begin{questions}
+ \showCreditMarkup
+ \displayListRandomly[\item]{RandomQzQuesB}
+ \end{questions}
+\end{rtVW}
+ \eRTVToks
+ \displayListRandomly{\thisQuiz}
+\end{questions}
+%\writeProListAux
+\end{quiz*}\cgBdry[1em]\ScoreField{\currQuiz}\olBdry\CorrButton{\currQuiz}\vcgBdry[6pt]
+
+Answers: \AnswerField\currQuiz
+
+\begin{center}
+\displaySumryTbl[showmarkup]{\currQuiz}
+\end{center}
+\end{document}
diff --git a/Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx b/Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx
index 5549bbc01c6..7b247d20cef 100644
--- a/Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx
+++ b/Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx
@@ -16,7 +16,7 @@
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
%<package>\ProvidesPackage{ran_toks}
-%<package> [2021/01/19 v1.3.1 Randomizing tokens (dps)]
+%<package> [2021/06/06 v1.4 Randomizing tokens (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,hyperindex=false]{hyperref}
@@ -113,7 +113,7 @@
%\useRanTok{1}, \useRanTok{2},..., \useRanTok{n}
%\end{Verbatim}
% Other details are left to the readers' imagination.
-%
+% \changes{v1.4}{2021/06/06}{Rounded up v1.3.3 to v1.4 for publication}
% \paragraph{Requirements.} As of this writing, we require only the \texttt{verbatim} package
% and \texttt{random.tex}, the package was written by Donald Arseneau.
% \begin{macrocode}
@@ -437,15 +437,15 @@
% access to the contents of the \texttt{rtVW} environments, this done by
% \cs{r@nVToks}.
% \begin{macrocode}
-\newcommand{\eRTVToks}{\global
- \rt@nameedef{\rt@BaseName Cnt}{\the\rt@nCnt}\expandafter
+\newcommand{\eRTVToks}{%
+ \global\rt@nameedef{\rt@BaseName Cnt}{\the\rt@nCnt}\expandafter
\r@nVToks\expandafter{\rt@BaseName}}
% \end{macrocode}
% \end{macro}
% \begin{environment}{rtVW}
% \cs{rtVW} is a verbatim write environment. It saves its contents to the file
% \verb!\jobname_\rt@BaseName-\the\rt@nCnt.cut!. The file is later input back into
-% the source file in a random way. % J14
+% the source file in a random way.
% \begin{macrocode}
\def\reVerbEnd{\ifhmode\unskip\fi}
% \end{macrocode}
@@ -464,6 +464,8 @@
\def\rtVWId#1{\ifviewIDs\noindent#1\fi
\ifxDBUnique\ifrt@InputUsedIDs\wrtProbIds{#1}\fi\fi
}
+% \end{macrocode}
+% \begin{macrocode}
\newenvironment{rtVW}{\global\advance\rt@nCnt\@ne
\immediate\openout\rt@Verb@write
\jobname_\rt@BaseName-\the\rt@nCnt.cut
@@ -478,6 +480,15 @@
\immediate\closeout\rt@Verb@write
}
% \end{macrocode}
+% (2021/05/29) In support of nested |\bRTVToks/\eRTVToks| constructs, we \cs{let}
+% \cs{rtVWi} and \cs{rtVWii} to \cs{rtVW}, and \cs{endrtVWi} and \cs{endrtVWii} to \cs{endrtVW}.
+% \changes{v1.3.3}{2021/05/29}{Assign \string\cs{rtVWi} and \string\cs{endrtVWi}}
+% \begin{macrocode}
+\let\rtVWi\rtVW % dps5-29
+\let\endrtVWi\endrtVW
+\let\rtVWii\rtVW % dps5-29
+\let\endrtVWii\endrtVW
+% \end{macrocode}
% \end{environment}
% \DescribeMacro{\r@nVToks} randomizes the contents of the \texttt{rtVW}
% environment.
@@ -699,12 +710,14 @@
%\changes{v1.0b}{2013/07/29}{Added \string\cs{displayListRandomly}}
%\changes{v1.0e}{2016/02/06}{Added optional argument to \string\cs{displayListRandomly}}
%\changes{v1.1}{2017/05/04}{Added second optional argument to \string\cs{displayListRandomly}}
+%\changes{v1.3.3}{2021/05/29}{In support of nested \string\cs{bRTVToks}/\string\cs{eRTVToks}\space
+% constructs, replace the counter \string\cs{rt@nCnt} with \string\cs{@tempcntb}}
% \begin{macrocode}
-\newcommand{\displayListRandomly}[1][]{\bgroup
+\newcommand{\displayListRandomly}[1][]{\begingroup
\def\rt@prior{#1}\displ@yListRandomly
}
-\newcommand{\displ@yListRandomly}[2][]{\rt@nCnt\z@\expandafter
- \ifx\csname nMax4#2\endcsname\relax
+\newcommand{\displ@yListRandomly}[2][]{\@tempcntb\z@ % dps5-29
+ \expandafter\ifx\csname nMax4#2\endcsname\relax
\rt@rgi\space\textbf{??}\rt@badTokName{#2}#1%
\else
\rt@recordingfalse
@@ -715,14 +728,21 @@
% These four macro are defined locally and not available outside the command
% \cs{displayListRandomly}.
% \begin{macrocode}
- \def\rt@post{#1}\useRTName{#2}\let\i\rt@nCnt
+ \def\rt@post{#1}\useRTName{#2}\let\i\@tempcntb
\def\first{1}\edef\last{\@nameuse{nMax4#2}}\@tempcnta\last
\advance\@tempcnta\m@ne
- \edef\lessone{\the\@tempcnta}\@whilenum\rt@nCnt<\last
- \advance\rt@nCnt\@ne
- \do{\rt@prior\useRanTok{\the\rt@nCnt}\rt@post
+ \edef\lessone{\the\@tempcnta}\@whilenum\@tempcntb<\last
+ \advance\@tempcntb\@ne
+% \end{macrocode}
+% There is one example of this command getting confused and printing the wrong
+% number of items. Here, we pass the optional argument of \cs{useRanTok} and that
+% cleared up the problem.
+% \changes{v1.3.2}{2021/05/25}{Insert optional argument for \string\cs{useRanTok}
+% within \string\cs{displ@yListRandomly}}
+% \begin{macrocode}
+ \do{\rt@prior\useRanTok[#2]{\the\@tempcntb}\rt@post
}\fi
- \egroup
+ \endgroup
}
%</package>
%<*dbapp>
@@ -866,10 +886,11 @@
\def\rt@STOP{\relax}%
% \end{macrocode}
%We use the randomized list for the \ameta{name}
-%\begin{verbatim}
-% \@nameuse{#1-List} is the randomized list: eg,
-% \\{3}\\{2}\\{4}\\{5}\\{1}
-%\end{verbatim}
+\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
+%commandchars={!()},codes={\catcode`\%=9}]
+%\@nameuse{#1-List} is the randomized list: eg,
+%\\{3}\\{2}\\{4}\\{5}\\{1}
+%\end{Verbatim}
% \begin{macrocode}
\let\\\relax\edef\x{\@nameuse{#1-List}}%
\toks@=\expandafter{\x}\let\\\getR@nIndx
diff --git a/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty b/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty
index ae2ae64747b..5c5ed39c47d 100644
--- a/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty
+++ b/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty
@@ -19,7 +19,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{ran_toks}
- [2021/01/19 v1.3.1 Randomizing tokens (dps)]
+ [2021/06/06 v1.4 Randomizing tokens (dps)]
\RequirePackage{verbatim}
\@ifundefined{nextrandom}{\input{random.tex}}{}
\def\nextrandom{\begingroup
@@ -191,8 +191,8 @@
\newcommand{\useRTName}[1]{\gdef\rt@BaseName{#1}}%
\let\rt@BaseName\@empty
\newcommand{\bRTVToks}[1]{\rt@nCnt\z@\useRTName{#1}}
-\newcommand{\eRTVToks}{\global
- \rt@nameedef{\rt@BaseName Cnt}{\the\rt@nCnt}\expandafter
+\newcommand{\eRTVToks}{%
+ \global\rt@nameedef{\rt@BaseName Cnt}{\the\rt@nCnt}\expandafter
\r@nVToks\expandafter{\rt@BaseName}}
\def\reVerbEnd{\ifhmode\unskip\fi}
\def\rtVWHook#1{\def\@rgi{#1}\ifx\@rgi\@empty
@@ -219,6 +219,10 @@
\immediate\write\rt@Verb@write{\string\reVerbEnd}%
\immediate\closeout\rt@Verb@write
}
+\let\rtVWi\rtVW % dps5-29
+\let\endrtVWi\endrtVW
+\let\rtVWii\rtVW % dps5-29
+\let\endrtVWii\endrtVW
\def\r@nVToks#1{\begingroup
\gdef\rt@BaseName{#1}%
\expandafter\rt@nMax\@nameuse{#1Cnt}%
@@ -314,22 +318,22 @@
\egroup
\rt@next
}
-\newcommand{\displayListRandomly}[1][]{\bgroup
+\newcommand{\displayListRandomly}[1][]{\begingroup
\def\rt@prior{#1}\displ@yListRandomly
}
-\newcommand{\displ@yListRandomly}[2][]{\rt@nCnt\z@\expandafter
- \ifx\csname nMax4#2\endcsname\relax
+\newcommand{\displ@yListRandomly}[2][]{\@tempcntb\z@ % dps5-29
+ \expandafter\ifx\csname nMax4#2\endcsname\relax
\rt@rgi\space\textbf{??}\rt@badTokName{#2}#1%
\else
\rt@recordingfalse
- \def\rt@post{#1}\useRTName{#2}\let\i\rt@nCnt
+ \def\rt@post{#1}\useRTName{#2}\let\i\@tempcntb
\def\first{1}\edef\last{\@nameuse{nMax4#2}}\@tempcnta\last
\advance\@tempcnta\m@ne
- \edef\lessone{\the\@tempcnta}\@whilenum\rt@nCnt<\last
- \advance\rt@nCnt\@ne
- \do{\rt@prior\useRanTok{\the\rt@nCnt}\rt@post
+ \edef\lessone{\the\@tempcnta}\@whilenum\@tempcntb<\last
+ \advance\@tempcntb\@ne
+ \do{\rt@prior\useRanTok[#2]{\the\@tempcntb}\rt@post
}\fi
- \egroup
+ \endgroup
}
\endinput
%%
diff --git a/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def b/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def
index ecbd1e6aaf4..a28b6d5fee8 100644
--- a/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def
+++ b/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def
@@ -70,6 +70,7 @@
question}}
\def\xdb@unique#1{\@tempcnta\z@
\def\rt@STOP{\relax}%
+\begin{Verbatim}[xleftmargin=\parindent,fontsize=\small,
\let\\\relax\edef\x{\@nameuse{#1-List}}%
\toks@=\expandafter{\x}\let\\\getR@nIndx
\the\toks@\\\rt@STOP