From 645fea73b8e358e5c54f71495e375bce13497714 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 12 Sep 2017 22:16:46 +0000 Subject: randomlist (12sep17) git-svn-id: svn://tug.org/texlive/trunk@45281 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/randomlist/Makefile | 28 ++++++++-- .../doc/generic/randomlist/randomlist.pdf | Bin 210731 -> 200637 bytes .../texmf-dist/doc/generic/randomlist/test-fr.pdf | Bin 0 -> 119908 bytes .../texmf-dist/doc/generic/randomlist/test-fr.tex | 62 +++++++++++++++++++++ Master/texmf-dist/doc/generic/randomlist/test.pdf | Bin 116659 -> 116659 bytes .../texmf-dist/doc/generic/randomlist/testtex.pdf | Bin 46147 -> 46147 bytes .../source/generic/randomlist/randomlist.dtx | 42 ++++++++------ .../tex/generic/randomlist/randomlist.sty | 6 +- .../tex/generic/randomlist/randomlist.tex | 34 +++++------ 9 files changed, 128 insertions(+), 44 deletions(-) create mode 100644 Master/texmf-dist/doc/generic/randomlist/test-fr.pdf create mode 100644 Master/texmf-dist/doc/generic/randomlist/test-fr.tex diff --git a/Master/texmf-dist/doc/generic/randomlist/Makefile b/Master/texmf-dist/doc/generic/randomlist/Makefile index 150f1af3a59..06d3905dce8 100644 --- a/Master/texmf-dist/doc/generic/randomlist/Makefile +++ b/Master/texmf-dist/doc/generic/randomlist/Makefile @@ -1,6 +1,6 @@ base=randomlist -default: package doc test # package ou class -final: package doc-final test +default: package doc doc-fr test test-fr # package ou class +final: package doc-final doc-fr-final test test-fr package: $(base).sty $(base).sty: $(base).ins $(base).dtx @@ -26,16 +26,32 @@ doc-final: ps2pdf $(base).ps $(base).pdf rm $(base).dvi $(base).ps +doc-fr: $(base)-doc-fr.pdf +$(base)-doc-fr.pdf: $(base)-doc-fr.tex + latex '\nonstopmode \input $(base)-doc-fr' + dvips $(base)-doc-fr + ps2pdf $(base)-doc-fr.ps $(base)-doc-fr.pdf + rm $(base)-doc-fr.dvi $(base)-doc-fr.ps + +doc-fr-final: + latex '\nonstopmode \input $(base)-doc-fr' + latex '\nonstopmode \input $(base)-doc-fr' + makeindex -s gind.ist -o $(base)-doc-fr.ind $(base)-doc-fr.idx + latex '\nonstopmode \input $(base)-doc-fr' + dvips $(base)-doc-fr + ps2pdf $(base)-doc-fr.ps $(base)-doc-fr.pdf + rm $(base)-doc-fr.dvi $(base)-doc-fr.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' +test-fr: randomlist.tex test-fr.tex + pdflatex '\nonstopmode \input test-fr.tex' clean: - rm -rf *~ *.aux *.dvi *.glo *.gls *.idx *.ilg *.ind *.log *.out *.ps *.toc + rm -rf *~ *.aux *.dvi *.ps *.glo *.gls *.idx *.ilg *.ind *.log *.out *.tmp *.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/ + cd .. ; zip $(base).zip randomlist/$(base).dtx randomlist/$(base).ins randomlist/$(base).pdf randomlist/$(base).tex randomlist/$(base).sty randomlist/README.txt randomlist/Makefile randomlist/comets.dat randomlist/pupils.dat randomlist/pythagoras.dat randomlist/test.tex randomlist/test.pdf randomlist/test-fr.tex randomlist/test-fr.pdf randomlist/testtex.tex randomlist/testtex.pdf; mv $(base).zip randomlist/ diff --git a/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf b/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf index 3d9f046267a..e8082464b08 100644 Binary files a/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf and b/Master/texmf-dist/doc/generic/randomlist/randomlist.pdf differ diff --git a/Master/texmf-dist/doc/generic/randomlist/test-fr.pdf b/Master/texmf-dist/doc/generic/randomlist/test-fr.pdf new file mode 100644 index 00000000000..3bcc3eab063 Binary files /dev/null and b/Master/texmf-dist/doc/generic/randomlist/test-fr.pdf differ diff --git a/Master/texmf-dist/doc/generic/randomlist/test-fr.tex b/Master/texmf-dist/doc/generic/randomlist/test-fr.tex new file mode 100644 index 00000000000..5df70c0b06b --- /dev/null +++ b/Master/texmf-dist/doc/generic/randomlist/test-fr.tex @@ -0,0 +1,62 @@ +\documentclass{article} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[a4paper, margin=2.5cm, noheadfoot]{geometry} +\usepackage{amsmath} +\usepackage[seed=1]{randomlist} +\usepackage[french]{babel} + +\pagestyle{empty} +\setlength{\parindent}{0pt} + +\NewList{Eleves} +\NewList{Triplets} + +\begin{document} +\ReadFileList{Eleves}{pupils.dat} +\ExtractFirstItem{Eleves}{NULL} % retire la ligne de titre +\ReadFileList{Triplets}{pythagoras.dat} +\ForEachFirstItem{Eleves}{Eleve} +{% + \ReadFieldItem{\Eleve}{0}{Nom} + \ReadFieldItem{\Eleve}{1}{Prenom} + \ReadFieldItem{\Eleve}{2}{Note} + \ExtractRandomItem{Triplets}{Triplet} + \ReadFieldItem{\Triplet}{0}{Tripleta} + \ReadFieldItem{\Triplet}{1}{Tripletb} + \ReadFieldItem{\Triplet}{2}{Tripletc} + \begin{center} + \fbox{\huge\bfseries Devoir pour \Nom{} \Prenom} + \end{center} + \textbf{Exercise} \par + \if A\Note + La diagonale d'un rectangle fait \Tripletc\,cm et un des côtés de + ce rectangle fait \Tripleta\,cm. Quelle est la longueur de l'autre + côté du rectangle ? + \else + Calculer la longueur de la diagonale d'un rectangle de + \Tripleta\,cm sur \Tripletb\,cm. + \fi + \newpage + \begin{center} + \fbox{\huge\bfseries Corrigé du devoir de \Nom{} \Prenom} + \end{center} + \textbf{Exercise} \par + \if A\Note + Il faut utiliser le théorème de Pythagore. On a : + \[\text{diagonale}^2=\text{côté}_1^2+\text{côté}_2^2.\] + Donc : + \[\Tripletc^2=\Tripleta^2+\text{côté}_2^2\] + et donc : + \[\text{côté}_2=\sqrt{\Tripletc^2-\Tripleta^2} = \Tripletb.\] + \else + Avec le théorème de Pythagore, on a : + \[\text{diagonale}^2=\text{côté}_1^2+\text{côté}_2^2.\] + Here: + \[\text{diagonale}^2=\Tripleta^2+\Tripletb^2\] + and then + \[\text{diagonale}=\sqrt{\Tripleta^2+\Tripletb^2} = \Tripletc.\] + \fi + \newpage +} +\end{document} diff --git a/Master/texmf-dist/doc/generic/randomlist/test.pdf b/Master/texmf-dist/doc/generic/randomlist/test.pdf index c08079b1674..83db987eda3 100644 Binary files a/Master/texmf-dist/doc/generic/randomlist/test.pdf and b/Master/texmf-dist/doc/generic/randomlist/test.pdf differ diff --git a/Master/texmf-dist/doc/generic/randomlist/testtex.pdf b/Master/texmf-dist/doc/generic/randomlist/testtex.pdf index 9c48256423b..50a4e60d9cb 100644 Binary files a/Master/texmf-dist/doc/generic/randomlist/testtex.pdf and b/Master/texmf-dist/doc/generic/randomlist/testtex.pdf differ diff --git a/Master/texmf-dist/source/generic/randomlist/randomlist.dtx b/Master/texmf-dist/source/generic/randomlist/randomlist.dtx index f1d08d33d14..d62192fd45d 100644 --- a/Master/texmf-dist/source/generic/randomlist/randomlist.dtx +++ b/Master/texmf-dist/source/generic/randomlist/randomlist.dtx @@ -1,10 +1,10 @@ % \iffalse % %% randomlist.dtx -%% Copyleft 2013-2016 J.-C. Charpentier & C. Tellechea +%% Copyleft 2013-2017 J.-C. Charpentier & C. Tellechea % %% Packages `randomlist' to use with (La)eTeX -%% Copyleft (L) 2013-2016 Jean-C\^ome Charpentier & Christian Tellechea. +%% Copyleft (L) 2013-2017 Jean-C\^ome Charpentier & Christian Tellechea. % \fi % %% \CharacterTable @@ -77,6 +77,9 @@ \newcommand*\environ[1]{\texttt{#1}} \newcommand*\Environ[1]{\texttt{#1}\index{#1=\texttt{#1}}} \makeatletter +\edef\quotechar{\string!} +\edef\actualchar{\string=} +\edef\verbatimchar{\string+} \def\SpecialPageIndex#1{% \immediate\write\@indexfile{% \string\indexentry{\expandafter\@gobble\string#1\actualchar @@ -1140,6 +1143,9 @@ This file use lines which aren't data lines and weird separator. % \changes{v1.2}{2016/07/13}{% % First public release. % } +% \changes{v1.3}{2017/09/11}{% +% Random operations are \global. +% } % \CheckSum{0} % \iffalse %<*latex> @@ -1150,7 +1156,7 @@ This file use lines which aren't data lines and weird separator. % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1995/06/01] \ProvidesPackage{randomlist} - [2016/07/13 v1.2 Package for random list (JCC, CT)] + [2017/09/11 v1.3 Package for random list (JCC, CT)] % \end{macrocode} % \LaTeX's wrapper has the possibility to use option. There is only % one option: the seed one. It requires the \package{(x)keyval} package. @@ -1326,9 +1332,9 @@ This file use lines which aren't data lines and weird separator. \newcount\RL@random@b \def\RLsetrandomseed#1{% \ifnum#1=0 - \RL@random \numexpr \time + \year * \month * \day \relax + \global\RL@random \numexpr \time + \year * \month * \day \relax \else - \RL@random \numexpr \ifnum#1<0 -\fi#1 \relax + \global\RL@random \numexpr \ifnum#1<0 -\fi#1 \relax \fi } % \end{macrocode} @@ -1362,19 +1368,19 @@ This file use lines which aren't data lines and weird separator. % \[x_{n+1} = 7^5(x_n \pmod{q}) - r\times\mathrm{E}\left(\frac{x_n}{q}\right).\] % If $x_{n+1} < 0$ then $x_{n+1} = x_{n+1} + 2^{31}-1$ % \begin{macrocode} - \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 + \global\RL@random@a=\RL@random + \global\divide\RL@random@a 127773 + \global\RL@random@b=\RL@random@a + \global\multiply\RL@random@a -2836 + \global\multiply\RL@random@b -127773 + \global\advance\RL@random\RL@random@b + \global\multiply\RL@random 16807 + \global\advance\RL@random\RL@random@a % \end{macrocode} % If random number is negative add $2^{31}-1$. % \begin{macrocode} \ifnum\RL@random<0 - \advance\RL@random 2147483647 + \global\advance\RL@random 2147483647 \fi } % \end{macrocode} @@ -1391,10 +1397,10 @@ This file use lines which aren't data lines and weird separator. % \end{macrocode} % Compute $|\RL@random| \pmod{\mathtt{\string#1}}$. % \begin{macrocode} - \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 + \global\RL@random@a=\RL@random + \global\RL@random@b=\RL@random + \global\divide\RL@random@a \numexpr#1\relax + \global\RL@random@b \numexpr\RL@random@b - \RL@random@a * (#1)\relax \expandafter\edef\csname #2\endcsname{\number\RL@random@b}% }% % \end{macrocode} diff --git a/Master/texmf-dist/tex/generic/randomlist/randomlist.sty b/Master/texmf-dist/tex/generic/randomlist/randomlist.sty index 30cb94e7500..da72a3f65f1 100644 --- a/Master/texmf-dist/tex/generic/randomlist/randomlist.sty +++ b/Master/texmf-dist/tex/generic/randomlist/randomlist.sty @@ -7,9 +7,9 @@ %% randomlist.dtx (with options: `latex') %% %% randomlist.dtx -%% Copyleft 2013-2016 J.-C. Charpentier & C. Tellechea +%% Copyleft 2013-2017 J.-C. Charpentier & C. Tellechea %% Packages `randomlist' to use with (La)eTeX -%% Copyleft (L) 2013-2016 Jean-C\^ome Charpentier & Christian Tellechea. +%% Copyleft (L) 2013-2017 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 @@ -28,7 +28,7 @@ %% \NeedsTeXFormat{LaTeX2e}[1995/06/01] \ProvidesPackage{randomlist} - [2016/07/13 v1.2 Package for random list (JCC, CT)] + [2017/09/11 v1.3 Package for random list (JCC, CT)] \RequirePackage{xkeyval} \DeclareOptionX{seed}{\gdef\RL@seed{#1}} \ExecuteOptions{seed=0} diff --git a/Master/texmf-dist/tex/generic/randomlist/randomlist.tex b/Master/texmf-dist/tex/generic/randomlist/randomlist.tex index 80832ce90c5..74a6d26422a 100644 --- a/Master/texmf-dist/tex/generic/randomlist/randomlist.tex +++ b/Master/texmf-dist/tex/generic/randomlist/randomlist.tex @@ -7,9 +7,9 @@ %% randomlist.dtx (with options: `tex') %% %% randomlist.dtx -%% Copyleft 2013-2016 J.-C. Charpentier & C. Tellechea +%% Copyleft 2013-2017 J.-C. Charpentier & C. Tellechea %% Packages `randomlist' to use with (La)eTeX -%% Copyleft (L) 2013-2016 Jean-C\^ome Charpentier & Christian Tellechea. +%% Copyleft (L) 2013-2017 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 @@ -98,9 +98,9 @@ \newcount\RL@random@b \def\RLsetrandomseed#1{% \ifnum#1=0 - \RL@random \numexpr \time + \year * \month * \day \relax + \global\RL@random \numexpr \time + \year * \month * \day \relax \else - \RL@random \numexpr \ifnum#1<0 -\fi#1 \relax + \global\RL@random \numexpr \ifnum#1<0 -\fi#1 \relax \fi } \ifx\RL@seed\@undefined @@ -109,24 +109,24 @@ \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 + \global\RL@random@a=\RL@random + \global\divide\RL@random@a 127773 + \global\RL@random@b=\RL@random@a + \global\multiply\RL@random@a -2836 + \global\multiply\RL@random@b -127773 + \global\advance\RL@random\RL@random@b + \global\multiply\RL@random 16807 + \global\advance\RL@random\RL@random@a \ifnum\RL@random<0 - \advance\RL@random 2147483647 + \global\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 + \global\RL@random@a=\RL@random + \global\RL@random@b=\RL@random + \global\divide\RL@random@a \numexpr#1\relax + \global\RL@random@b \numexpr\RL@random@b - \RL@random@a * (#1)\relax \expandafter\edef\csname #2\endcsname{\number\RL@random@b}% }% \newtoks\@ListOfList -- cgit v1.2.3