diff options
author | Karl Berry <karl@freefriends.org> | 2016-07-14 21:40:20 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-07-14 21:40:20 +0000 |
commit | 8c9e308c574ea6a70bba4800eef52c37d19e14e2 (patch) | |
tree | cd6cad34ffff276ecf424e679dafc30c104b0ff2 /Master/texmf-dist/doc/generic/randomlist | |
parent | d8177aef8ca941d4ac68c7002d67e411025a03e2 (diff) |
randomlist (14jul16)
git-svn-id: svn://tug.org/texlive/trunk@41695 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/randomlist')
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/Makefile | 41 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/README.txt | 46 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/comets.dat | 22 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/pupils.dat | 25 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/pythagoras.dat | 100 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/randomlist.pdf | bin | 0 -> 210731 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/randomlist.tex | 682 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/test.pdf | bin | 0 -> 116659 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/test.tex | 61 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/testtex.pdf | bin | 0 -> 46147 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/generic/randomlist/testtex.tex | 96 |
11 files changed, 1073 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/generic/randomlist/Makefile b/Master/texmf-dist/doc/generic/randomlist/Makefile new file mode 100644 index 00000000000..150f1af3a59 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/Makefile @@ -0,0 +1,41 @@ +base=randomlist +default: package doc test # package ou class +final: package doc-final test + +package: $(base).sty +$(base).sty: $(base).ins $(base).dtx + tex '\nonstopmode \input $(base).ins' + +class: $(base).cls +$(base).cls: $(base).ins $(base).dtx + tex '\nonstopmode \input $(base).ins' + +doc: + latex '\nonstopmode \input $(base).dtx' + dvips $(base) + ps2pdf $(base).ps $(base).pdf + rm $(base).dvi $(base).ps + +doc-final: + latex '\nonstopmode \input $(base).dtx' + latex '\nonstopmode \input $(base).dtx' + makeindex -s gind.ist -o $(base).ind $(base).idx + makeindex -s gglo.ist -o $(base).gls $(base).glo + latex '\nonstopmode \input $(base).dtx' + dvips $(base) + ps2pdf $(base).ps $(base).pdf + rm $(base).dvi $(base).ps + +test: randomlist.tex test.tex testtex.tex + pdflatex '\nonstopmode \input test.tex' + etex '\nonstopmode \input testtex.tex' + pdftex '\nonstopmode \input testtex.tex' + +ecm: ecm.tex + pdflatex '\nonstopmode \input ecm.tex' + +clean: + rm -rf *~ *.aux *.dvi *.glo *.gls *.idx *.ilg *.ind *.log *.out *.ps *.toc + +zip: + cd .. ; zip $(base).zip randomlist/$(base).dtx randomlist/$(base).ins randomlist/$(base).pdf randomlist/$(base).sty randomlist/readme.txt randomlist/Makefile randomlist/comets.dat randomlist/pupils.dat randomlist/pythagoras.dat randomlist/test.tex randomlist/test.pdf randomlist/testtex.tex randomlist/testtex.pdf; mv $(base).zip randomlist/ diff --git a/Master/texmf-dist/doc/generic/randomlist/README.txt b/Master/texmf-dist/doc/generic/randomlist/README.txt new file mode 100644 index 00000000000..a06c3a5be7a --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/README.txt @@ -0,0 +1,46 @@ +___________________________________ + + The + randomelist package + v1.2 + + 2016/07/13 +___________________________________ + +Maintainers: Jean-Côme Charpentier & Christian Tellechea +E-mails : jean-come.charpentier@wanadoo.fr + unbonpetit@openmailbox.org + Comments, bug reports and suggestions are welcome. +Licence : Released under the LaTeX Project Public License v1.3c or + later, see http://www.latex-project.org/lppl.txt + +---------------------------------------------------------------------- + +The main aim of package randomlist is to work on list, especially with +random operation. The hidden aim is to build personnal collection of +exercices with different data for each pupils. + +In order to build such exercices, some features about databases and +about loops are necessary. + +randomlist works under (La)eTeX, pdf(La)TeX, Xe(La)TeX, and +lua(La)TeX. TeX without eTeX primitives don't work since some eTeX +primitives are used. + +---------------------------------------------------------------------- + +Le but premier de cette extension est de pouvoir travailler sur des +listes, en particulier avec des opérations aléatoires. Le but caché +est de réaliser une collection personnelle d'exercices avec +différentes données pour chaque élève. + +Certaines fonctionnalités sur les base de données et les boucles vont +être nécessaires pour construire de tels exercices. + +randomlist fonctionne sous La)eTeX, pdf(La)TeX, Xe(La)TeX et +lua(La)TeX. TeX sans les primitives eTeX ne fonctionnera pas puisque +certaines primitives eTeX sont utilisées. + + Jean-Côme Charpentier + Christian Tellechea + diff --git a/Master/texmf-dist/doc/generic/randomlist/comets.dat b/Master/texmf-dist/doc/generic/randomlist/comets.dat new file mode 100644 index 00000000000..8f659c997e8 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/comets.dat @@ -0,0 +1,22 @@ +| Comet | Discover |Year |Period | +%------------------------------------------------------------------ +| 1P/Halley | Halley |1758 | 76.09 | +| 2P/Encke | Encke |1786 | 3.30 | +| 3D/Biela | Biela |1826 | 6.62 | +| 4P/Faye | Faye |1843 | 7.55 | +| 5D/Brorsen | Brorsen |1846 | 5.46 | +| 6P/d'Arrest | d'Arrest |1851 | 6.54 | +| 7P/Pons-Winnecke | Pons \& Winnecke |1819 | 6.36 | +| 8P/Tuttle | Tuttle |1858 | 13.58 | +| 9P/Tempel | Tempel |1867 | 5.52 | +| 10P/Tempel | Tempel |1873 | 5.38 | +| 11P/Tempel-Swift-LINEAR | Tempel, Swift \& LINEAR |1869 | 6.37 | +| 12P/Pons-Brooks | Pons \& Brooks |1812 | 70.85 | +| 13P/Olbers | Olbers |1815 | 69.5 | +| 14P/Wolf | Wolf |1884 | 8.74 | +| 15P/Finlay | Finlay |1886 | 6.50 | +| 16P/Brooks | Brooks |1889 | 6.14 | +| 17P/Holmes | Holmes |1892 | 6.89 | +| 18D/Perrine-Mrkos | Perrine \& Mrkos |1896 | | +| 19P/Borrelly | Borrelly |1904 | 6.85 | +| 20D/Westphal | Westphal |1852 | 61.8 | diff --git a/Master/texmf-dist/doc/generic/randomlist/pupils.dat b/Master/texmf-dist/doc/generic/randomlist/pupils.dat new file mode 100644 index 00000000000..2f1cdb5abf5 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/pupils.dat @@ -0,0 +1,25 @@ +Name,FirstName,Result +Aho,Alfred,A +Babbage,Charles,A +Chaitin,Gregory,B +Dijkstra,Edsger,A +Eckert,John Preper,B +Floyd,Robert,B +G\"odel,Kurt,A +Huffman,David,B +Ichbiah, Jean,A +Joshi,Aravind,C +Knuth,Donald,C +Lovelace,Ada,A +Moore,Gordon,A +Neumann (Von),John,A +Ouserhout,John,B +Pascal,Blaise,A +Ritchie,Dennis,C +Shannon,Claude,C +Thompson,Ken,A +Ullman,Jeffrey,B +Vixie,Paul,B +Wall,Larry,B +Yao, Adrew Chi-Chih,C +Zuse,Konrad,C
\ No newline at end of file diff --git a/Master/texmf-dist/doc/generic/randomlist/pythagoras.dat b/Master/texmf-dist/doc/generic/randomlist/pythagoras.dat new file mode 100644 index 00000000000..5b69b3302c2 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/pythagoras.dat @@ -0,0 +1,100 @@ +119,120,169 +108,144,180 +153,104,185 +144,130,194 +133,156,205 +120,182,218 +105,208,233 +180,112,212 +171,140,221 +160,168,232 +147,196,245 +132,224,260 +115,252,277 +209,120,241 +200,150,250 +189,180,261 +176,210,274 +161,240,289 +144,270,306 +125,300,325 +104,330,346 +240,128,272 +231,160,281 +220,192,292 +207,224,305 +192,256,320 +175,288,337 +156,320,356 +135,352,377 +112,384,400 +280,102,298 +273,136,305 +264,170,314 +253,204,325 +240,238,338 +225,272,353 +208,306,370 +189,340,389 +168,374,410 +145,408,433 +120,442,458 +315,108,333 +308,144,340 +299,180,349 +288,216,360 +275,252,373 +260,288,388 +243,324,405 +224,360,424 +203,396,445 +180,432,468 +155,468,493 +128,504,520 +352,114,370 +345,152,377 +336,190,386 +325,228,397 +312,266,410 +297,304,425 +280,342,442 +261,380,461 +240,418,482 +217,456,505 +192,494,530 +162,532,557 +136,570,586 +105,608,617 +391,120,409 +384,160,416 +375,200,425 +364,240,436 +351,280,449 +336,320,464 +319,360,481 +300,400,500 +297,440,521 +256,480,544 +231,520,569 +204,560,596 +175,600,625 +144,640,656 +111,680,689 +432,126,450 +425,168,457 +416,210,466 +405,252,477 +392,294,490 +377,336,505 +360,378,522 +341,420,541 +320,462,562 +297,504,585 +272,546,610 +245,588,637 +216,630,666 +185,672,697 +152,714,730 +117,756,765 +475,132,493 +468,176,500
\ No newline at end of file diff --git a/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf b/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf Binary files differnew file mode 100644 index 00000000000..3d9f046267a --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf diff --git a/Master/texmf-dist/doc/generic/randomlist/randomlist.tex b/Master/texmf-dist/doc/generic/randomlist/randomlist.tex new file mode 100644 index 00000000000..80832ce90c5 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/randomlist.tex @@ -0,0 +1,682 @@ +%% +%% This is file `randomlist.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% randomlist.dtx (with options: `tex') +%% +%% randomlist.dtx +%% Copyleft 2013-2016 J.-C. Charpentier & C. Tellechea +%% Packages `randomlist' to use with (La)eTeX +%% Copyleft (L) 2013-2016 Jean-C\^ome Charpentier & Christian Tellechea. +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +%% +\csname RandomListLoaded\endcsname +\let\RandomListLoaded\endinput +\edef\RLAtCatcode{\the\catcode`\@} +\catcode`\@=11 +\ifx\@ifnextchar\@undefined + \long\def\@ifnextchar#1#2#3{% + \let\reserved@d=#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch} + \def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c} + \def\:{\let\@sptoken= } \: % + \def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} +\fi +\ifx\PackageError\@undefined + \long\def\@firstoftwo#1#2{#1} + \long\def\@secondoftwo#1#2{#2} + \def\@nnil{\@nil}% + \alloc@7\write\chardef\sixt@@n\@unused + \def\typeout#1{\immediate\write\@unused{#1}}% + \def\@spaces{\space\space\space\space} + \def\PackageError#1#2#3{% + \begingroup + \newlinechar`\^^J + \edef\RL@temp{#3}% + \expandafter\errhelp\expandafter{\RL@temp}% + \typeout{% + #1 error. \space See User's Manual for further information.^^J + \@spaces\@spaces\@spaces\@spaces + Type \space H <return> \space for immediate help.}% + \errmessage{#2}% + \endgroup + } +\fi +\ifx\numexpr\@undefined + \begingroup + \newlinechar`\^^J + \errhelp{Run under etex, pdftex, xetex, luatex, ... but not under + tex}% + \typeout{% + randomlist error. \space See User's Manual for further information.^^J + \@spaces\@spaces\@spaces\@spaces + Type \space H <return> \space for immediate help.}% + \errmessage{You can't use randomlist under tex without etex extension.}% + \endgroup +\fi +\ifx\@gobble\@undefined + \long\def\@gobble#1{} +\fi +\def\RL@addtomacro#1#2{\expandafter\def\expandafter#1\expandafter{#1#2}} +\def\RL@ifempty#1{% + \ifcat\relax\detokenize{#1}\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +\newcount\RL@random +\newcount\RL@random@a +\newcount\RL@random@b +\def\RLsetrandomseed#1{% + \ifnum#1=0 + \RL@random \numexpr \time + \year * \month * \day \relax + \else + \RL@random \numexpr \ifnum#1<0 -\fi#1 \relax + \fi +} +\ifx\RL@seed\@undefined + \RLsetrandomseed{0} +\else + \RLsetrandomseed{\RL@seed} +\fi +\def\RL@nextrand{% + \RL@random@a=\RL@random + \divide\RL@random@a 127773 + \RL@random@b=\RL@random@a + \multiply\RL@random@a -2836 + \multiply\RL@random@b -127773 + \advance\RL@random\RL@random@b + \multiply\RL@random 16807 + \advance\RL@random\RL@random@a + \ifnum\RL@random<0 + \advance\RL@random 2147483647 + \fi +} +\def\RLuniformdeviate#1#2{% + \RL@nextrand + \RL@random@a=\RL@random + \RL@random@b=\RL@random + \divide\RL@random@a \numexpr#1\relax + \RL@random@b \numexpr\RL@random@b - \RL@random@a * (#1)\relax + \expandafter\edef\csname #2\endcsname{\number\RL@random@b}% +}% +\newtoks\@ListOfList +\def\@ifIsList#1{% + \expandafter\@ifIsList@\expandafter{#1}% +} +\def\@ifIsList@#1{% + \def\@@ifIsList##1#1\sep##2\@@ifIsList{% + \csname @\ifx\empty##2\empty second\else first\fi oftwo\endcsname + }% + \expandafter\@@ifIsList\the\@ListOfList#1\sep\@@ifIsList +} +\def\RL@lenof#1{\csname #1-len\endcsname} +\newif\if@EmptyListFound +\def\@ifIsListNotEmpty#1{% + \global\@EmptyListFoundfalse + \@ifIsList{#1}{% + \ifnum\RL@lenof{#1}=0 + \global\@EmptyListFoundtrue + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi + }% + \@secondoftwo +} +\def\@NoListError#1{% + \if@EmptyListFound + \@EmptyListError{#1}% + \global\@EmptyListFoundfalse + \else + \PackageError{randomlist}% + {List #1 doesn't exist}% + {Maybe you mistyped the list name?}% + \fi +} +\def\@EmptyListError#1{% + \if@EmptyListFound + \PackageError{randomlist}% + {List #1 is empty}% + {Ask yourself why this list is empty.}% +} +\def\@OutOfRangeError#1#2{% + \PackageError{randomlist}% + {Index #2 is greater than last index of list #1}% + {There aren't enough elements in the list.}% +} +\long\def\RL@nameldef#1{% + \long\expandafter\def\csname #1\endcsname +} +\long\def\RL@nameledef#1{% + \long\expandafter\edef\csname #1\endcsname +} +\long\def\RL@namelgdef#1{% + \long\expandafter\gdef\csname #1\endcsname +} +\long\def\RL@namelxdef#1{% + \long\expandafter\xdef\csname #1\endcsname +} +\def\RL@let#1#2{% + \expandafter\let\csname#1\expandafter\endcsname\csname#2\endcsname +} +\long\def\RL@doafterfi#1\fi{\fi#1} +\def\RLfor#1=#2to#3\do{% + \edef#1{\number\numexpr#2}% + \edef\RL@sgncomp{\ifnum#1<\numexpr#3\relax>+\else<-\fi}% + \expandafter\RLfor@i + \csname RLfor@ii@\string#1\expandafter\endcsname\expandafter + {\number\numexpr#3\expandafter}% + \RL@sgncomp + #1% +} +\long\def\RLfor@i#1#2#3#4#5#6{% + \def#1{% + \unless\ifnum#5#3#2\relax + \RL@doafterfi{% + #6% + \edef#5{\number\numexpr#5#41\relax}% + #1% + }% + \fi + }% + #1% +} +\def\NewList#1{% + \@ifIsList{#1}{% + \PackageError{randomlist}% + {List #1 already exists}% + {Use \string\ClearList.}% + }% + {% + \ifcsname #1\endcsname + \PackageError{randomlist}% + {Command \csname#1\endcsname already exists}% + {Creating list #1 defines a \csname#1\endcsname command.}% + \else + \RL@nameldef{#1-len}{0}% + \@ListOfList\expandafter{\the\@ListOfList#1\sep}% + \expandafter\def\csname #1\endcsname[##1]{% + \ifnum##1>\csname#1-len\endcsname + \relax + \else + \csname #1-##1\endcsname + \fi + }% + \fi + }% +} +\def\ClearList#1{% + \@ifIsList{#1}{% + \RL@nameldef{#1-len}{0}% + }% + {\@NoListError{#1}}% +} +\def\CopyList#1#2{% + \@ifIsList{#1}{% + \@ifIsList{#2}{% + \RL@let{#2-len}{#1-len}% + \ifnum\RL@lenof{#1}>0 + \RLfor\RL@iter=0 to \RL@lenof{#1}-1 \do{% + \RL@let{#2-\RL@iter}{#1-\RL@iter}% + }% + \fi + }% + {\@NoListError{#2}}% + }% + {\@NoListError{#1}}% +} +\def\InsertList#1#2#3{% + \@ifIsList{#1}{% + \@ifIsList{#3}{% + \ifnum #2>\RL@lenof{#1} + \@OutOfRangeError{#1}{#2}% + \else + \ShiftList{#1}{#2}{\RL@lenof{#3}}% + \ifnum\RL@lenof{#3}>0 + \RLfor\RL@iter=0 to \RL@lenof{#3}-1 \do{% + \RL@let{#1-\number\numexpr\RL@iter+#2}{#3-\RL@iter}% + }% + \fi + \fi + }% + {\@NoListError{#3}}% + }% + {\@NoListError{#1}}% +} +\newcount\RL@counti +\newcount\RL@countii +\newcount\RL@countiii +\def\ShowList#1{% + \@ifIsList{#1}{% + \ifhmode\par\noindent\fi + \begingroup + \ifdefined\ttfamily\ttfamily\else\tt\fi + BEGIN\detokenize{{#1}} + (\ifcase\RL@lenof{#1} + empty list% + \or + 1 element% + \else + \RL@lenof{#1} elements% + \fi)\par + \ifnum\RL@lenof{#1}>0 + \parindent=1em + \RLfor\RL@iter=0 to \RL@lenof{#1}-1 \do {% + #1[\RL@iter] = \expandafter\RL@meaning\csname + #1-\RL@iter\endcsname + \par + }% + \fi + \noindent + END\detokenize{{#1}}\par + \endgroup + }% + {\@NoListError{#1}}% +} +\def\RL@meaning#1{\expandafter\RL@meaningi\meaning#1} +\expandafter\def\expandafter\RL@meaningi\expandafter#\expandafter1\string>{} +\def\CountList#1#2{% + \@ifIsList{#1}% + {\RL@nameledef{#2}{\RL@lenof{#1}}}% + {\@NoListError{#1}}% +} +\def\ShiftList#1#2#3{% + \@ifIsList{#1}% + {% + \unless\ifnum#3=0 + \ifnum\numexpr#2<0 + \PackageError{randomlist}% + {Negative index number}% + {Index must be equal or greater than 0}% + \else + \ifnum\numexpr#2>\RL@lenof{#1}\relax + \PackageError{randomlist}% + {Index \number\numexpr #2\relax\space too big + (<=\RL@lenof{#1})}% + {Index must be equal or smaller than length of + the list}% + \else + \ifnum\numexpr#3>0 + \RLfor\RL@iter = \RL@lenof{#1} to #2 \do{% + \RL@let{#1-\number\numexpr\RL@iter+#3}{#1-\RL@iter}% + }% + \RLfor\RL@iter = #2 to #2 + #3 - 1 \do{% + \RL@nameldef{#1-\RL@iter}{}% + }% + \else + \ifnum-#3>\numexpr#2\relax + \PackageError{randomlist}% + {Negative shift to big}% + {When negative, shift must not be greater than index}% + \else + \RLfor\RL@iter=#2 to \RL@lenof{#1} \do{% + \RL@let{#1-\number\numexpr\RL@iter+#3}{#1-\RL@iter}% + }% + \fi + \fi + \RL@nameledef{#1-len}{\number\numexpr\RL@lenof{#1} + #3}% + \fi\fi\fi + }% + {\@NoListError{#1}}% +} +\long\def\InsertLastItem#1#2{% + \@ifIsList{#1} + {% + \RL@nameldef{#1-\RL@lenof{#1}}{#2}% + \RL@nameledef{#1-len}{\number\numexpr\RL@lenof{#1}+1}% + } + {\@NoListError{#1}}% +} +\long\def\InsertFirstItem#1#2{% + \InsertItem{#1}{0}{#2}% +} +\long\def\InsertItem#1#2#3{% + \@ifIsList{#1}% + {% + \ShiftList{#1}{#2}{1}% + \RL@nameldef{#1-#2}{#3}% + }% + {\@NoListError{#1}}% +} +\long\def\InsertRandomItem#1#2{% + \@ifIsList{#1}% + {% + \RLuniformdeviate{\RL@lenof{#1}+1}{RL@temp}% + \InsertItem{#1}{\RL@temp}{#2}% + }% + {\@NoListError{#1}}% +} +\def\ExtractFirstItem#1#2{% + \@ifIsList{#1}% + {% + \ExtractItem{#1}{0}{#2}% + }% + {\@NoListError{#1}}% +} +\def\ExtractLastItem#1#2{% + \@ifIsListNotEmpty{#1}% + {% + \RL@let{#2}{#1-\number\numexpr\RL@lenof{#1}-1}% + \RL@nameledef{#1-len}{\number\numexpr\RL@lenof{#1}-1}% + }% + {\@NoListError{#1}}% +} +\def\ExtractItem#1#2#3{% + \@ifIsListNotEmpty{#1}% + {% + \RL@let{#3}{#1-#2}% + \ShiftList{#1}{#2+1}{-1}% + }% + {\@NoListError{#1}}% +} +\def\ExtractRandomItem#1#2{% + \@ifIsListNotEmpty{#1}% + {% + \RLuniformdeviate{\RL@lenof{#1}}{RL@temp}% + \ExtractItem{#1}{\RL@temp}{#2}% + }% + {\@NoListError{#1}}% +} +\def\ExtractList#1#2#3#4{% + \@ifIsList{#1}{% + \@ifIsList{#4}{% + \ifnum#2<\RL@lenof{#1}% + \ifnum#3<\RL@lenof{#1}% + \ifnum#2>#3\relax + \RL@nameldef{#4-len}{0}% + \else + \RLfor\RL@iterextract=0 to #3 - #2 \do{% + \RL@let{#4-\RL@iterextract}{#1-#2}% + \ExtractItem{#1}{#2}{RL@temp}% + }% + \RL@nameledef{#4-len}{\number\numexpr #3 - #2 + 1}% + \fi + \else + \@OutOfRangeError{#1}{#3}% + \fi + \else + \@OutOfRangeError{#1}{#2}% + \fi + }% + {\@NoListError{#4}}% + }% + {\@NoListError{#1}}% +} +\def\GetFirstItem#1#2{% + \GetItem{#1}{0}{#2}% +} +\def\GetLastItem#1#2{% + \GetItem{#1}{\number\numexpr\RL@lenof{#1}-1}{#2}% +} +\def\GetItem#1#2#3{% + \@ifIsListNotEmpty{#1} + {% + \ifnum\numexpr\RL@lenof{#1}-1-#2<0 + \@OutOfRangeError{#1}{#2}% + \else + \RL@let{#3}{#1-#2}% + \fi + } + {\@NoListError{#1}}% +} +\def\GetRandomItem#1#2{% + \@ifIsListNotEmpty{#1}% + {% + \RLuniformdeviate{\RL@lenof{#1}}{RL@temp}% + \GetItem{#1}{\RL@temp}{#2}% + }% + {\@NoListError{#1}}% +} +\def\GetList#1#2#3#4{% + \@ifIsList{#1}{% + \@ifIsList{#4}{% + \ifnum#2<\RL@lenof{#1}% + \ifnum#3<\RL@lenof{#1}% + \ifnum#2>#3\relax + \RL@nameldef{#4-len}{0}% + \else + \RLfor\RL@iter=#2 to #3 \do{% + \RL@let{#4-\number\numexpr \RL@iter - #2}{#1-\RL@iter}% + }% + \RL@nameledef{#4-len}{\number\numexpr #3 - #2 + 1}% + \fi + \else + \@OutOfRangeError{#1}{#3}% + \fi + \else + \@OutOfRangeError{#1}{#2}% + \fi + }% + {\@NoListError{#4}}% + }% + {\@NoListError{#1}}% +} +\long\def\SetFirstItem#1#2{% + \SetItem{#1}{0}{#2}% +} +\long\def\SetLastItem#1#2{% + \SetItem{#1}{\number\numexpr\RL@lenof{#1}-1}{#2}% +} +\long\def\SetItem#1#2#3{% + \@ifIsListNotEmpty{#1}% + {% + \ifnum\numexpr\RL@lenof{#1}-1-#2<0 + \@OutOfRangeError{#1}{#2}% + \else + \RL@nameldef{#1-#2}{#3}% + \fi + }% + {\@NoListError{#1}}%% +} +\long\def\SetRandomItem#1#2{% + \@ifIsListNotEmpty{#1}% + {% + \RLuniformdeviate{\RL@lenof{#1}}{RL@temp}% + \SetItem{#1}{\RL@temp}{#2}% + }% + {\@NoListError{#1}}% +} +\def\SetList#1#2{% + \@ifIsList{#1}% + {% + \ClearList{#1}% + \def\RL@name{#1}% + \RL@setlist#2,\@nil,% + }% + {\@NoListError{#1}}% +} +\long\def\RL@setlist#1,{% + \def\RL@arg{#1}% + \unless\ifx\RL@arg\@nnil + \InsertLastItem{\RL@name}{#1}% + \expandafter\RL@setlist + \fi +} +\long\def\ForEachFirstItem#1#2#3{% + \begingroup + \RLfor \RL@var = 0 to \RL@lenof{#1}-1 \do{% + \ExtractFirstItem{#1}{#2}% + #3% + }% + \endgroup +} +\long\def\ForEachLastItem#1#2#3{% + \begingroup + \RLfor \RL@var = 0 to \RL@lenof{#1}-1 \do{% + \ExtractLastItem{#1}{#2}% + #3% + }% + \endgroup +} +\long\def\ForEachRandomItem#1#2#3{% + \begingroup + \RLfor \RL@var = 0 to \RL@lenof{#1}-1 \do{% + \ExtractRandomItem{#1}{#2}% + #3% + }% + \endgroup +} +\long\def\ReadFieldItem#1#2#3{% + \RL@counti #2\relax + \expandafter\RL@ReadFieldItem#1\@nil + \expandafter\let\csname#3\endcsname\RL@temp +} +\long\def\RL@ReadFieldItem{% + \@ifnextchar\bgroup{\RL@@ReadFieldItem}{\RL@@ReadFieldItemError}% +} +\long\def\RL@@ReadFieldItem#1{% + \ifnum\RL@counti=\z@ + \def\RL@temp{#1}% + \expandafter\RL@@ReadFieldItemEnd + \else + \advance\RL@counti \m@ne + \expandafter\RL@ReadFieldItem + \fi +} +\long\def\RL@@ReadFieldItemEnd#1\@nil{} +\long\def\RL@@ReadFieldItemError#1\@nil{% + \PackageError{randomlist}% + {There aren't enough fields in the record}% + {Pay attention that field number starts from zero.}% +} +\def\RL@SetDelimiters#1#2#3\@nil{% + \def\RL@markstrings##1{% + \let\RL@accu\empty + \expandafter\RL@markstrings@i##1#2\@nil#2% + \let##1=\RL@accu + }% + \def\RL@markstrings@i##1#2##2#2{% + \RL@addtomacro\RL@accu{##1}% + \def\RL@current{##2}% + \unless\ifx\@nnil\RL@current + \RL@addtomacro\RL@accu{\RL@string{##2}}% + \expandafter\RL@markstrings@i + \fi + }% + \def\RL@unmarkstrings##1{% + \let\RL@accuA\empty + \expandafter\RL@unmarkstrings@i##1\RL@string\@nil + \let##1=\RL@accuA + }% + \def\RL@unmarkstrings@i##1\RL@string##2{% + \RL@addtomacro\RL@accuA{##1}% + \def\RL@current{##2}% + \unless\ifx\@nnil\RL@current + \RL@ifempty{##2}% + {\RL@addtomacro\RL@accuA{#2}}% + {\RL@addtomacro\RL@accuA{##2}}% + \expandafter\RL@unmarkstrings@i + \fi + }% + \def\RL@parsefields##1{% + \let\RL@accu\empty + \expandafter\RL@parsefields@i##1#1\@nil#1% + \let##1=\RL@accu + }% + \def\RL@parsefields@i##1#1{% + \def\RL@current{##1}% + \unless\ifx\@nnil\RL@current + \RL@unmarkstrings\RL@current + \RL@removefirstspaces\RL@current + \RL@removelastspaces \RL@current + \expandafter\RL@addtomacro\expandafter\RL@accu\expandafter + {\expandafter{\RL@current}}% + \expandafter\RL@parsefields@i + \fi + }% +} +\newread\RL@hdle +\def\@ppar{\par} +\def\ReadFileList{\@ifnextchar[{\@ReadFileList}{\@ReadFileList[,"]}} +\def\@ReadFileList[#1]#2#3{% + \openin \RL@hdle = #3 + \ifeof\RL@hdle + \PackageError{randomlist}% + {File #3 doesn't exist}% + {Verify its name, its extension, its location, its permissions.}% + \else + \RL@ifempty{#1}% + {% + \PackageError{randomlist} + {Optional argument empty: [,"] inserted} + {Do not leave an optional argument empty}% + \RL@SetDelimiters,"\@nil + } + {\RL@SetDelimiters#1"\@nil}% + \loop + \read\RL@hdle to \RL@buffer + \unless\ifx\RL@buffer\@ppar + \RL@markstrings\RL@buffer + \RL@parsefields\RL@buffer + \def\RL@accuA{\InsertLastItem{#2}}% + \expandafter\RL@accuA\expandafter{\RL@buffer}% + \fi + \ifeof\RL@hdle\else + \repeat + \fi +} +\def\RL@ifspacefirst#1{% + \RL@ifspacefirst@i#1A \@nil +} +\expandafter\def\expandafter\RL@ifspacefirst@i + \expandafter#\expandafter1\space#2\@nil{% + \RL@ifempty{#1}% +} +\def\RL@removefirstspaces#1{% + \expandafter\RL@ifspacefirst\expandafter{#1} + {\expandafter\removefistspace@i#1\@nil#1} + {}% +} +\expandafter\def\expandafter\removefistspace@i\space#1\@nil#2{% + \def#2{#1}% + \RL@removefirstspaces#2% +} +\edef\RL@restorecatcodezero{\catcode0=\number\catcode0\relax} +\catcode0=12 +\def\RL@removelastspaces#1{% + \expandafter\def\expandafter#1\expandafter{% + \romannumeral\expandafter + \RL@removelastspaces@i\expandafter\relax#1^^00 ^^00\@nil + }% +} +\def\RL@removelastspaces@i#1 ^^00{\RL@removelastspaces@ii#1^^00} +\def\RL@removelastspaces@ii#1^^00#2\@nil{% + \RL@ifspacefirst{#2} + {\RL@removelastspaces@i#1^^00 ^^00\@nil} + {\expandafter\z@\@gobble#1}% +} +\RL@restorecatcodezero +\catcode`\@=\RLAtCatcode\relax +\endinput +%% +%% End of file `randomlist.tex'. diff --git a/Master/texmf-dist/doc/generic/randomlist/test.pdf b/Master/texmf-dist/doc/generic/randomlist/test.pdf Binary files differnew file mode 100644 index 00000000000..c08079b1674 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/test.pdf diff --git a/Master/texmf-dist/doc/generic/randomlist/test.tex b/Master/texmf-dist/doc/generic/randomlist/test.tex new file mode 100644 index 00000000000..7e6f65519c7 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/test.tex @@ -0,0 +1,61 @@ +\documentclass{article} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[a4paper, margin=2.5cm, noheadfoot]{geometry} +\usepackage{amsmath} +\usepackage[seed=1]{randomlist} + +\pagestyle{empty} +\setlength{\parindent}{0pt} + +\NewList{Pupils} +\NewList{Triples} + +\begin{document} +\ReadFileList{Pupils}{pupils.dat} +\ExtractFirstItem{Pupils}{NULL} % extract title line +\ReadFileList{Triples}{pythagoras.dat} +\ForEachFirstItem{Pupils}{Pupil} +{% + \ReadFieldItem{\Pupil}{0}{Name} + \ReadFieldItem{\Pupil}{1}{FName} + \ReadFieldItem{\Pupil}{2}{Note} + \ExtractRandomItem{Triples}{Triple} + \ReadFieldItem{\Triple}{0}{Triplea} + \ReadFieldItem{\Triple}{1}{Tripleb} + \ReadFieldItem{\Triple}{2}{Triplec} + \begin{center} + \fbox{\huge\bfseries Test for \Name{} \FName} + \end{center} + \textbf{Exercise} \par + \if A\Note + The diagonal of a rectangle is \Triplec~in and a side of this + rectangle is \Triplea~in. What is the length of the other side of + the rectangle? + \else + Find the length of the diagonal of a rectangle that is \Triplea~in + by \Tripleb~in. + \fi + \newpage + \begin{center} + \fbox{\huge\bfseries Answer to the test for \Name{} \FName} + \end{center} + \textbf{Exercise} \par + \if A\Note + Use Pythagorean theorem. We have: + \[\text{diag}^2=\text{side1}^2+\text{side2}^2.\] + Here: + \[\Triplec^2=\Triplea^2+\text{side2}^2\] + and then + \[\text{side2}=\sqrt{\Triplec^2-\Triplea^2} = \Tripleb.\] + \else + Use Pythagorean theorem. We have: + \[\text{diag}^2=\text{side1}^2+\text{side2}^2.\] + Here: + \[\text{diag}^2=\Triplea^2+\Tripleb^2\] + and then + \[\text{diag}=\sqrt{\Triplea^2+\Tripleb^2} = \Triplec.\] + \fi + \newpage +} +\end{document} diff --git a/Master/texmf-dist/doc/generic/randomlist/testtex.pdf b/Master/texmf-dist/doc/generic/randomlist/testtex.pdf Binary files differnew file mode 100644 index 00000000000..9c48256423b --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/testtex.pdf diff --git a/Master/texmf-dist/doc/generic/randomlist/testtex.tex b/Master/texmf-dist/doc/generic/randomlist/testtex.tex new file mode 100644 index 00000000000..a03c8768974 --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/testtex.tex @@ -0,0 +1,96 @@ +\hsize=\dimexpr 21cm-2in \relax +\vsize=\dimexpr 29.7cm-2in \relax +\parindent 0pt + +\font\xviibf=cmbx17 +\font\xivbf=cmbx14 +\font\xivtt=cmtt14 + +\def\cmd#1{{\tentt \string#1}} +\def\Cmd#1{{\xivtt \string#1}} +\def\Par{\par\medskip} +\newcount\cntsection +\def\section#1{% + \par\bigskip + \advance \cntsection by 1 + {\xivbf \the\cntsection.\ #1} + \par\medskip +} + +\input randomlist + +%%% begin document %%% + +\centerline{\xviibf Torture test for pdftex and etex} +\par\vskip10mm + +\section{Test for \Cmd{\NewList} (and \Cmd{\ShowList})} + +\NewList{MyList} +\ShowList{MyList} + +\section{Tests for \Cmd{\Insert...}} + +With \cmd{\InsertFirstItem} +\InsertFirstItem{MyList}{first} +\InsertFirstItem{MyList}{second} +\InsertFirstItem{MyList}{third} +\InsertFirstItem{MyList}{fourth} +\ShowList{MyList} +\Par + +We test \cmd{\ClearList} since we'll use it many times: +\ClearList{MyList} +\ShowList{MyList} +\Par + +With \cmd{\InsertLastItem} +\InsertLastItem{MyList}{first} +\InsertLastItem{MyList}{second} +\InsertLastItem{MyList}{third} +\InsertLastItem{MyList}{fourth} +\ShowList{MyList} +\ClearList{MyList} +\Par + +With \cmd{\InsertItem} with indexes 0, 0, 2, 1 +\InsertItem{MyList}{0}{first} +\InsertItem{MyList}{0}{second} +\InsertItem{MyList}{2}{third} +\InsertItem{MyList}{1}{fourth} +\ShowList{MyList} +\ClearList{MyList} +\Par + +\RLsetrandomseed{3} +With \cmd{\InsertRandomItem} (seed = 3) +\InsertRandomItem{MyList}{first} +\InsertRandomItem{MyList}{second} +\InsertRandomItem{MyList}{third} +\InsertRandomItem{MyList}{fourth} +\ShowList{MyList} +\ClearList{MyList} +\Par + +\vfill\break +With \cmd{\InsertList} +\NewList{OtherList} +\InsertLastItem{MyList}{first of Mylist} +\InsertLastItem{MyList}{second of Mylist} +\InsertLastItem{MyList}{third of Mylist} +\InsertLastItem{MyList}{fourth of Mylist} +\InsertLastItem{OtherList}{first of Otherlist} +\InsertLastItem{OtherList}{second of Otherlist} +\InsertLastItem{OtherList}{third of Otherlist} +\InsertLastItem{OtherList}{fourth of Otherlist} +\ShowList{MyList} +\ShowList{OtherList} +Insertion at index 2 +\InsertList{MyList}{2}{OtherList} +\ShowList{MyList} +\ShowList{OtherList} +\ClearList{MyList} +\ClearList{OtherList} +\Par + +\bye |