diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.pdf | bin | 0 -> 74942 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.tex | 437 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex | 77 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx | 452 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty | 220 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/ran_toks.tlpsrc | 0 |
9 files changed, 1190 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.pdf b/Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.pdf Binary files differnew file mode 100644 index 00000000000..f325fc70c37 --- /dev/null +++ b/Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.pdf diff --git a/Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.tex b/Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.tex new file mode 100644 index 00000000000..ffe4d67bd64 --- /dev/null +++ b/Master/texmf-dist/doc/latex/ran_toks/doc/rantoks_man.tex @@ -0,0 +1,437 @@ +\documentclass{article} +\usepackage[fleqn]{amsmath} +\usepackage[ + web={centertitlepage,designv,forcolorpaper, + usesf,latextoc,pro}, %tight, + eforms,aebxmp +]{aeb_pro} +\usepackage{ran_toks} +\useThisSeed{1441984427} +%\useLastAsSeed +%\rtdebugtrue +%\ranToksOn +%\ranToksOff + + +%\usepackage{myriadpro} +\usepackage[altbullet]{lucidbry} + +%\usepackage{makeidx} +%\makeindex +\usepackage{acroman} + +\makeatletter +\def\eq@fititin#1{\noindent\unskip\nobreak\hfill\penalty50 + \hskip2em\hbox{}\nobreak\hfill#1} +\def\fitit{\eq@fititin{\exrtnlabelformat}} +\@mparswitchfalse\reversemarginpar +%\def\meta#1{$\langle\textit{\texttt{#1}}\rangle$} +\def\meta#1{\textit{\texttt{#1}}} + +\makeatother +%\usepackage[active]{srcltx} + +\urlstyle{rm} + +\DeclareDocInfo +{ + university={\AcroTeX.Net}, + title={\texorpdfstring{The \textsf{ran\_toks}}{The manual for the ran\_toks} + Package\texorpdfstring{\\[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.0}, + Keywords={LaTeX,PDF,random, tokens, JavaScript,Adobe Acrobat}, + copyrightStatus=True, + copyrightNotice={Copyright (C) \the\year, D. P. Story}, + copyrightInfoURL={http://www.acrotex.net} +} +\DeclareInitView{windowoptions={showtitle}} + + +\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\universityLayout{fontsize=Large} +\titleLayout{fontsize=LARGE} +\authorLayout{fontsize=Large} +\tocLayout{fontsize=Large,color=aeb} +\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb} +\subsectionLayout{indent=-31.25pt,color=aeb} +\subsubsectionLayout{indent=0pt,color=aeb} +\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textrm\textbullet}} + +\def\exSrc{\makebox[0pt][r]{\large{\Pisymbol{webd}{157}}\enspace}} + +%\pagestyle{empty} +\parindent0pt +\parskip\medskipamount + + +\definePath\bgPath{"C:/Users/Public/Documents/% + ManualBGs/Manual_BG_Print_AeB.pdf"} +\begin{docassembly} +\addWatermarkFromFile({% + bOnTop: false, + cDIPath: \bgPath +}) +\executeSave() +\end{docassembly} + +\begin{document} + +\maketitle + +\selectColors{linkColor=black} +\tableofcontents +\selectColors{linkColor=webgreen} + +\section{Introduction} + +This is a short package for randomizing the order of tokens. The package +is long overdue; users of \textbf{AeB} and of \textsf{eqexam} have long asked for a way to +randomize the order of the problems in a test or quiz, or anything for +that matter. + +\exSrc The example file for this package is \texttt{ran\_toks.tex} found in the +\texttt{examples} folder. The file reproduces the sample code of this +manual. + +\section{The Preamble and Package Options} + +The preamble for this package is +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(\usepackage{ran_toks}) +\end{Verbatim} +The package itself has no options. + +The requirements for \textsf{ran\_toks} are the \textsf{verbatim} package +(part of the standard {\LaTeX} distribution, and the macro file +\texttt{random.tex}, by Donald Arseneau + + +\section{The main commands and environments}\label{rtmain} + +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} +command}{\CMD{ranToks}} command} + +The \cs{ranToks} command was the original concept; declare a series of +tokens to be randomized. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(!parbox(1.5in)(\ranToks{!meta(name)}{% + {!meta(token_1)} + {!meta(token_2)} + ... + {!meta(token_n)} +})) +\end{Verbatim} +were \meta{token\_k} is any non-verbatim content;\footnote{Any token that +can be in the argument of a command.} each token is enclosed in braces +(\verb!{}!), this is required. The \meta{name} parameter is required, and +must be unique for the document; it is used to build the names of internal +macros. Of course several such \cs{ranToks} can be used in the document, +either in the preamble or in the body of the document. Multiple +\cs{ranToks} commands must have a different \meta{name} parameter. + +\emph{After} a \cs{ranToks} command has been executed, the number of tokens +counted is accessible through the \cs{nToksFor} command, +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(\nToksFor{!meta(name)}) +\end{Verbatim} +The one argument is \meta{name}, and will expand to the total number +of tokens listing as argument in the \cs{ranToks} command by the same +name. + +The \cs{ranToks} command does not display the randomized tokens, for that +the command \cs{useRanTok} is used. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(!parbox(1.3in)(\useRTName{!meta(name)} +\useRanTok{1} +\useRanTok{2} +... +\useRanTok{n})) +\end{Verbatim} +The argument of \cs{useRanTok} is a positive integer between 1 and +\verb!\nToksFor{!\meta{name}\verb!}!, the number of tokens declared by \cs{ranToks}, inclusive. +There is no space created following the \cs{useRanTok} command, so if +these are to be used ``inline'', enclose them in braces (\verb~{}~), eg, +\verb!{\useRanTok{1}}!. The use of \cs{useRTName} is optional unless the +listing of the \cs{useRanTok} commands is separated from the \cs{ranToks} +command that defined them by another \cs{ranToks} command of a different +name. That should be clear! + +Consider this example. + +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\ranToks{myPals}{% + {Jim}{Richard}{Don} + {Alex}{Tom}{J\"{u}rgen} +} +\end{Verbatim} +\ranToks{myPals}{% + {Jim}{Richard}{Don} + {Alex}{Tom}{J\"{u}rgen} +} +I have {\nToksFor{myPals}} pals, they are \useRanTok{1}, \useRanTok{2}, +\useRanTok{3}, \useRanTok{4}, {\useRanTok{5}} and \useRanTok{6}. (Listed +in the order of best friend to least best friend.) +The verbatim listing is, +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +I have {\nToksFor{myPals}} pals, they are \useRanTok{1}, +\useRanTok{2}, \useRanTok{3}, \useRanTok{4}, {\useRanTok{5}} +and \useRanTok{6}. +\end{Verbatim} +Notice that \cs{useRanToks} are not enclosed in braces for 1--4 because +they are each followed by a comma; the fifth token, \verb!{useRanTok{5}}!, is +enclosed in braces to generate a space following the insertion of the text. + +Repeating the sentence yields, ``I have {\nToksFor{myPals}} pals, they are +\useRanTok{1}, \useRanTok{2}, \useRanTok{3}, \useRanTok{4}, +{\useRanTok{5}} and \useRanTok{6}'' the exact same random order. To obtain +a different order, re-execute the \cs{ranToks} command with the same +arguments. Doing just that, \ranToks{myPals}{{Jim}{Richard}{Don} +{Alex}{Tom}{J\"{u}rgen}}we obtain, ``I have {\nToksFor{myPals}} pals, they +are \useRanTok{1}, \useRanTok{2}, \useRanTok{3}, \useRanTok{4}, +{\useRanTok{5}} and \useRanTok{6}.'' A new order? For most applications, +re-randomizing the same token list in the same document is not very likely +something you need to do. + +My original application for this, the one that motivated writing this +package at long last, was the need to arrange several form buttons +randomly on the page. My point is that the listing given in the argument +of \cs{ranToks} can pretty much be anything that is allowed to be an +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}} + {\CMD{bRTVToks}/\CMD{eRTVToks}} pair of commands} + +Sometimes the content to be randomized is quite large and contain verbatim +text. For this, it may be more convenient to use the +\cs{bRTVToks}/\cs{eRTVToks} command pair. The syntax is +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(!parbox(1.6in)(\bRTVToks{!meta(name)} +\begin{rtVW} + !meta(content) +\end{rtVW} +... +... +\begin{rtVW} + !meta(content) +\end{rtVW} +\eRTVToks)) +\end{Verbatim} +The \cs{bRTVToks}\texttt{\{\meta{name}\}} command begins the (pseudo) +environment and is ended by \cs{eRTVToks}. Between these two are a series +of \texttt{rtVW} (random toks verbatim write) environments. When the document +is compiled, the contents of each of these environments is written to the +disk 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 use of \cs{useRTName} and \cs{useRanTok} were explained and illustrated +in the previous section. Let's go to the examples, + +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\bRTVToks{myThoughts} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +Roses are red and violets are blue, +I've forgotten the rest, have you too? +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I gave up saying bad things like +\verb!$#%%%^*%^&#$@#! when I was just a teenager +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I am a good guy, pass it on! The code for this last sentence is, +\begin{verbatim} +%#$% I am a good guy, pass it on! ^&*&^* +\end{verbatim} +How did that other stuff get in there? +\end{minipage} +\end{rtVW} +\eRTVToks +\end{Verbatim} +OK, now, let's display these three in random order. Here we place them in +an \texttt{enumerate} environment. + +\bRTVToks{myThoughts}% +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +Roses are red and violets are blue, +I've forgotten the rest, have you too? +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I gave up saying bad things like +\verb!$#%%%^*%^&#$@#! when I was just a teenager +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I am a good guy, pass it on! The code for this last sentence is, +\begin{verbatim} +%#$% I am a good guy, pass it on! ^&*&^* +\end{verbatim} +How did that other stuff get in there? +\end{minipage} +\end{rtVW} +\eRTVToks +\begin{enumerate} + \item \useRanTok{1} + \item \useRanTok{2} + \item \useRanTok{3} +\end{enumerate} +The verbatim listing of the example above is +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\begin{enumerate} + \item \useRanTok{1} + \item \useRanTok{2} + \item \useRanTok{3} +\end{enumerate} +\end{Verbatim} + +\section{Additional arguments and commands}\label{AddCmds} + +The syntax given earlier for \cs{useRanTok} was not completely specified. +It is +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(\useRanTok[!meta(name)]{!meta(number)}) +\end{Verbatim} +The optional first parameter specifies the \meta{name} of the list from +which to draw a random token; the \meta{number} is the number of the +token in the range of 1 and \verb!\nToksFor{!\meta{name}\verb!}!, +inclusive. The optional argument is useful in special circumstances when +you want to mix two random lists together. + +To illustrate: \useRanTok[myPals]{1}, \useRanTok[myThoughts]{1} + +The verbatim listing is +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +To illustrate: \useRanTok[myPals]{1}, \useRanTok[myThoughts]{1} +\end{Verbatim} +This is a rather bad illustration. Every time this document is compiled +there is a different page break on page~\pageref*{AddCmds}. This must be used +wisely. + +The original order of the list of tokens is not lost, you can retrieve +them using the command \cs{rtTokByNum}, +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(\rtTokByNum[!meta(name)]{!meta(number)}) +\end{Verbatim} +This command expands to the token declared in the list named \meta{name} +that appears at the \meta{number} place in the list. (Rather awkwardly written.) +For example, my really best pals are {\rtTokByNum[myPals]{3}} and +\rtTokByNum[myPals]{4}, but don't tell them. The listing is, +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +For example, my really best pals are {\rtTokByNum[myPals]{3}} +and \rtTokByNum[myPals]{4}, but don't tell them. +\end{Verbatim} +In some sense, \cs{rtTokByNum[\meta{name}]} acts like a simple array, the +length of which is \cs{nToksFor\{\meta{name}\}}, and whose $k^{\text{th}}$ +element is \cs{rtTokByNum[\meta{name}]\{\meta{k}\}}. + +The randomization may be turned off using \cs{ranToksOff} or turned back +on with \cs{ranToksOn}. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(!parbox(.9in)(\ranToksOff +\ranToksOn)) +\end{Verbatim} +This can be done globally in the preamble for the whole of the document, +or in the body of the document just prior to either \cs{ranToks} or +\cs{bRTVToks}. For example, +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\ranToksOff +\ranToks{integers}{ {1}{2}{3}{4} } +\ranToksOff +\end{Verbatim} +This should make $\verb!\useRanTok{3}! = \verb!\rtTokByNum{3}! = 3 $; +executing this code, we get, \ranToksOff\ranToks{integers}{ {1}{2}{3}{4} }\ranToksOff +$\useRanTok{3} = \rtTokByNum{3} = 3 $? As anticipated. + +The command \cs{ranToksOff} is probably best in the preamble to turn off +all randomization while the rest of the document is being composed. + +The \textsf{ran\_toks} package writes an auxiliary file named +\verb!\jobname\_rt.sav!, below represents two typical lines in this file. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +1604051353 % initializing seed value +5747283528 % last random number used +\end{Verbatim} +The first line is the initializing seed value used for the last +compilation of the document; the second line is the last value of the +pseudo-random number generator used in the document. + +Normally, the pseudo-random number generator provided by +\texttt{random.tex} produces a new initial seed value every minute. So if +you recompile again before another minute, you'll get the same initial +seed value. + +To obtain a new initial seed value each time you compile, place +\cs{useLastAsSeed} in the preamble. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(\useLastAsSeed) +\end{Verbatim} +When the document is compiled, the initial seed value taken as the second +line in the \verb!\jobname\_rt.sav! file, as seen in the above example. +With this command in the preamble, a new set of random numbers is +generated on each compile. If the file \cs{jobname\_rt.sav} does not +exist, the generator will be initialized by its usual method, using the time and date. + +The command \cs{useThisSeed} allows you to reproduce a previous +pseudo-random sequence. +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +!fbox(\useThisSeed{!meta(init_seed_value)}) +\end{Verbatim} +This command needs to be placed in the preamble. The value of +\meta{init\_seed\_value} is an integer, normally taken from the +first line of the \verb!\jobname\_rt.sav! file. + +When creating tests (possibly using \textsf{eqexam}), the problems, or +contiguous collections of problems, can be randomly ordered using the +\cs{bRTVToks}/\cs{eRTVToks} paradigm. For example, suppose there are two +classes and you want a random order (some of) the problems for each of the +two classes. Proceed as follows: +\begin{enumerate} +\item Compile the document, open \cs{jobname\_rt.sav}, and copy the + first line (in the above example, that would be + \texttt{1604051353}). +\item Place \verb!\useThisSeed{1604051353}! in the preamble. Compiling + will bring back the same pseudo-random sequence very time. +\item Comment this line out, and repeat the process (use + \cs{useLastAsSeed} to generate new random sequences at each + compile) until you get another distinct randomization, open + \cs{jobname\_rt.sav}, and copy the first line again, say its \texttt{735794511}. +\item Place \verb!\useThisSeed{735794511}! in the preamble. +\item Label each +\begin{Verbatim} +%\useThisSeed{1604051353} % 11:00 class +%\useThisSeed{735794511} % 12:30 class +\end{Verbatim} +To reproduce the random sequence for the class, just uncomment the random +seed used for that class. +\end{enumerate} +If you are using \textsf{eqexam}, the process can be automated as follows: +\begin{Verbatim}[xleftmargin=20pt,commandchars=!()] +\vA{\useThisSeed{1604051353}} % 11:00 class +\vB{\useThisSeed{735794511}} % 12:30 class +\end{Verbatim} +Again, this goes in the preamble. + +Now, I simply must get back to my retirement. \dps + +\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 new file mode 100644 index 00000000000..5136f083717 --- /dev/null +++ b/Master/texmf-dist/doc/latex/ran_toks/examples/ran_toks.tex @@ -0,0 +1,77 @@ +\documentclass{article} +\usepackage{ran_toks} + +%\useThisSeed{606574325} +%\useLastAsSeed +%\rtdebugtrue +%\ranToksOn +%\ranToksOff + +\parindent0pt \parskip6pt + + +\begin{document} +\begin{center}\bfseries + Test file for \textsf{ran\_toks} Package\\[3pt] + D. P. Story +\end{center} + +Test of the \verb!\ranToks! command. + +\ranToks{myPals}{% + {Jim}{Richard}{Don} + {Alex}{Tom}{J\"{u}rgen} +} +I have {\nToksFor{myPals}} pals, they are \useRanTok{1}, \useRanTok{2}, +\useRanTok{3}, \useRanTok{4}, {\useRanTok{5}} and \useRanTok{6}. (Listed +in the order of best friend to least best friend.) + +Test of the \verb!\bRTVToks!/\verb!\eRTVToks! pair of commands and of the +\texttt{rtVW} environment. + +\bRTVToks{myThoughts}% +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +Roses are red and violets are blue, +I've forgotten the rest, have you too? +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I gave up saying bad things like +\verb!$#%%%^*%^&#$@#! when I was just a teenager +\end{minipage} +\end{rtVW} +\begin{rtVW} +\begin{minipage}[t]{.67\linewidth} +I am a good guy, pass it on! The code for this last sentence is, +\begin{verbatim} +%#$% I am a good guy, pass it on! ^&*&^* +\end{verbatim} +How did that other stuff get in there? +\end{minipage} +\end{rtVW} +\eRTVToks +\begin{enumerate} + \item \useRanTok{1} + \item \useRanTok{2} + \item \useRanTok{3} +\end{enumerate} + +Use \verb!\useRTName! command when another list separates the current +position from the list you want to use. Here we want to use the list named +\texttt{myPals}, but since that definition, a new list named +\texttt{myThoughts} was declared. + +\useRTName{myPals} +List of pals: \useRanTok{1}, \useRanTok{2}, \useRanTok{3}, \useRanTok{4}, +\useRanTok{4}, \useRanTok{5}. + +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}}. + +\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 new file mode 100644 index 00000000000..5236428ec86 --- /dev/null +++ b/Master/texmf-dist/source/latex/ran_toks/ran_toks.dtx @@ -0,0 +1,452 @@ +% \iffalse meta-comment +%<*internal> +\iffalse +%</internal> +%<*internal> +\fi +\def\nameofplainTeX{plain} +\ifx\fmtname\nameofplainTeX\else + \expandafter\begingroup +\fi +%</internal> +%<*install> +\input docstrip.tex +\keepsilent +\askforoverwritefalse +\preamble +\endpreamble +\ifx\fmtname\nameofplainTeX +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{copyright,package}} +} +\fi +%</install> +%<install>\endbatchfile +%<*internal> +\ifx\fmtname\nameofplainTeX + \expandafter\endbatchfile\else + \expandafter\endgroup\fi +%</internal> +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% ran_toks.sty package, 2012/10/29 %% +%% Copyright (C) 2012 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. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%</copyright> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{ran_toks} +%<package> [2012/11/18 v1.0a Randomizing tokens] +%<*driver> +\documentclass{ltxdoc} +%\usepackage{\jobname} +%\usepackage[numbered]{hypdoc} +%\EnableCrossrefs +%\CodelineIndex +%\RecordChanges +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% \fi +% +%\GetFileInfo{\jobname.sty} +% +%\title{The \textsf{ran\_toks} Package} +%\author{D. P. Story} +%\date{Released \today} +% +%\maketitle +% +%\StopEventually{^^A +% \PrintChanges +% \PrintIndex +%} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \paragraph*{Description.} +% This short package randomizes a list of tokens. The command, \cs{ranToks}, +% takes one argument, which is, in turn, a list of tokens: +%\begin{verbatim} +% \ranToks{<name>} +% { +% {tok_1}{tok_2}...{tok_n} +% } +%\end{verbatim} +% The command defines a series of $n$ internal commands, one for each of the tokens. +% The definitions are essentially randomized. The randomized tokens are accessed through +% the command \cs{useRanTok}. For example +%\begin{verbatim} +% \useRanTok{1}, \useRanTok{2},..., \useRanTok{n} +%\end{verbatim} +% gives a random listing of the $n$ tokens. These can be arranged on the page +% as desired. +% +% There is a second construct, designed for more elaborate randomization. +%\begin{verbatim} +%\bRTVToks{<name>} +%\begin{rtVW} +% <some content> +%\end{rtVW} +%... +%... +%\begin{rtVW} +%<some content> +%\end{rtVW} +%\eRTVToks +%\end{verbatim} +% The contents of each of the \texttt{rtVW} environments are written to disk, then input +% back in in random order, using \cs{useRanTok}, eg, +%\begin{verbatim} +% \useRanTok{1}, \useRanTok{2},..., \useRanTok{n} +%\end{verbatim} +% Other details are left to the readers' imagination. +% +% \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} +\RequirePackage{verbatim} +\input{random.tex} +% \end{macrocode} +% 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 + \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 +% \end{macrocode} +% Save the initial seed value to \cs{rtInitSeedValue}. +% \begin{macrocode} + \xdef\rtInitSeedValue{\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 +} +% \end{macrocode} +% The code for this package was taken from the \textsf{dps} package, and modified +% suitably. We use several token registers and count registers. This can probably +% be optimized. +% \begin{macrocode} +\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 +% \end{macrocode} +% \begin{macrocode} +\def\rt@nameedef#1{\expandafter\edef\csname #1\endcsname} +% \end{macrocode} +% +% \section{Commands for controlling the process} +% +% \DescribeMacro{\ranToksOn}\DescribeMacro{\ranToksOff} These two turn on and turn off +% randomization. +% \begin{macrocode} +\def\ranToksOn{\werandomizetrue} +\def\ranToksOff{\werandomizefalse} +% \end{macrocode} +% \DescribeMacro{\useThisSeed} initializes the random number generator. Use this to reproduce +% the same sequence of pseudo-random numbers from an earlier run. We also set +% \cs{saveseedfalse} so we do not write the initial seed to the disk. +% \begin{macrocode} +\def\useThisSeed#1{\saveseedfalse\randomi=#1} +\@onlypreamble\useThisSeed +% \end{macrocode} +% \DescribeMacro{\useLastAsSeed} initializes the random number generator using the +% last random seed. If the file \cs{jobname\_rt.sav} does not exist, the generator will be +% initialized using time and date data. +% \begin{macrocode} +\def\useLastAsSeed{\IfFileExists{\jobname_rt.sav}% + {% + \PackageInfo{ran_toks}{Inputting \jobname_rt.sav}% + \newread\readsavfile + \openin\readsavfile=\jobname_rt.sav + \read\readsavfile to \rtInitSeedValue + \read\readsavfile to \lastRandomNum + \closein\readsavfile + \randomi=\lastRandomNum + }{% + \PackageInfo{ran_toks}{\jobname_rt.sav cannot + be found, \MessageBreak + using the random initializer}% + }% +} +\@onlypreamble\useLastAsSeed +% \end{macrocode} +% +% \section{Utility commands} +% +% 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} +\def\endverbatimwrite{\@esphack} +\def\rt@IWVO{\immediate\write\verbatim@out} +% \end{macrocode} +% We write only if \cs{ifsaveseed} is true. +% \begin{macrocode} +\def\rtInitSeedValue{\the\randomi} +\def\rt@writeSeedData{% + \ifsaveseed + \newwrite\rt@savedata + \immediate\openout \rt@savedata \jobname_rt.sav + \let\verbatim@out\rt@savedata + \def\rt@msgi{initializing seed value}% + \def\rt@msgii{last random number used}% + \uccode`c=`\%\uppercase{% + \rt@IWVO{\rtInitSeedValue\space c \rt@msgi}% + \rt@IWVO{\the\randomi\space c \rt@msgii}% + }% + \fi +} +% \end{macrocode} +% Save the initial seed value to hard drive. +% \begin{macrocode} +\AtEndDocument{\rt@writeSeedData}% +% \end{macrocode} +% \DescribeMacro{\rt@populateList} is a utility command, its argument is a positive integer, \texttt{n}, +% and it generates a list of the form \verb!\\{1}\\{2}...\\{n}! and is held in the +% token register \cs{rt@listIn} This listing is later +% randomly permuted by \cs{rt@RandomizeList}. +% \begin{macrocode} +\def\rt@populateList#1{% + \rt@listIn={}% + \rt@nCnt=0 + \@whilenum\rt@nCnt<#1\do{% + \advance\rt@nCnt1 + \edef\rt@listInHold{\the\rt@listIn\noexpand\\{\the\rt@nCnt}}% + \rt@listIn=\expandafter{\rt@listInHold}% + }% +} +% \end{macrocode} +% \DescribeMacro{\rt@RandomizeList} is the command that gets the process of randomizing +% the input list going. The argument is the number of tokens. If +% \cs{werandomize} is false, it just returns the input list; otherwise, it +% 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 +} +% \end{macrocode} +% \DescribeMacro{\rt@randomizeList} randomizes the list of consecutive integers, and leaves the +% results, +%\begin{verbatim} +% \\{k_1}\\{k_2}...\\{k_n} +%\end{verbatim} +% in the token register \cs{rt@listOut}. +% \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}% +\ifrtdebug\typeout{\string\rt@getRanNum=\the\rt@getRanNum}\fi + \rt@nCnt=0\relax +\ifrtdebug\typeout{LISTING: \the\rt@listIn}\fi + \the\rt@listIn + \rt@loopTest +} +\def\rt@loopTest{\advance\rt@nMax-1\relax + \ifnum\rt@nMax>0\relax + \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 +% contents of \cs{rt@listIn}. We then go into a loop \cs{rt@loopTest}. \cs{rt@getRanNum} +% is the random integer between 1 and \cs{rt@nMax}. +% \begin{macrocode} +\def\rt@processi#1{\advance\rt@nCnt1 + \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} +% \section{The main commands} +% \DescribeMacro{\ranToks} takes one argument, a list of tokens. It randomizes them. +% The randomized listing can be accessed using \cs{useRanTok}. +% \begin{macrocode} +\def\ranToks#1{\begingroup + \useRTName{#1}% + \r@nToks +} +\long\def\r@nToks#1{% + \rt@nMax=0 + \r@ndToks#1\rt@NIL +} +\def\rt@NIL{@nil} +% \end{macrocode} +% \DescribeMacro{\useRTName} sets the base name (use prior to the use of \cs{useRanTok}). +% \begin{macrocode} +\newcommand{\useRTName}[1]{\gdef\rt@BaseName{#1}}% +\let\rt@BaseName\@empty +% \end{macrocode} +% \DescribeMacro{\bRTVToks}\cs{bRTVToks} and \DescribeMacro{\eRTVToks}\cs{eRTVToks} enclose a series +% of \texttt{rtVW} environments. The single argument is the name of this set of +% verbatim write ``tokens''. +% \begin{macrocode} +\newcommand{\bRTVToks}[1]{% + \rt@nCnt=0 + \useRTName{#1}% +} +% \end{macrocode} +% At the end of the \texttt{rtVW} environments, initiated by \cs{bRTVToks}, the +% \cs{eRTVToks} command saves the number of tokens counted, and randomizes the +% 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\r@nVToks\expandafter{\rt@BaseName}% +} +% \end{macrocode} +% \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. +% \begin{macrocode} +\def\reVerbEnd{\ifhmode\unskip\fi} +\newenvironment{rtVW}{% + \global\advance\rt@nCnt1 + \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 +} +% \end{macrocode} +% \end{environment} +% \DescribeMacro{\r@nVToks} randomizes the contents of the \texttt{rtVW} +% 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@nCnt1 + \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} +% and \cs{eRTVToks} (through \cs{r@nVToks}). If the ending token \cs{rt@NIL} is detected, we +% break off and go to \cs{rt@endToks}. +% \begin{macrocode} +\long\def\r@ndToks#1{% +% \end{macrocode} +% If the current argument is \cs{par}, we skip it +% \begin{macrocode} + \ifx#1\par\def\rt@next{\r@ndToks}\else + \advance\rt@nMax1 + \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} +% The final destination for \cs{r@ndToks}. +% \begin{macrocode} +\def\rt@endToks{% +% \end{macrocode} +% Save the number of tokens counted +% \begin{macrocode} + \global\rt@nameedef{nMax4\rt@BaseName}{\the\rt@nMax}% +% \end{macrocode} +% Now we randomize the order of the integers 1, 2,\dots\cs{rt@nMax}. +% \begin{macrocode} + \rt@RandomizeList{\the\rt@nMax}% + \rt@nCnt=0 +% \end{macrocode} +% Now we randomized the definitions. We \verb!\let\\=\assignRanToks!, then +% let loose the tokens! +% \begin{macrocode} + \let\\\assignRanToks + \the\rt@listOut + \endgroup +} +% \end{macrocode} +%\DescribeMacro{\assignRanToks} makes the assignments that are expanded by \cs{useRanTok}. +% We \cs{let} the assignment \verb!\let\\=\assignRanToks! in \cs{rt@endToks}, just before we dump out the +% contents of \verb!\the\rt@listOut!. +% \begin{macrocode} +\def\assignRanToks#1{\advance\rt@nCnt1 + \global\rt@nameedef{rtRanTok\the\rt@nCnt\rt@BaseName}% + {\noexpand\rtTokByNum[\rt@BaseName]{#1}}% +} +% \end{macrocode} +% \subsection{Additional user access commands} +% \DescribeMacro{\nToksFor} expands the the number of tokens whose name is \texttt{\#1}. +% \begin{macrocode} +\newcommand{\nToksFor}[1]{\@nameuse{nMax4#1}} +% \end{macrocode} +% \DescribeMacro{\rtTokByNum} 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]{\@nameuse{rtTok#2#1}\ignorespaces} +% \end{macrocode} +%\DescribeMacro{\useRanTok} After \cs{ranToks} has been executed, the user has access to the +% randomized tokens through \cs{useRanTok}. The argument is an integer 1 through max. +% \begin{macrocode} +\newcommand{\useRanTok}[2][\rt@BaseName]{\@nameuse{rtRanTok#2#1}} +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +%\Finale diff --git a/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty b/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty new file mode 100644 index 00000000000..97328c55b3f --- /dev/null +++ b/Master/texmf-dist/tex/latex/ran_toks/ran_toks.sty @@ -0,0 +1,220 @@ +%% +%% This is file `ran_toks.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ran_toks.dtx (with options: `copyright,package') +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% ran_toks.sty package, 2012/10/29 %% +%% Copyright (C) 2012 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} +\ProvidesPackage{ran_toks} + [2012/11/18 v1.0a Randomizing tokens] +\RequirePackage{verbatim} +\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\rtInitSeedValue{\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{\IfFileExists{\jobname_rt.sav}% + {% + \PackageInfo{ran_toks}{Inputting \jobname_rt.sav}% + \newread\readsavfile + \openin\readsavfile=\jobname_rt.sav + \read\readsavfile to \rtInitSeedValue + \read\readsavfile to \lastRandomNum + \closein\readsavfile + \randomi=\lastRandomNum + }{% + \PackageInfo{ran_toks}{\jobname_rt.sav cannot + be found, \MessageBreak + using the random initializer}% + }% +} +\@onlypreamble\useLastAsSeed +\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\rtInitSeedValue{\the\randomi} +\def\rt@writeSeedData{% + \ifsaveseed + \newwrite\rt@savedata + \immediate\openout \rt@savedata \jobname_rt.sav + \let\verbatim@out\rt@savedata + \def\rt@msgi{initializing seed value}% + \def\rt@msgii{last random number used}% + \uccode`c=`\%\uppercase{% + \rt@IWVO{\rtInitSeedValue\space c \rt@msgi}% + \rt@IWVO{\the\randomi\space c \rt@msgii}% + }% + \fi +} +\AtEndDocument{\rt@writeSeedData}% +\def\rt@populateList#1{% + \rt@listIn={}% + \rt@nCnt=0 + \@whilenum\rt@nCnt<#1\do{% + \advance\rt@nCnt1 + \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 +} +\def\rt@randomizeList{% + \let\\=\rt@processi + \setrannum{\rt@getRanNum}{1}{\the\rt@nMax}% +\ifrtdebug\typeout{\string\rt@getRanNum=\the\rt@getRanNum}\fi + \rt@nCnt=0\relax +\ifrtdebug\typeout{LISTING: \the\rt@listIn}\fi + \the\rt@listIn + \rt@loopTest +} +\def\rt@loopTest{\advance\rt@nMax-1\relax + \ifnum\rt@nMax>0\relax + \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@nCnt1 + \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\ranToks#1{\begingroup + \useRTName{#1}% + \r@nToks +} +\long\def\r@nToks#1{% + \rt@nMax=0 + \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=0 + \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@nCnt1 + \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@nCnt1 + \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}} +\long\def\r@ndToks#1{% + \ifx#1\par\def\rt@next{\r@ndToks}\else + \advance\rt@nMax1 + \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@endToks{% + \global\rt@nameedef{nMax4\rt@BaseName}{\the\rt@nMax}% + \rt@RandomizeList{\the\rt@nMax}% + \rt@nCnt=0 + \let\\\assignRanToks + \the\rt@listOut + \endgroup +} +\def\assignRanToks#1{\advance\rt@nCnt1 + \global\rt@nameedef{rtRanTok\the\rt@nCnt\rt@BaseName}% + {\noexpand\rtTokByNum[\rt@BaseName]{#1}}% +} +\newcommand{\nToksFor}[1]{\@nameuse{nMax4#1}} +\newcommand{\rtTokByNum}[2][\rt@BaseName]{\@nameuse{rtTok#2#1}\ignorespaces} +\newcommand{\useRanTok}[2][\rt@BaseName]{\@nameuse{rtRanTok#2#1}} +\endinput +%% +%% End of file `ran_toks.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 7e877bfecf2..6f714e675fc 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -353,7 +353,7 @@ my @TLP_working = qw( psu-thesis ptext ptptex punk punk-latex punknova purifyeps pxcjkcat pxfonts pxgreeks pxtxalfa python quattrocento qcm qobitree quoting qstest qsymbols qtree quotchap quotmark - r_und_s randbild randomwalk randtext rccol rcs rcs-multi rcsinfo + r_und_s ran_toks randbild randomwalk randtext rccol rcs rcs-multi rcsinfo realboxes realscripts rec-thy recipe recipecard recycle rectopma refcheck refman refstyle regcount regexpatch register regstats relenc relsize reotex repeatindex resphilosophica resumemac reverxii revtex diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 217326082c8..0269332e680 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1927,6 +1927,7 @@ $standardsource='\.(bat|c|drv|dtx|fea|fdd|ins|sfd)$|configure.*|install-sh'; 'paper', 'install', 'papermas', "$package.dtx", 'parrun', 'parrun.ins', + 'ran_toks', "$package.dtx", 'seuthesis', 'NULL', # don't want to run iconv, etc. 'statrep', "$package.dtx", 'stmaryrd', 'stmaryrd.dtx', @@ -2004,6 +2005,7 @@ my $core_latex = "$Master/texmf-dist/tex/latex"; 'poemscol' => 'latex', # requires interaction 'polski' => 'latex', # requires interaction 'psfragx' => 'latex', # requires interaction + 'ran_toks' => 'tex', 'schedule' => 'latex', # requires interaction 'silence' => 'latex -translate-file=empty.tcx', # no 8-bit 'svn-multi' => 'latex', # interaction for .pl diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index ed1eb96e53e..3ba49886f7e 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -620,6 +620,7 @@ depend qstest depend qsymbols depend quotchap depend quotmark +depend ran_toks depend randtext depend rccol depend rcs-multi diff --git a/Master/tlpkg/tlpsrc/ran_toks.tlpsrc b/Master/tlpkg/tlpsrc/ran_toks.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/ran_toks.tlpsrc |