summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ran_toks
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-01-25 22:07:26 +0000
committerKarl Berry <karl@freefriends.org>2021-01-25 22:07:26 +0000
commit6d43e49e73d6a7bead2c0f4eabe85242cf7b200b (patch)
tree859451473f27cd242ebf73a5a56e8e566a515482 /Master/texmf-dist/tex/latex/ran_toks
parent5ad1fa692489b668a06f329a4d8a5c0cec34e096 (diff)
ran_toks (25jan21)
git-svn-id: svn://tug.org/texlive/trunk@57520 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ran_toks')
-rw-r--r--Master/texmf-dist/tex/latex/ran_toks/ran-toks.sty2
-rw-r--r--Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty150
-rw-r--r--Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def148
3 files changed, 239 insertions, 61 deletions
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 3d408de6222..73bc9bc9c2a 100644
--- a/Master/texmf-dist/tex/latex/ran_toks/ran-toks.sty
+++ b/Master/texmf-dist/tex/latex/ran_toks/ran-toks.sty
@@ -8,7 +8,7 @@
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ran_toks package, %%
-%% Copyright (C) 1999-2019 D. P. Story %%
+%% Copyright (C) 1999-2021 D. P. Story %%
%% dpstory@uakron.edu, dpstory@acrotex.net %%
%% %%
%% This program can redistributed and/or modified under %%
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 aeb4e2772b5..ae2ae64747b 100644
--- a/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty
+++ b/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty
@@ -8,7 +8,7 @@
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ran_toks package, %%
-%% Copyright (C) 1999-2019 D. P. Story %%
+%% Copyright (C) 1999-2021 D. P. Story %%
%% dpstory@uakron.edu, dpstory@acrotex.net %%
%% %%
%% This program can redistributed and/or modified under %%
@@ -19,7 +19,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1997/12/01]
\ProvidesPackage{ran_toks}
- [2019/12/28 v1.2 Randomizing tokens (dps)]
+ [2021/01/19 v1.3.1 Randomizing tokens (dps)]
\RequirePackage{verbatim}
\@ifundefined{nextrandom}{\input{random.tex}}{}
\def\nextrandom{\begingroup
@@ -52,8 +52,18 @@
\newif\ifrtdebug \rtdebugfalse
\newif\ifwerandomize \werandomizetrue
\newif\ifsaveseed\saveseedtrue
+\newif\ifrt@InputUsedIDs\rt@InputUsedIDsfalse
\newwrite\rt@Verb@write
+\def\rtcsarg#1#2{\expandafter#1\csname#2\endcsname}
\def\rt@nameedef#1{\expandafter\edef\csname #1\endcsname}
+\DeclareOption{usedbapp}{\let\rtPkgInpt\rt@PkgInpt}
+\def\rt@PkgInpt{\InputIfFileExists{rt-dbapp.def}
+ {\PackageInfo{ran_toks}{Inputting rt-dbapp.def}}
+ {\PackageInfo{ran_toks}{Cannot find rt-dbapp.def}}
+}
+\let\rtPkgInpt\relax
+\AtEndOfPackage{\rtPkgInpt}
+\ProcessOptions\relax
\def\ranToksOn{\werandomizetrue}
\def\ranToksOff{\werandomizefalse}
\def\useThisSeed#1{\saveseedfalse\randomi=#1}
@@ -155,7 +165,7 @@
instead will use\MessageBreak
\string\useRanTok{\rt@mod}, obtained from modular
arithmetic.\MessageBreak
- You might want to fix this}
+ You might want to fix this}%
}
\def\rt@badTokName#1{%
\PackageWarningNoLine{ran_toks}
@@ -182,17 +192,27 @@
\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}}
+ \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
\let\RTVWHook\relax\else\def\RTVWHook{#1}\fi}
\rtVWHook{}
+\newwrite\wrtprobids
+\newif\ifviewIDs\viewIDsfalse
+\newif\ifxDBUnique\xDBUniquefalse
+\def\wrtProbIds#1{\immediate\write\wrtprobids{\string
+ \rtcsarg\string\gdef{#1}{used}}}
+\def\rtVWId#1{\ifviewIDs\noindent#1\fi
+ \ifxDBUnique\ifrt@InputUsedIDs\wrtProbIds{#1}\fi\fi
+}
\newenvironment{rtVW}{\global\advance\rt@nCnt\@ne
\immediate\openout\rt@Verb@write
- \jobname_\rt@BaseName\the\rt@nCnt.cut
+ \jobname_\rt@BaseName-\the\rt@nCnt.cut
\let\verbatim@out\rt@Verb@write
\rt@IWVO{\string\RTVWHook}%
+ \rt@IWVO{\string
+ \rtVWId{\rt@BaseName-\the\rt@nCnt}\string\relax}%
\verbatimwrite
}{%
\endverbatimwrite
@@ -205,11 +225,12 @@
\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}}}%
+ \the\rt@listIn{\noexpand\rt@inputVerb{#1-\the\rt@nCnt}}}% J14
\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@inputVerb#1{\rt@recordAsUsed{#1}\input{\jobname_#1.cut}}
+\def\rt@recordAsUsed#1{\rtcsarg\gdef{#1}{used}}
\def\rt@PAR{\par}
\long\def\r@ndToks#1{\def\rt@rgi{#1}%
\ifx\rt@rgi\rt@PAR\def\rt@next{\r@ndToks}\else
@@ -228,10 +249,12 @@
\rt@badTokName{#1}\else
\rt@performRanDefns{\@nameuse{nMax4#1}}\fi
\endgroup}
-\newcommand\copyRanToks[2]{\begingroup\expandafter
+\newcommand\copyRanToks[2]{\begingroup
+ \expandafter
\ifx\csname nMax4#1\endcsname\relax
- \rt@badTokName{#1}%
- \else\expandafter
+ \rt@badTokName{#1}%
+ \else
+ \expandafter
\ifx\csname nMax4#2\endcsname\relax
\useRTName{#2}\global
\rt@nameedef{nMax4#2}{\@nameuse{nMax4#1}}%
@@ -239,68 +262,75 @@
\@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
+ \advance\rt@nCnt\m@ne
+ }\rt@performRanDefns{\@nameuse{nMax4#2}}%
+ \else
+ \rt@warnTokName{#2}%
+ \fi
\fi
-\endgroup}
+ \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}
+ \@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
+ \@nameuse{rtTok#2#1}\expandafter\ignorespaces
+ \fi
+}
+\newcommand{\uniqueXDBChoicesOn}{\xDBUniquefalse
+ \PackageWarning{ran_toks}
+ {The \string\uniqueXDBChoicesOn\space requires the\MessageBreak
+ \texttt{usedbapp} option}}
+\newcommand{\uniqueXDBChoicesOff}{\let\xdbunique\relax\xDBUniquefalse}
+\let\xdbunique\relax
+\newcommand{\makeInfoAWarning}{\def\pkgNotifType{\PackageWarning}}
+\def\pkgNotifType{\PackageInfo}
+\newif\ifrt@recording \rt@recordingtrue % dps
+\newcommand{\useRanTok}[2][\rt@BaseName]{\bgroup\expandafter
+ \ifx\csname nMax4#1\endcsname\relax
+ \rt@badTokName{#1}\global\let\rt@next\relax
+ \else
+ \ifnum#2>\@nameuse{nMax4#1}%
+ \rt@modarith{#2}{\@nameuse{nMax4#1}}%
+ \rt@badIndex{#2}{#1}\edef\Indx{\rt@mod}%
+ \else
+ \edef\Indx{#2}%
+ \fi
+ \xdef\rt@orig@Indx{\Indx}%
+ \ifx\xdbunique\relax
+ \ifrt@recording\rt@recordAsUsed{#1-\Indx}\fi
+ \xdef\rt@next{\noexpand\@nameuse{rtRanTok\Indx#1}}%
+ \else
+ \xdb@unique{#1}%
+ \fi
+ \fi
+ \egroup
+ \rt@next
+}
+\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
+ \rt@recordingfalse
\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
+ \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
+}
\endinput
%%
%% End of file `ran_toks.sty'.
diff --git a/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def b/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def
new file mode 100644
index 00000000000..ecbd1e6aaf4
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ran_toks/rt-dbapp.def
@@ -0,0 +1,148 @@
+%%
+%% This is file `rt-dbapp.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% ran_toks.dtx (with options: `copyright,dbapp')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% ran_toks package, %%
+%% Copyright (C) 1999-2021 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 %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\rt@OpenProbIds{\@ifpackageloaded{eqexam}
+ {\immediate\openout\wrtprobids\jobname-ver\selVersion.cut}{}}
+\def\rt@ABD{\@ifundefined{eq@nVersions}{}
+ {\ifnum\eq@nVersions>\@ne\expandafter\rt@OpenProbIds\fi}}
+\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
+\def\viewDB#1{\useRTName{#1}\rt@nCnt\z@
+ \edef\nSTOP{\@nameuse{nMax4\rt@BaseName}}%
+ \loop\advance\rt@nCnt\@ne
+ \rtTokByNum{\the\rt@nCnt}%
+ \ifnum\rt@nCnt<\nSTOP\repeat
+}
+%% uses \@tempcnta and \Indx
+\def\getR@nIndx#1{\def\argi{#1}%
+ \ifx\argi\rt@STOP
+ % no match, something is wrong
+ \edef\ranIndex{-1}\else
+ \advance\@tempcnta\@ne
+ \ifnum\Indx=\@tempcnta
+ \def\ranIndx{#1}\fi
+ \fi
+}
+\def\rt@NoAltChoice#1#2{\PackageWarning{ran_toks}
+ {Cannot find an alternative to #1-#2,\MessageBreak
+ will use it but it may be a duplicate\MessageBreak
+ question}}
+\def\xdb@unique#1{\@tempcnta\z@
+ \def\rt@STOP{\relax}%
+ \let\\\relax\edef\x{\@nameuse{#1-List}}%
+ \toks@=\expandafter{\x}\let\\\getR@nIndx
+ \the\toks@\\\rt@STOP
+ \xdef\rt@next{\noexpand
+ \@nameuse{rtRanTok\rt@orig@Indx#1}}%
+ \ifnum\ranIndx>\m@ne
+ \edef\rt@orig@ranIndx{\ranIndx}%
+ \expandafter
+ \ifx\csname#1-\ranIndx\endcsname\relax
+ \xdef\rt@next{\noexpand
+ \@nameuse{rtRanTok\Indx#1}}%
+ \else
+ \@tempcntb\z@
+ \rt@nCnt\rt@orig@Indx\relax
+ \xdef\rt@next{\noexpand\rt@NoAltChoice{#1}{\rt@orig@Indx}\noexpand
+ \@nameuse{rtRanTok\rt@orig@Indx#1}}%
+ \@whilenum\@tempcntb<\@nameuse{nMax4#1}\do{%
+ \advance\@tempcntb\@ne
+ \advance\rt@nCnt\@ne
+ \ifnum\rt@nCnt>\@nameuse{nMax4#1}\rt@nCnt\@ne\fi
+ \edef\Indx{\the\rt@nCnt}\@tempcnta\z@
+ \the\toks@\\\rt@STOP
+ \ifnum\ranIndx>\m@ne
+ \expandafter
+ \ifx\csname#1-\ranIndx\endcsname\relax
+ \pkgNotifType{ran_toks}{#1-\rt@orig@ranIndx\space
+ has already been used,\MessageBreak
+ will use #1-\ranIndx}%
+ % exit the \@whilenum loop
+ \@tempcntb\@nameuse{nMax4#1}%
+ \advance\@tempcntb\@ne
+ \fi
+ \fi
+ \xdef\rt@next{\noexpand\@nameuse{rtRanTok\Indx#1}}%
+ }% do
+ \ifnum\@tempcntb=\@nameuse{nMax4#1}\relax
+ \xdef\rt@next{\noexpand
+ \rt@NoAltChoice{#1}{\rt@orig@ranIndx}\noexpand
+ \@nameuse{rtRanTok\rt@orig@Indx#1}}%
+ \fi
+ \fi
+ \fi
+}
+\renewcommand{\uniqueXDBChoicesOn}{\xDBUniquetrue
+ \let\xdbunique\xdb@unique}
+\newif\ifrt@InputUsedIDs\rt@InputUsedIDsfalse
+\def\InputUsedIDs{\rt@InputUsedIDstrue
+ \bgroup
+ \setcounter{eq@count}{0}%
+ \let\rt@InputUsedIDs\@empty
+ \let\rt@InputUsedIDsFIs\@empty
+ \@whilenum \value{eq@count}<\eq@nVersions\relax\do
+ {%
+ \stepcounter{eq@count}%
+ \g@addto@macro\rt@InputUsedIDs{\if\selVersion}%
+ \g@addto@macro\rt@InputUsedIDsFIs{\fi}%
+ \edef\x{\Alph{eq@count}}%
+ \edef\y{\noexpand\g@addto@macro\noexpand
+ \rt@InputUsedIDs{\x\expandafter\noexpand
+ \csname else\endcsname\noexpand\rt@IIFE}}\y
+ \edef\x{{\x}}\expandafter
+ \g@addto@macro\expandafter\rt@InputUsedIDs\expandafter{\x}%
+ }% do
+ \expandafter\g@addto@macro\expandafter
+ \rt@InputUsedIDs\expandafter{\rt@InputUsedIDsFIs}%
+ \egroup
+ \rt@InputUsedIDs
+ \AtBeginDocument{\rt@ABD}%
+}
+\@onlypreamble\InputUsedIDs
+\def\rt@IIFE#1{\InputIfFileExists{\jobname-ver#1.cut}
+ {\PackageInfo{ran_toks}{Inputting \jobname-ver#1.cut}}
+ {\PackageInfo{ran_toks}{Cannot find \jobname-ver#1.cut}}}
+\endinput
+%%
+%% End of file `rt-dbapp.def'.