summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ran_toks
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-12-31 03:00:32 +0000
committerNorbert Preining <norbert@preining.info>2019-12-31 03:00:32 +0000
commit1f9ab71f8ea4751f440072e9e4da3314edbbcf2e (patch)
tree1ac9f67dd95b7e3072b7951e6cb1590fda73ffb9 /macros/latex/contrib/ran_toks
parent0af8a1a375250bdab8576ca414baae91122ea6a3 (diff)
CTAN sync 201912310300
Diffstat (limited to 'macros/latex/contrib/ran_toks')
-rw-r--r--macros/latex/contrib/ran_toks/README.md5
-rw-r--r--macros/latex/contrib/ran_toks/docs/ran_toks.pdfbin0 -> 106437 bytes
-rw-r--r--macros/latex/contrib/ran_toks/docs/rantoks_man.pdf (renamed from macros/latex/contrib/ran_toks/doc/rantoks_man.pdf)bin224675 -> 226760 bytes
-rw-r--r--macros/latex/contrib/ran_toks/docs/rantoks_man.tex (renamed from macros/latex/contrib/ran_toks/doc/rantoks_man.tex)8
-rw-r--r--macros/latex/contrib/ran_toks/examples/mc-db.tex2
-rw-r--r--macros/latex/contrib/ran_toks/ran_toks.dtx361
-rw-r--r--macros/latex/contrib/ran_toks/ran_toks.ins60
-rw-r--r--macros/latex/contrib/ran_toks/ran_toks.sty302
8 files changed, 267 insertions, 471 deletions
diff --git a/macros/latex/contrib/ran_toks/README.md b/macros/latex/contrib/ran_toks/README.md
index 6e47bf5109..c4c67686b7 100644
--- a/macros/latex/contrib/ran_toks/README.md
+++ b/macros/latex/contrib/ran_toks/README.md
@@ -1,6 +1,6 @@
The ran_toks Package
Author: D. P. Story
-Dated: 2017/05/04
+Dated: 2019-12-28
This short package, with minimal requirements, defines macros for
randomizing a list of tokens. There are two approaches:
@@ -40,6 +40,9 @@ 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 (2019-12-28 ) Defined \rtVWHook to insert at the top of the
+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.
diff --git a/macros/latex/contrib/ran_toks/docs/ran_toks.pdf b/macros/latex/contrib/ran_toks/docs/ran_toks.pdf
new file mode 100644
index 0000000000..8896ea676c
--- /dev/null
+++ b/macros/latex/contrib/ran_toks/docs/ran_toks.pdf
Binary files differ
diff --git a/macros/latex/contrib/ran_toks/doc/rantoks_man.pdf b/macros/latex/contrib/ran_toks/docs/rantoks_man.pdf
index 66c8f3cbfd..8d7c1e06e9 100644
--- a/macros/latex/contrib/ran_toks/doc/rantoks_man.pdf
+++ b/macros/latex/contrib/ran_toks/docs/rantoks_man.pdf
Binary files differ
diff --git a/macros/latex/contrib/ran_toks/doc/rantoks_man.tex b/macros/latex/contrib/ran_toks/docs/rantoks_man.tex
index 2776e3863d..c17c9e9a7e 100644
--- a/macros/latex/contrib/ran_toks/doc/rantoks_man.tex
+++ b/macros/latex/contrib/ran_toks/docs/rantoks_man.tex
@@ -72,7 +72,7 @@
email={dpstory@acrotex.net},
subject=Documentation for the ran\_toks package,
talksite={\url{www.acrotex.net}},
- version={1.1},
+ version={1.2, 2019/12/28},
Keywords={LaTeX,PDF,random, tokens, JavaScript,Adobe Acrobat},
copyrightStatus=True,
copyrightNotice={Copyright (C) \the\year, D. P. Story},
@@ -353,6 +353,12 @@ are written to the computer hard drive and saved under a different name
(based on the parameter \meta{name}). Later, using the \cs{useRanTok}
commands, they are input back into the document in a random order.
+The \env{rtWVW} environment also writes the command
+\cs{RTVWHook}\marginpar{\small\itshape\flushright\cs{RTVWHook}} to the top of
+the file. Its initial value is \cs{relax}. It can be redefined using the convenience
+command \cs{rtVWHook\darg{\ameta{arg}}}, which expands to
+\verb|\def\RTVWHook{|\ameta{arg}\verb|}|.
+
The use of \cs{useRTName} and \cs{useRanTok} were explained and illustrated
in the previous section. Let's go to the examples,
\begin{Verbatim}[xleftmargin=\amtIndent]
diff --git a/macros/latex/contrib/ran_toks/examples/mc-db.tex b/macros/latex/contrib/ran_toks/examples/mc-db.tex
index 0e8ceab7b7..1eb2ce548a 100644
--- a/macros/latex/contrib/ran_toks/examples/mc-db.tex
+++ b/macros/latex/contrib/ran_toks/examples/mc-db.tex
@@ -34,7 +34,7 @@
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
+This part demonstrates how to not only randomly pull problems (two from each of the DB files), but
to randomize the order they are listed in the exam.
\end{instructions}
diff --git a/macros/latex/contrib/ran_toks/ran_toks.dtx b/macros/latex/contrib/ran_toks/ran_toks.dtx
index 0a36c48614..89aafdc826 100644
--- a/macros/latex/contrib/ran_toks/ran_toks.dtx
+++ b/macros/latex/contrib/ran_toks/ran_toks.dtx
@@ -3,9 +3,9 @@
% makeindex -s gind.ist -o ran_toks.ind ran_toks.idx
%<*copyright>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Web package, %%
-%% Copyright (C) 1999-2017 D. P. Story %%
-%% dpstory@uakron.edu %%
+%% ran_toks package, %%
+%% Copyright (C) 1999-2019 D. P. Story %%
+%% dpstory@uakron.edu, dpstory@acrotex.net %%
%% %%
%% This program can redistributed and/or modified under %%
%% the terms of the LaTeX Project Public License %%
@@ -16,7 +16,7 @@
%</copyright>
%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
%<package>\ProvidesPackage{ran_toks}
-%<package> [2017/05/04 v1.1 Randomizing tokens (dps)]
+%<package> [2019/12/28 v1.2 Randomizing tokens (dps)]
%<*driver>
\documentclass{ltxdoc}
\usepackage[colorlinks,hyperindex=false]{hyperref}
@@ -120,7 +120,7 @@
% We redefine \cs{nextrandom} from \texttt{random.tex} to save the initializing seed.
% \begin{macrocode}
\def\nextrandom{\begingroup
- \ifnum\randomi<\@ne % then initialize with time
+ \ifnum\randomi<\@ne % then initialize with time
\global\randomi\time
\global\multiply\randomi388 \global\advance\randomi\year
\global\multiply\randomi31 \global\advance\randomi\day
@@ -163,7 +163,27 @@
% \begin{macrocode}
\def\rt@nameedef#1{\expandafter\edef\csname #1\endcsname}
% \end{macrocode}
+% \begin{macrocode}
+%</package>
+%<*altpkgname>
+% \end{macrocode}
%
+% \section{Alternate package name: \texorpdfstring{\protect\pkg{ran-toks}}{ran-toks}}
+% CTAN lists this package (\pkg{ran\_toks}) as \pkg{ran-toks}, so we'll create
+% a dummy package by that name.
+% \changes{v1.2}{2019/12/28}{Added dummy package \string\pkg{ran-toks}}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{ran-toks}
+ [2019/12/28 v1.0 ran-toks Alt-name (dps)]
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{ran_toks}}
+\ProcessOptions
+\RequirePackage{ran_toks}[2019/12/28]
+% \end{macrocode}
+% \begin{macrocode}
+%</altpkgname>
+%<*package>
+% \end{macrocode}
% \section{Commands for controlling the process}
%
% \DescribeMacro{\ranToksOn}\DescribeMacro{\ranToksOff} These two turn on and turn off
@@ -186,23 +206,23 @@
\def\useLastAsSeed{\rt@useLastAsSeed}
\@onlypreamble\useLastAsSeed
\def\rt@useLastAsSeed{%
- \IfFileExists{\jobname_rt.sav}{%
- \PackageInfo{ran_toks}{Inputting \jobname_rt.sav}%
- \@ifundefined{readsavfile}{\newread\readsavfile}{}%
- \openin\readsavfile=\jobname_rt.sav
- \read\readsavfile to \InitSeedValue
- \read\readsavfile to \lastRandomNum
- \closein\readsavfile
- \randomi=\lastRandomNum
+ \IfFileExists{\jobname_rt.sav}{%
+ \PackageInfo{ran_toks}{Inputting \jobname_rt.sav}%
+ \@ifundefined{readsavfile}{\newread\readsavfile}{}%
+ \openin\readsavfile=\jobname_rt.sav
+ \read\readsavfile to \InitSeedValue
+ \read\readsavfile to \lastRandomNum
+ \closein\readsavfile
+ \randomi=\lastRandomNum
% \end{macrocode}
% When \cs{useLastAsSeed}, the last becomes the first.
% \begin{macrocode}
\xdef\InitSeedValue{\the\randomi}
- }{%
- \PackageInfo{ran_toks}{\jobname_rt.sav cannot
- be found, \MessageBreak
- using the random initializer}%
- }%
+ }{%
+ \PackageInfo{ran_toks}{\jobname_rt.sav cannot
+ be found, \MessageBreak
+ using the random initializer}%
+ }%
}
\@ifundefined{aeb@randomizeChoices}{%
\let\inputRandomSeed\useLastAsSeed
@@ -214,12 +234,12 @@
% A standard \cs{verbatim} write used in exerquiz and other package in the AeB family.
% \begin{macrocode}
\def\verbatimwrite{\@bsphack
- \let\do\@makeother\dospecials
- \catcode`\^^M\active \catcode`\^^I=12
- \def\verbatim@processline{%
- \immediate\write\verbatim@out
- {\the\verbatim@line}}%
- \verbatim@start}
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active \catcode`\^^I=12
+ \def\verbatim@processline{%
+ \immediate\write\verbatim@out
+ {\the\verbatim@line}}%
+ \verbatim@start}
\def\endverbatimwrite{\@esphack}
\def\rt@IWVO{\immediate\write\verbatim@out}
% \end{macrocode}
@@ -227,15 +247,15 @@
% \begin{macrocode}
\def\InitSeedValue{\the\randomi}
\def\rt@writeSeedData{\ifsaveseed
- \@ifundefined{saveseedinfo}{\newwrite\saveseedinfo}{}
- \immediate\openout \saveseedinfo \jobname_rt.sav
- \let\verbatim@out\saveseedinfo
- \def\rt@msgi{initializing seed value}%
- \def\rt@msgii{last random number used}%
- \uccode`c=`\%\uppercase{%
- \rt@IWVO{\InitSeedValue\space c \rt@msgi}%
- \rt@IWVO{\the\randomi\space c \rt@msgii}}\immediate
- \closeout\saveseedinfo\fi}
+ \@ifundefined{saveseedinfo}{\newwrite\saveseedinfo}{}
+ \immediate\openout \saveseedinfo \jobname_rt.sav
+ \let\verbatim@out\saveseedinfo
+ \def\rt@msgi{initializing seed value}%
+ \def\rt@msgii{last random number used}%
+ \uccode`c=`\%\uppercase{%
+ \rt@IWVO{\InitSeedValue\space c \rt@msgi}%
+ \rt@IWVO{\the\randomi\space c \rt@msgii}}\immediate
+ \closeout\saveseedinfo\fi}
% \end{macrocode}
% Save the initial seed value to hard drive.
% \begin{macrocode}
@@ -248,9 +268,9 @@
% randomly permuted by \cs{rt@RandomizeList}.
% \begin{macrocode}
\def\rt@populateList#1{\rt@listIn={}\rt@nCnt\z@
- \@whilenum\rt@nCnt<#1\do{\advance\rt@nCnt\@ne
- \edef\rt@listInHold{\the\rt@listIn\noexpand\\{\the\rt@nCnt}}%
- \rt@listIn=\expandafter{\rt@listInHold}}}
+ \@whilenum\rt@nCnt<#1\do{\advance\rt@nCnt\@ne
+ \edef\rt@listInHold{\the\rt@listIn\noexpand\\{\the\rt@nCnt}}%
+ \rt@listIn=\expandafter{\rt@listInHold}}}
% \end{macrocode}
% \DescribeMacro{\rt@RandomizeList}\hskip-\marginparsep\thinspace|{|\ameta{n}|}|
% is the command that gets the process of randomizing
@@ -259,17 +279,17 @@
% calls \cs{rt@randomizeList} to actually do the work.
% \begin{macrocode}
\def\rt@RandomizeList#1{\global
- \rt@listIn={}\global\rt@newListIn={}\global\rt@listOut={}%
- \rt@nMax=#1\relax\rt@populateList{\the\rt@nMax}%
- \ifwerandomize
- \expandafter\rt@randomizeList\else
- \global\rt@listOut=\expandafter{\the\rt@listIn}\fi
+ \rt@listIn={}\global\rt@newListIn={}\global\rt@listOut={}%
+ \rt@nMax=#1\relax\rt@populateList{\the\rt@nMax}%
+ \ifwerandomize
+ \expandafter\rt@randomizeList\else
+ \global\rt@listOut=\expandafter{\the\rt@listIn}\fi
% \end{macrocode}
% Save the list out as \cs{rt@BaseName-List} for later retrieval. This is the randomized
% list of integers for this base name.
% \changes{v1.1}{2017/05/04}{Save out list for later use}
% \begin{macrocode}
- \global\rt@nameedef{\rt@BaseName-List}{\the\rt@listOut}}
+ \global\rt@nameedef{\rt@BaseName-List}{\the\rt@listOut}}
% \end{macrocode}
% \DescribeMacro{\rt@randomizeList} randomizes the list of consecutive integers, and leaves the
% results,
@@ -280,24 +300,24 @@
% \cs{rt@randomizeList} is a loop, looping between itself and \cs{rt@loopTest}.
% \begin{macrocode}
\def\rt@randomizeList{\let\\=\rt@processi
- \setrannum{\rt@getRanNum}{1}{\the\rt@nMax}%
+ \setrannum{\rt@getRanNum}{1}{\the\rt@nMax}%
\ifrtdebug\typeout{\string\rt@getRanNum=\the\rt@getRanNum}\fi
- \rt@nCnt\z@
+ \rt@nCnt\z@
\ifrtdebug\typeout{LISTING: \the\rt@listIn}\fi
- \the\rt@listIn
- \rt@loopTest
+ \the\rt@listIn
+ \rt@loopTest
}
\def\rt@loopTest{\advance\rt@nMax\m@ne
- \ifnum\rt@nMax>\z@
- \def\rt@next{%
- \rt@listIn=\expandafter{\the\rt@newListIn}%
- \rt@newListIn={}\rt@randomizeList}%
- \else
- \let\rt@next\relax
- \global\rt@listOut=\expandafter{\the\rt@listOut}%
-\ifrtdebug\typeout{Final Result: \string\rt@listOut=\the\rt@listOut}\fi
- \fi
- \rt@next
+ \ifnum\rt@nMax>\z@
+ \def\rt@next{%
+ \rt@listIn=\expandafter{\the\rt@newListIn}%
+ \rt@newListIn={}\rt@randomizeList}%
+ \else
+ \let\rt@next\relax
+ \global\rt@listOut=\expandafter{\the\rt@listOut}%
+ \ifrtdebug
+ \typeout{Final Result: \string\rt@listOut=\the\rt@listOut}\fi
+ \fi\rt@next
}
% \end{macrocode}
% In \cs{rt@randomizeList}, we \verb~\let\\=\rt@processi~ before dumping the
@@ -305,16 +325,16 @@
% is the random integer between 1 and \cs{rt@nMax}.
% \begin{macrocode}
\def\rt@processi#1{\advance\rt@nCnt\@ne
- \ifnum\rt@nCnt=\rt@getRanNum
- \edef\rt@listOutHold{\the\rt@listOut}%
- \global\rt@listOut=\expandafter{\rt@listOutHold\\{#1}}%
-\ifrtdebug\typeout{Found it: \string\\{#1}}%
-\typeout{New \string\rt@listOut: \the\rt@listOut}\fi
- \else
- \edef\rt@listInHold{\the\rt@newListIn}%
- \rt@newListIn=\expandafter{\rt@listInHold\\{#1}}%
-\ifrtdebug\typeout{\string\rt@newListIn: \the\rt@newListIn}\fi
- \fi
+ \ifnum\rt@nCnt=\rt@getRanNum
+ \edef\rt@listOutHold{\the\rt@listOut}%
+ \global\rt@listOut=\expandafter{\rt@listOutHold\\{#1}}%
+ \ifrtdebug\typeout{Found it: \string\\{#1}}%
+ \typeout{New \string\rt@listOut: \the\rt@listOut}\fi
+ \else
+ \edef\rt@listInHold{\the\rt@newListIn}%
+ \rt@newListIn=\expandafter{\rt@listInHold\\{#1}}%
+ \ifrtdebug\typeout{\string\rt@newListIn: \the\rt@newListIn}\fi
+ \fi
}
% \end{macrocode}
% We perform modular arithmetic when the index of \cs{useRanTok} is too large.
@@ -326,36 +346,36 @@
% This macro uses \cs{dimen0} and
% \cs{dimen2}, so it should be called within a group.
% \begin{macrocode}
- \advance\count\z@\m@ne\divide\count\z@ #2\relax
- \multiply\count\z@ #2\relax
- \advance\count\tw@-\count\z@
- \edef\rt@mod{\the\count\tw@}}
+ \advance\count\z@\m@ne\divide\count\z@ #2\relax
+ \multiply\count\z@ #2\relax
+ \advance\count\tw@-\count\z@
+ \edef\rt@mod{\the\count\tw@}}
% \end{macrocode}
% Warning messages, these are \DescribeMacro{\rt@badIndex}\cs{rt@badIndex} and
% \cs{rt@badTokName}\DescribeMacro{\rt@badTokName}.
% \begin{macrocode}
\def\rt@badIndex#1#2{\PackageWarningNoLine{ran_toks}
- {The argument of \string\useRanTok{#1} on line
- \the\inputlineno\space is\MessageBreak
+ {The argument of \string\useRanTok{#1} on line
+ \the\inputlineno\space is\MessageBreak
greater than \string\nToksFor{#2} (\nToksFor{#2}),
- instead will use\MessageBreak
+ instead will use\MessageBreak
\string\useRanTok{\rt@mod}, obtained from modular
- arithmetic.\MessageBreak
+ arithmetic.\MessageBreak
You might want to fix this}
}
\def\rt@badTokName#1{%
- \PackageWarningNoLine{ran_toks}
- {The token list `#1' on line \the\inputlineno\space
- is undefined,\MessageBreak
+ \PackageWarningNoLine{ran_toks}
+ {The token list `#1' on line \the\inputlineno\space
+ is undefined,\MessageBreak
possibly simply mispelled; check spelling.\MessageBreak
If undefined, use \string\ranToks\space or \string\bRTVToks/%
- \string\eRTVToks\space\MessageBreak
+ \string\eRTVToks\space\MessageBreak
to define a list with the name `#1'}%
}
\def\rt@warnTokName#1{%
- \PackageWarningNoLine{ran_toks}
- {The token list `#1' on line \the\inputlineno\space
- is already defined,\MessageBreak
+ \PackageWarningNoLine{ran_toks}
+ {The token list `#1' on line \the\inputlineno\space
+ is already defined,\MessageBreak
will overwrite this list}%
}
% \end{macrocode}
@@ -365,8 +385,8 @@
% The randomized listing can be accessed using \cs{useRanTok}.
% \begin{macrocode}
\def\ranToks#1{\begingroup
- \useRTName{#1}%
- \r@nToks
+ \useRTName{#1}%
+ \r@nToks
}
\long\def\r@nToks#1{\rt@nMax\z@\r@ndToks#1\rt@NIL}
\def\rt@NIL{@nil}
@@ -394,8 +414,8 @@
% \cs{r@nVToks}.
% \begin{macrocode}
\newcommand{\eRTVToks}{\global
- \rt@nameedef{\rt@BaseName Cnt}{\the\rt@nCnt}%
- \expandafter\r@nVToks\expandafter{\rt@BaseName}}
+ \rt@nameedef{\rt@BaseName Cnt}{\the\rt@nCnt}%
+ \expandafter\r@nVToks\expandafter{\rt@BaseName}}
% \end{macrocode}
% \end{macro}
% \begin{environment}{rtVW}
@@ -404,15 +424,24 @@
% the source file in a random way.
% \begin{macrocode}
\def\reVerbEnd{\ifhmode\unskip\fi}
+% \end{macrocode}
+% Insert the hook \cs{rtVWHook} prior to writing the verbatim content.
+% The default is \cs{relax}.
+% \changes{v1.2}{2019/12/28}{Defined \string\cs{rtVWHook}}
+% \begin{macrocode}
+\def\rtVWHook#1{\def\@rgi{#1}\ifx\@rgi\@empty
+ \let\RTVWHook\relax\else\def\RTVWHook{#1}\fi}
+\rtVWHook{}
\newenvironment{rtVW}{\global\advance\rt@nCnt\@ne
- \immediate\openout\rt@Verb@write
- \jobname_\rt@BaseName\the\rt@nCnt.cut
- \let\verbatim@out\rt@Verb@write
- \verbatimwrite
+ \immediate\openout\rt@Verb@write
+ \jobname_\rt@BaseName\the\rt@nCnt.cut
+ \let\verbatim@out\rt@Verb@write
+ \rt@IWVO{\string\RTVWHook}%
+ \verbatimwrite
}{%
- \endverbatimwrite
- \immediate\write\rt@Verb@write{\string\reVerbEnd}%
- \immediate\closeout\rt@Verb@write
+ \endverbatimwrite
+ \immediate\write\rt@Verb@write{\string\reVerbEnd}%
+ \immediate\closeout\rt@Verb@write
}
% \end{macrocode}
% \end{environment}
@@ -420,15 +449,15 @@
% environment.
% \begin{macrocode}
\def\r@nVToks#1{\begingroup
- \gdef\rt@BaseName{#1}%
- \expandafter\rt@nMax\@nameuse{#1Cnt}%
- \rt@listIn={}\rt@nCnt=0\relax\let\rt@listInHold\@empty
- \@whilenum\rt@nCnt<\rt@nMax\do{\advance\rt@nCnt\@ne
- \edef\rt@listInHold{%
- \the\rt@listIn{\noexpand\rt@inputVerb{#1\the\rt@nCnt}}}%
- \rt@listIn=\expandafter{\rt@listInHold}}\ifrtdebug
- \typeout{\string\r@nVToks: \the\rt@listIn}\fi
- \expandafter\r@nToks\expandafter{\the\rt@listIn}}
+ \gdef\rt@BaseName{#1}%
+ \expandafter\rt@nMax\@nameuse{#1Cnt}%
+ \rt@listIn={}\rt@nCnt=0\relax\let\rt@listInHold\@empty
+ \@whilenum\rt@nCnt<\rt@nMax\do{\advance\rt@nCnt\@ne
+ \edef\rt@listInHold{%
+ \the\rt@listIn{\noexpand\rt@inputVerb{#1\the\rt@nCnt}}}%
+ \rt@listIn=\expandafter{\rt@listInHold}}\ifrtdebug
+ \typeout{\string\r@nVToks: \the\rt@listIn}\fi
+ \expandafter\r@nToks\expandafter{\the\rt@listIn}}
\def\rt@inputVerb#1{\input{\jobname_#1.cut}}
% \end{macrocode}
% \DescribeMacro{\r@ndToks} is main looping command for \cs{ranToks}
@@ -442,11 +471,11 @@
% \end{macrocode}
% If the current argument is \cs{par}, we skip it
% \begin{macrocode}
- \ifx\rt@rgi\rt@PAR\def\rt@next{\r@ndToks}\else
- \advance\rt@nMax\@ne
- \global\@namedef{rtTok\the\rt@nMax\rt@BaseName}{#1}%
- \def\rt@next{\@ifnextchar\rt@NIL
- {\rt@endToks\@gobble}{\r@ndToks}}\fi\rt@next}
+ \ifx\rt@rgi\rt@PAR\def\rt@next{\r@ndToks}\else
+ \advance\rt@nMax\@ne
+ \global\@namedef{rtTok\the\rt@nMax\rt@BaseName}{#1}%
+ \def\rt@next{\@ifnextchar\rt@NIL
+ {\rt@endToks\@gobble}{\r@ndToks}}\fi\rt@next}
% \end{macrocode}
% \hskip-\marginparsep|{|\ameta{n}|}| The \DescribeMacro{\rt@performRanDefns}\cs{rt@performRanDefns} performs code that
% is repeated in several other macros: \cs{rt@endToks}, \cs{reorderRanToks}, and
@@ -457,12 +486,12 @@
% \end{macrocode}
% Now we randomize the order of the integers 1, 2,\dots \texttt{\#1}.
% \begin{macrocode}
- \rt@RandomizeList{#1}\rt@nCnt\z@
+ \rt@RandomizeList{#1}\rt@nCnt\z@
% \end{macrocode}
% Now we randomize the definitions. We \verb!\let\\=\rt@ssign!, then
% let loose the tokens!
% \begin{macrocode}
- \let\\\rt@ssign\the\rt@listOut}
+ \let\\\rt@ssign\the\rt@listOut}
% \end{macrocode}
% The final destination for \DescribeMacro{\rt@endToks}\cs{r@ndToks}.
% \begin{macrocode}
@@ -470,23 +499,23 @@
% \end{macrocode}
% Save the number of tokens counted
% \begin{macrocode}
- \rt@nameedef{nMax4\rt@BaseName}{\the\rt@nMax}%
- \rt@performRanDefns{\the\rt@nMax}\endgroup}
+ \rt@nameedef{nMax4\rt@BaseName}{\the\rt@nMax}%
+ \rt@performRanDefns{\the\rt@nMax}\endgroup}
% \end{macrocode}
% \begin{macro}{\reorderRanToks}\hskip-\marginparsep\,\texttt{\darg{\ameta{name}}}
% The \cs{reorderRanToks} command reorders (or re-indexes)
% the family with name \ameta{name} (\texttt{\#1}).
% \begin{macrocode}
\def\reorderRanToks#1{\begingroup\useRTName{#1}\expandafter
- \ifx\csname nMax4#1\endcsname\relax
+ \ifx\csname nMax4#1\endcsname\relax
% \end{macrocode}
% Document author has not run \cs{ranToks} yet for this basename (\texttt{\#1})
% \begin{macrocode}
- \rt@badTokName{#1}\else
+ \rt@badTokName{#1}\else
% \end{macrocode}
% Good to go. We reorder this list.
% \begin{macrocode}
- \rt@performRanDefns{\@nameuse{nMax4#1}}\fi
+ \rt@performRanDefns{\@nameuse{nMax4#1}}\fi
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -496,33 +525,33 @@
% a randomization of the same list, without affecting the original order of \ameta{name1}.
% \begin{macrocode}
\newcommand\copyRanToks[2]{\begingroup\expandafter
- \ifx\csname nMax4#1\endcsname\relax
+ \ifx\csname nMax4#1\endcsname\relax
% \end{macrocode}
% Source list is not defined
% \begin{macrocode}
\rt@badTokName{#1}%
- \else\expandafter
+ \else\expandafter
% \end{macrocode}
% Source list is defined
% \begin{macrocode}
- \ifx\csname nMax4#2\endcsname\relax
+ \ifx\csname nMax4#2\endcsname\relax
% \end{macrocode}
% Destination list is not defined, which is good in this instance. This is
% the case we copy the list.
% \begin{macrocode}
- \useRTName{#2}\global
- \rt@nameedef{nMax4#2}{\@nameuse{nMax4#1}}%
- \rt@nCnt=\csname nMax4#2\endcsname\relax
- \@whilenum\rt@nCnt>\z@\do{\global
- \rt@nameedef{rtTok\the\rt@nCnt#2}%
- {\noexpand\@nameuse{rtTok\the\rt@nCnt#1}}%
- \advance\rt@nCnt\m@ne}%
- \rt@performRanDefns{\@nameuse{nMax4#2}}\else
+ \useRTName{#2}\global
+ \rt@nameedef{nMax4#2}{\@nameuse{nMax4#1}}%
+ \rt@nCnt=\csname nMax4#2\endcsname\relax
+ \@whilenum\rt@nCnt>\z@\do{\global
+ \rt@nameedef{rtTok\the\rt@nCnt#2}%
+ {\noexpand\@nameuse{rtTok\the\rt@nCnt#1}}%
+ \advance\rt@nCnt\m@ne}%
+ \rt@performRanDefns{\@nameuse{nMax4#2}}\else
% \end{macrocode}
% Destination list is defined already, warn the user.
% \begin{macrocode}
- \rt@warnTokName{#2}\fi
- \fi
+ \rt@warnTokName{#2}\fi
+ \fi
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -531,42 +560,42 @@
% contents of \verb!\the\rt@listOut!.
% \begin{macrocode}
\def\rt@ssign#1{\advance\rt@nCnt\@ne\global
- \rt@nameedef{rtRanTok\the\rt@nCnt\rt@BaseName}{\noexpand
- \@nameuse{rtTok#1\rt@BaseName}}}
+ \rt@nameedef{rtRanTok\the\rt@nCnt\rt@BaseName}{\noexpand
+ \@nameuse{rtTok#1\rt@BaseName}}}
% \end{macrocode}
% \subsection{Additional user access commands}
% \DescribeMacro{\nToksFor}\hskip-\marginparsep\texttt{\darg{\ameta{name}}}
% expands the the number of tokens whose name is \ameta{name} (\texttt{\#1}).
% \begin{macrocode}
\newcommand{\nToksFor}[1]{\expandafter
- \ifx\csname nMax4#1\endcsname\relax
- \textbf{??}\rt@badTokName{#1}\else
- \@nameuse{nMax4#1}\fi}
+ \ifx\csname nMax4#1\endcsname\relax
+ \textbf{??}\rt@badTokName{#1}\else
+ \@nameuse{nMax4#1}\fi}
% \end{macrocode}
% \DescribeMacro{\rtTokByNum}\hskip-\marginparsep\texttt{[\ameta{name}]\darg{\ameta{num}}} is an internal macro, but it can be used publicly.
% The argument of it is an integer, eg, \verb!\rtTokByNum{3}! is the third token, as listed in the order
% given in the argument of \cs{ranToks}.
% \begin{macrocode}
\newcommand{\rtTokByNum}[2][\rt@BaseName]{\expandafter
- \ifx\csname nMax4#1\endcsname\relax
- \textbf{??}\rt@badTokName{#1}\else
- \@nameuse{rtTok#2#1}\expandafter\ignorespaces\fi}
+ \ifx\csname nMax4#1\endcsname\relax
+ \textbf{??}\rt@badTokName{#1}\else
+ \@nameuse{rtTok#2#1}\expandafter\ignorespaces\fi}
% \end{macrocode}
%\DescribeMacro{\useRanTok}\hskip-\marginparsep\texttt{[\ameta{name}]\darg{\ameta{num}}}
% After \cs{ranToks} has been executed, the user has access to the
% randomized tokens through \cs{useRanTok}. The argument \ameta{num} is an integer 1 through max.
% \begin{macrocode}
\newcommand{\useRanTok}[2][\rt@BaseName]{\bgroup
- \expandafter\ifx\csname nMax4#1\endcsname\relax
- \rt@badTokName{#1}\else
+ \expandafter\ifx\csname nMax4#1\endcsname\relax
+ \rt@badTokName{#1}\else
\ifnum#2>\nToksFor{#1}\rt@modarith{#2}{\nToksFor{#1}}%
% \end{macrocode}
% If index (\texttt{\#2}) is greater than array length, use modular arithmetic to resolve
% the issue, and send a warning to the user.
% \changes{v1.1}{2017/05/04}{Add modular arithmetic to resolve case where index is greater than length}
% \begin{macrocode}
- \rt@badIndex{#2}{#1}\@nameuse{rtRanTok\rt@mod#1}\else
- \@nameuse{rtRanTok#2#1}\fi\fi\egroup}
+ \rt@badIndex{#2}{#1}\@nameuse{rtRanTok\rt@mod#1}\else
+ \@nameuse{rtRanTok#2#1}\fi\fi\egroup}
% \end{macrocode}
% \DescribeMacro{\displayListRandomly}\hskip-\marginparsep\texttt{[\ameta{prior}][\ameta{post}]\darg{\ameta{name}}}
% lists all items in the list as passed
@@ -578,11 +607,11 @@
%\changes{v1.1}{2017/05/04}{Added second optional argument to \string\cs{displayListRandomly}}
% \begin{macrocode}
\newcommand{\displayListRandomly}[1][]{\bgroup\def\rt@prior{#1}%
- \displ@yListRandomly}
+ \displ@yListRandomly}
\newcommand{\displ@yListRandomly}[2][]{\rt@nCnt\z@
- \expandafter\ifx\csname nMax4#2\endcsname\relax
- \rt@rgi\space\textbf{??}\rt@badTokName{#2}#1%
- \else
+ \expandafter\ifx\csname nMax4#2\endcsname\relax
+ \rt@rgi\space\textbf{??}\rt@badTokName{#2}#1%
+ \else
% \end{macrocode}
% Within the optional arguments, we define \DescribeMacro{\i}\cs{i},
% \DescribeMacro{\first}\cs{first}, \DescribeMacro{\last}\cs{last}, and
@@ -590,22 +619,22 @@
% 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\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}%
- \fi\egroup
-}
+ \def\rt@post{#1}\useRTName{#2}\let\i\rt@nCnt
+ \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}%
+ \fi
+\egroup}
% \end{macrocode}
% \section{Commands that support a DB application}
% We begin with some utility commands to help parse the argument of \cs{useProbDBs}.
% \begin{macrocode}
\def\rt@gettonil#1\@nil{\def\to@nilarg{#1}}
\def\rt@ifspc{\ifx\@let@token\@sptoken
- \let\rt@next\rt@xifspc\else
- \let\rt@next\rt@gettonil\fi\rt@next}
+ \let\rt@next\rt@xifspc\else
+ \let\rt@next\rt@gettonil\fi\rt@next}
\begingroup
\def\:{\rt@xifspc}
\expandafter\gdef\: {\futurelet\@let@token\rt@ifspc}
@@ -618,21 +647,21 @@
% in the preamble. Refer to the demo file \texttt{mc\_db.tex} for an illustration of its intended use.
% \begin{macrocode}
\def\ProbDBWarningMsg#1{\filename@parse{#1}
- \PackageWarning{ran_toks}
- {The file \filename@area\filename@base.\ifx\filename@ext\relax
- tex\else\filename@ext\fi\space cannot be found}}
+ \PackageWarning{ran_toks}
+ {The file \filename@area\filename@base.\ifx\filename@ext\relax
+ tex\else\filename@ext\fi\space cannot be found}}
\def\useTheseDBs#1{\def\rt@dblist{#1}\ifx\rt@dblist\@empty\else
- \let\rt@DB@List\@empty
- \edef\temp@expand{\noexpand\@for\noexpand\@@tmp:=\rt@dblist}%
- \temp@expand\do{\ifx\@@tmp\@empty\else
- \expandafter\rt@strpspcs\@@tmp\@nil\edef\@@tmp{\to@nilarg}%
- \edef\rt@nextDB{\noexpand
- \InputIfFileExists{\@@tmp}{}{\noexpand
- \ProbDBWarningMsg{\@@tmp}}}%
- \toks\tw@=\expandafter{\rt@DB@List}%
- \toks@=\expandafter{\rt@nextDB}%
- \edef\rt@DB@List{\the\toks\tw@\space\the\toks@}\fi
- }\expandafter\rt@DB@List\fi}
+ \let\rt@DB@List\@empty
+ \edef\temp@expand{\noexpand\@for\noexpand\@@tmp:=\rt@dblist}%
+ \temp@expand\do{\ifx\@@tmp\@empty\else
+ \expandafter\rt@strpspcs\@@tmp\@nil\edef\@@tmp{\to@nilarg}%
+ \edef\rt@nextDB{\noexpand
+ \InputIfFileExists{\@@tmp}{}{\noexpand
+ \ProbDBWarningMsg{\@@tmp}}}%
+ \toks\tw@=\expandafter{\rt@DB@List}%
+ \toks@=\expandafter{\rt@nextDB}%
+ \edef\rt@DB@List{\the\toks\tw@\space\the\toks@}\fi
+ }\expandafter\rt@DB@List\fi}
\let\useProbDBs\useTheseDBs
% \end{macrocode}
% \end{macro}
diff --git a/macros/latex/contrib/ran_toks/ran_toks.ins b/macros/latex/contrib/ran_toks/ran_toks.ins
new file mode 100644
index 0000000000..4d2d77d191
--- /dev/null
+++ b/macros/latex/contrib/ran_toks/ran_toks.ins
@@ -0,0 +1,60 @@
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright 1999-2019 D. P. Story
+%%
+%% This file is part of the `AcroTeX eDucation Bundle'.
+%% -------------------------------------------
+%%
+%% It may be distributed under the conditions of the LaTeX Project Public
+%% License, either version 1.2 of this license or (at your option) any
+%% later version. The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.2 or later is part of all distributions of LaTeX
+%% version 1999/12/01 or later.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\filedate{2019/12/28}
+\def\batchfile{ran_toks.ins}
+%
+\input docstrip
+\ifx\generate\undefined
+ \Msg{**********************************************}
+ \Msg{*}
+ \Msg{* This installation requires docstrip}
+ \Msg{* version 2.4 or later.}
+ \Msg{*}
+ \Msg{* An older version of docstrip has been input}
+ \Msg{*}
+ \Msg{**********************************************}
+ \errhelp{Move or rename old docstrip.tex and get a newer one.}
+ \errmessage{Old docstrip in input path}
+ \batchmode
+ \csname @@end\endcsname\end
+\fi
+
+\keepsilent
+\askforoverwritefalse
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\preamble
+\endpreamble
+\generate
+{%
+ \file{ran_toks.sty}{\from{ran_toks.dtx}{copyright,package}}
+ \file{ran-toks.sty}{\from{ran_toks.dtx}{copyright,altpkgname}}
+}
+
+\Msg{***************************************************************}
+\Msg{*}
+\Msg{* \space To finish the installation you have to copy the files }
+\Msg{*}
+\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX}
+\Msg{*}
+\Msg{***************************************************************}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\endinput
diff --git a/macros/latex/contrib/ran_toks/ran_toks.sty b/macros/latex/contrib/ran_toks/ran_toks.sty
deleted file mode 100644
index f5f253e0b1..0000000000
--- a/macros/latex/contrib/ran_toks/ran_toks.sty
+++ /dev/null
@@ -1,302 +0,0 @@
-%%
-%% This is file `ran_toks.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% ran_toks.dtx (with options: `copyright,package')
-%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% Web package, %%
-%% Copyright (C) 1999-2017 D. P. Story %%
-%% dpstory@uakron.edu %%
-%% %%
-%% This program can redistributed and/or modified under %%
-%% the terms of the LaTeX Project Public License %%
-%% Distributed from CTAN archives in directory %%
-%% macros/latex/base/lppl.txt; either version 1 of the %%
-%% License, or (at your option) any later version. %%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\NeedsTeXFormat{LaTeX2e}[1997/12/01]
-\ProvidesPackage{ran_toks}
- [2017/05/04 v1.1 Randomizing tokens (dps)]
-\RequirePackage{verbatim}
-\@ifundefined{nextrandom}{\input{random.tex}}{}
-\def\nextrandom{\begingroup
- \ifnum\randomi<\@ne % then initialize with time
- \global\randomi\time
- \global\multiply\randomi388 \global\advance\randomi\year
- \global\multiply\randomi31 \global\advance\randomi\day
- \global\multiply\randomi97 \global\advance\randomi\month
- \message{Randomizer initialized to \the\randomi.}%
- \nextrandom \nextrandom \nextrandom
- \xdef\InitSeedValue{\the\randomi}%
- \fi
- \count@ii\randomi
- \divide\count@ii 127773 % modulus = multiplier * 127773 + 2836
- \count@\count@ii
- \multiply\count@ii 127773
- \global\advance\randomi-\count@ii % random mod 127773
- \global\multiply\randomi 16807
- \multiply\count@ 2836
- \global\advance\randomi-\count@
- \ifnum\randomi<\z@ \global\advance\randomi 2147483647\relax\fi
- \endgroup
-}
-\newtoks\rt@listIn \rt@listIn={}
-\newtoks\rt@newListIn \rt@newListIn={}
-\newtoks\rt@listOut \rt@listOut={}
-\newcount\rt@nMax
-\newcount\rt@nCnt
-\newcount\rt@getRanNum
-\newif\ifrtdebug \rtdebugfalse
-\newif\ifwerandomize \werandomizetrue
-\newif\ifsaveseed\saveseedtrue
-\newwrite\rt@Verb@write
-\def\rt@nameedef#1{\expandafter\edef\csname #1\endcsname}
-\def\ranToksOn{\werandomizetrue}
-\def\ranToksOff{\werandomizefalse}
-\def\useThisSeed#1{\saveseedfalse\randomi=#1}
-\@onlypreamble\useThisSeed
-\def\useLastAsSeed{\rt@useLastAsSeed}
-\@onlypreamble\useLastAsSeed
-\def\rt@useLastAsSeed{%
- \IfFileExists{\jobname_rt.sav}{%
- \PackageInfo{ran_toks}{Inputting \jobname_rt.sav}%
- \@ifundefined{readsavfile}{\newread\readsavfile}{}%
- \openin\readsavfile=\jobname_rt.sav
- \read\readsavfile to \InitSeedValue
- \read\readsavfile to \lastRandomNum
- \closein\readsavfile
- \randomi=\lastRandomNum
- \xdef\InitSeedValue{\the\randomi}
- }{%
- \PackageInfo{ran_toks}{\jobname_rt.sav cannot
- be found, \MessageBreak
- using the random initializer}%
- }%
-}
-\@ifundefined{aeb@randomizeChoices}{%
- \let\inputRandomSeed\useLastAsSeed
- \let\useRandomSeed\useThisSeed}{}
-\def\verbatimwrite{\@bsphack
- \let\do\@makeother\dospecials
- \catcode`\^^M\active \catcode`\^^I=12
- \def\verbatim@processline{%
- \immediate\write\verbatim@out
- {\the\verbatim@line}}%
- \verbatim@start}
-\def\endverbatimwrite{\@esphack}
-\def\rt@IWVO{\immediate\write\verbatim@out}
-\def\InitSeedValue{\the\randomi}
-\def\rt@writeSeedData{\ifsaveseed
- \@ifundefined{saveseedinfo}{\newwrite\saveseedinfo}{}
- \immediate\openout \saveseedinfo \jobname_rt.sav
- \let\verbatim@out\saveseedinfo
- \def\rt@msgi{initializing seed value}%
- \def\rt@msgii{last random number used}%
- \uccode`c=`\%\uppercase{%
- \rt@IWVO{\InitSeedValue\space c \rt@msgi}%
- \rt@IWVO{\the\randomi\space c \rt@msgii}}\immediate
- \closeout\saveseedinfo\fi}
-\AtEndDocument{\rt@writeSeedData}%
-\def\rt@populateList#1{\rt@listIn={}\rt@nCnt\z@
- \@whilenum\rt@nCnt<#1\do{\advance\rt@nCnt\@ne
- \edef\rt@listInHold{\the\rt@listIn\noexpand\\{\the\rt@nCnt}}%
- \rt@listIn=\expandafter{\rt@listInHold}}}
-\def\rt@RandomizeList#1{\global
- \rt@listIn={}\global\rt@newListIn={}\global\rt@listOut={}%
- \rt@nMax=#1\relax\rt@populateList{\the\rt@nMax}%
- \ifwerandomize
- \expandafter\rt@randomizeList\else
- \global\rt@listOut=\expandafter{\the\rt@listIn}\fi
- \global\rt@nameedef{\rt@BaseName-List}{\the\rt@listOut}}
-\def\rt@randomizeList{\let\\=\rt@processi
- \setrannum{\rt@getRanNum}{1}{\the\rt@nMax}%
-\ifrtdebug\typeout{\string\rt@getRanNum=\the\rt@getRanNum}\fi
- \rt@nCnt\z@
-\ifrtdebug\typeout{LISTING: \the\rt@listIn}\fi
- \the\rt@listIn
- \rt@loopTest
-}
-\def\rt@loopTest{\advance\rt@nMax\m@ne
- \ifnum\rt@nMax>\z@
- \def\rt@next{%
- \rt@listIn=\expandafter{\the\rt@newListIn}%
- \rt@newListIn={}\rt@randomizeList}%
- \else
- \let\rt@next\relax
- \global\rt@listOut=\expandafter{\the\rt@listOut}%
-\ifrtdebug\typeout{Final Result: \string\rt@listOut=\the\rt@listOut}\fi
- \fi
- \rt@next
-}
-\def\rt@processi#1{\advance\rt@nCnt\@ne
- \ifnum\rt@nCnt=\rt@getRanNum
- \edef\rt@listOutHold{\the\rt@listOut}%
- \global\rt@listOut=\expandafter{\rt@listOutHold\\{#1}}%
-\ifrtdebug\typeout{Found it: \string\\{#1}}%
-\typeout{New \string\rt@listOut: \the\rt@listOut}\fi
- \else
- \edef\rt@listInHold{\the\rt@newListIn}%
- \rt@newListIn=\expandafter{\rt@listInHold\\{#1}}%
-\ifrtdebug\typeout{\string\rt@newListIn: \the\rt@newListIn}\fi
- \fi
-}
-\def\rt@modarith#1#2{\count\z@=#1\relax\count\tw@=#1\relax
- \advance\count\z@\m@ne\divide\count\z@ #2\relax
- \multiply\count\z@ #2\relax
- \advance\count\tw@-\count\z@
- \edef\rt@mod{\the\count\tw@}}
-\def\rt@badIndex#1#2{\PackageWarningNoLine{ran_toks}
- {The argument of \string\useRanTok{#1} on line
- \the\inputlineno\space is\MessageBreak
- greater than \string\nToksFor{#2} (\nToksFor{#2}),
- instead will use\MessageBreak
- \string\useRanTok{\rt@mod}, obtained from modular
- arithmetic.\MessageBreak
- You might want to fix this}
-}
-\def\rt@badTokName#1{%
- \PackageWarningNoLine{ran_toks}
- {The token list `#1' on line \the\inputlineno\space
- is undefined,\MessageBreak
- possibly simply mispelled; check spelling.\MessageBreak
- If undefined, use \string\ranToks\space or \string\bRTVToks/%
- \string\eRTVToks\space\MessageBreak
- to define a list with the name `#1'}%
-}
-\def\rt@warnTokName#1{%
- \PackageWarningNoLine{ran_toks}
- {The token list `#1' on line \the\inputlineno\space
- is already defined,\MessageBreak
- will overwrite this list}%
-}
-\def\ranToks#1{\begingroup
- \useRTName{#1}%
- \r@nToks
-}
-\long\def\r@nToks#1{\rt@nMax\z@\r@ndToks#1\rt@NIL}
-\def\rt@NIL{@nil}
-\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\r@nVToks\expandafter{\rt@BaseName}}
-\def\reVerbEnd{\ifhmode\unskip\fi}
-\newenvironment{rtVW}{\global\advance\rt@nCnt\@ne
- \immediate\openout\rt@Verb@write
- \jobname_\rt@BaseName\the\rt@nCnt.cut
- \let\verbatim@out\rt@Verb@write
- \verbatimwrite
-}{%
- \endverbatimwrite
- \immediate\write\rt@Verb@write{\string\reVerbEnd}%
- \immediate\closeout\rt@Verb@write
-}
-\def\r@nVToks#1{\begingroup
- \gdef\rt@BaseName{#1}%
- \expandafter\rt@nMax\@nameuse{#1Cnt}%
- \rt@listIn={}\rt@nCnt=0\relax\let\rt@listInHold\@empty
- \@whilenum\rt@nCnt<\rt@nMax\do{\advance\rt@nCnt\@ne
- \edef\rt@listInHold{%
- \the\rt@listIn{\noexpand\rt@inputVerb{#1\the\rt@nCnt}}}%
- \rt@listIn=\expandafter{\rt@listInHold}}\ifrtdebug
- \typeout{\string\r@nVToks: \the\rt@listIn}\fi
- \expandafter\r@nToks\expandafter{\the\rt@listIn}}
-\def\rt@inputVerb#1{\input{\jobname_#1.cut}}
-\def\rt@PAR{\par}
-\long\def\r@ndToks#1{\def\rt@rgi{#1}%
- \ifx\rt@rgi\rt@PAR\def\rt@next{\r@ndToks}\else
- \advance\rt@nMax\@ne
- \global\@namedef{rtTok\the\rt@nMax\rt@BaseName}{#1}%
- \def\rt@next{\@ifnextchar\rt@NIL
- {\rt@endToks\@gobble}{\r@ndToks}}\fi\rt@next}
-\def\rt@performRanDefns#1{%
- \rt@RandomizeList{#1}\rt@nCnt\z@
- \let\\\rt@ssign\the\rt@listOut}
-\def\rt@endToks{\global
- \rt@nameedef{nMax4\rt@BaseName}{\the\rt@nMax}%
- \rt@performRanDefns{\the\rt@nMax}\endgroup}
-\def\reorderRanToks#1{\begingroup\useRTName{#1}\expandafter
- \ifx\csname nMax4#1\endcsname\relax
- \rt@badTokName{#1}\else
- \rt@performRanDefns{\@nameuse{nMax4#1}}\fi
-\endgroup}
-\newcommand\copyRanToks[2]{\begingroup\expandafter
- \ifx\csname nMax4#1\endcsname\relax
- \rt@badTokName{#1}%
- \else\expandafter
- \ifx\csname nMax4#2\endcsname\relax
- \useRTName{#2}\global
- \rt@nameedef{nMax4#2}{\@nameuse{nMax4#1}}%
- \rt@nCnt=\csname nMax4#2\endcsname\relax
- \@whilenum\rt@nCnt>\z@\do{\global
- \rt@nameedef{rtTok\the\rt@nCnt#2}%
- {\noexpand\@nameuse{rtTok\the\rt@nCnt#1}}%
- \advance\rt@nCnt\m@ne}%
- \rt@performRanDefns{\@nameuse{nMax4#2}}\else
- \rt@warnTokName{#2}\fi
- \fi
-\endgroup}
-\def\rt@ssign#1{\advance\rt@nCnt\@ne\global
- \rt@nameedef{rtRanTok\the\rt@nCnt\rt@BaseName}{\noexpand
- \@nameuse{rtTok#1\rt@BaseName}}}
-\newcommand{\nToksFor}[1]{\expandafter
- \ifx\csname nMax4#1\endcsname\relax
- \textbf{??}\rt@badTokName{#1}\else
- \@nameuse{nMax4#1}\fi}
-\newcommand{\rtTokByNum}[2][\rt@BaseName]{\expandafter
- \ifx\csname nMax4#1\endcsname\relax
- \textbf{??}\rt@badTokName{#1}\else
- \@nameuse{rtTok#2#1}\expandafter\ignorespaces\fi}
-\newcommand{\useRanTok}[2][\rt@BaseName]{\bgroup
- \expandafter\ifx\csname nMax4#1\endcsname\relax
- \rt@badTokName{#1}\else
- \ifnum#2>\nToksFor{#1}\rt@modarith{#2}{\nToksFor{#1}}%
- \rt@badIndex{#2}{#1}\@nameuse{rtRanTok\rt@mod#1}\else
- \@nameuse{rtRanTok#2#1}\fi\fi\egroup}
-\newcommand{\displayListRandomly}[1][]{\bgroup\def\rt@prior{#1}%
- \displ@yListRandomly}
-\newcommand{\displ@yListRandomly}[2][]{\rt@nCnt\z@
- \expandafter\ifx\csname nMax4#2\endcsname\relax
- \rt@rgi\space\textbf{??}\rt@badTokName{#2}#1%
- \else
- \def\rt@post{#1}\useRTName{#2}\let\i\rt@nCnt
- \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}%
- \fi\egroup
-}
-\def\rt@gettonil#1\@nil{\def\to@nilarg{#1}}
-\def\rt@ifspc{\ifx\@let@token\@sptoken
- \let\rt@next\rt@xifspc\else
- \let\rt@next\rt@gettonil\fi\rt@next}
-\begingroup
-\def\:{\rt@xifspc}
-\expandafter\gdef\: {\futurelet\@let@token\rt@ifspc}
-\endgroup
-\def\rt@strpspcs{\futurelet\@let@token\rt@ifspc}
-\def\ProbDBWarningMsg#1{\filename@parse{#1}
- \PackageWarning{ran_toks}
- {The file \filename@area\filename@base.\ifx\filename@ext\relax
- tex\else\filename@ext\fi\space cannot be found}}
-\def\useTheseDBs#1{\def\rt@dblist{#1}\ifx\rt@dblist\@empty\else
- \let\rt@DB@List\@empty
- \edef\temp@expand{\noexpand\@for\noexpand\@@tmp:=\rt@dblist}%
- \temp@expand\do{\ifx\@@tmp\@empty\else
- \expandafter\rt@strpspcs\@@tmp\@nil\edef\@@tmp{\to@nilarg}%
- \edef\rt@nextDB{\noexpand
- \InputIfFileExists{\@@tmp}{}{\noexpand
- \ProbDBWarningMsg{\@@tmp}}}%
- \toks\tw@=\expandafter{\rt@DB@List}%
- \toks@=\expandafter{\rt@nextDB}%
- \edef\rt@DB@List{\the\toks\tw@\space\the\toks@}\fi
- }\expandafter\rt@DB@List\fi}
-\let\useProbDBs\useTheseDBs
-\endinput
-%%
-%% End of file `ran_toks.sty'.