summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-09-24 20:32:58 +0000
committerKarl Berry <karl@freefriends.org>2024-09-24 20:32:58 +0000
commit1f46c42e5f1ca82462f5f316117a62e64baae9c6 (patch)
tree6ae7a5a8f805eec9a130fe60286524ab5d69e2e5 /Master
parent831af2ada14b23669ef3d8328a4c406946976e18 (diff)
randintlist (24sep24)
git-svn-id: svn://tug.org/texlive/trunk@72374 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/randintlist/README.md6
-rw-r--r--Master/texmf-dist/doc/latex/randintlist/randintlist-doc.pdfbin0 -> 82179 bytes
-rw-r--r--Master/texmf-dist/doc/latex/randintlist/randintlist-doc.tex331
-rw-r--r--Master/texmf-dist/tex/latex/randintlist/randintlist.sty188
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds1
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/randintlist.tlpsrc0
8 files changed, 528 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/randintlist/README.md b/Master/texmf-dist/doc/latex/randintlist/README.md
new file mode 100644
index 00000000000..4cd0c343568
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/randintlist/README.md
@@ -0,0 +1,6 @@
+This package (like luarandom, but without the obligation to use lualatex) provides some macros for creating random integer number lists between a and b.
+This list can have multiple numbers or not, and this list can be sorted or not.
+--------------------------------------------------------------------------------------------------------------------------------------------------------
+Author..: Cédric Pierquet
+email...: cpierquet@outlook.fr
+Licence.: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/randintlist/randintlist-doc.pdf b/Master/texmf-dist/doc/latex/randintlist/randintlist-doc.pdf
new file mode 100644
index 00000000000..4d1e3e4d34b
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/randintlist/randintlist-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/randintlist/randintlist-doc.tex b/Master/texmf-dist/doc/latex/randintlist/randintlist-doc.tex
new file mode 100644
index 00000000000..1dbeec2aff3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/randintlist/randintlist-doc.tex
@@ -0,0 +1,331 @@
+% !TeX TXS-program:compile = txs:///arara
+% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}
+% arara: pdflatex: {shell: no, synctex: no, interaction: batchmode}
+
+\documentclass[11pt,a4paper]{ltxdoc}
+\usepackage{bera}
+\usepackage{inconsolata}
+\usepackage[T1]{fontenc}
+\usepackage[scale=0.875]{cabin}
+\usepackage{randintlist}
+\usepackage{fancyvrb}
+\usepackage{fancyhdr}
+\usepackage{tabularray}
+\usepackage{fontawesome5}
+\fancyhf{}
+\renewcommand{\headrulewidth}{0pt}
+\lfoot{\sffamily\small [randintlist]}
+\cfoot{\sffamily\small - \thepage{} -}
+\rfoot{\hyperlink{matoc}{\small\faArrowAltCircleUp[regular]}}
+\usepackage{hologo}
+\providecommand\tikzlogo{Ti\textit{k}Z}
+\providecommand\TeXLive{\TeX{}Live\xspace}
+\let\TikZ\tikzlogo
+
+\usepackage{hyperref}
+\urlstyle{same}
+\hypersetup{pdfborder=0 0 0}
+\usepackage[margin=2cm]{geometry}
+\setlength{\parindent}{0pt}
+\def\TPversion{0.1.0}
+\def\TPdate{23/09/2024}
+\usepackage{tcolorbox}
+\usepackage{pgffor}
+\tcbuselibrary{breakable,skins,hooks,listingsutf8}
+%\usepackage{soul}
+%\sethlcolor{lightgray!25}
+
+\lstset{
+ language=[LaTeX]TeX,%
+ basicstyle=\ttfamily,%
+ keywordstyle={\color{blue}},%
+ classoffset=0,%
+ keywords={},%
+ alsoletter={-},%
+ keywordstyle={\color{blue}},%
+ classoffset=1,%
+ alsoletter={-},%
+ morekeywords={euromoney},%
+ keywordstyle={\color{violet}},%
+ classoffset=2,%
+ alsoletter={-},%
+ morekeywords={\randintlist,\getitemfromrandintlist},%
+ keywordstyle={\color{green!50!black}},%
+ classoffset=3,%
+ morekeywords={min,max,nb,seed,sort,sep,repeat},%
+ keywordstyle={\color{orange}}
+}
+
+\newtcblisting{DemoCode}[1]{%
+ enhanced,width=\linewidth,%
+ bicolor,size=title,%
+ colback=cyan!10!white,%
+ colbacklower=cyan!5!white,%
+ colframe=cyan!75!black,%
+ listing options={%
+ breaklines=true,%
+ breakatwhitespace=true,%
+ style=tcblatex,basicstyle=\small\ttfamily,%
+ tabsize=4,%
+ commentstyle={\itshape\color{gray}},
+ keywordstyle={\color{blue}},%
+ classoffset=0,%
+ keywords={\usepackage,\includegraphics,xstring,listofitems,tikz,calc,simplekv,graphicx,\readlist,\showitems,\xintFor,\xintSeq},%
+ alsoletter={-},%
+ keywordstyle={\color{blue}},%
+ classoffset=1,%
+ alsoletter={-},%
+ morekeywords={euromoney},%
+ keywordstyle={\color{violet}},%
+ classoffset=2,%
+ alsoletter={-},%
+ morekeywords={\randintlist,\getitemfromrandintlist,\ListeRandint,\ExtraireEltListeRandint},%
+ keywordstyle={\color{green!50!black}},%
+ classoffset=3,%
+ morekeywords={min,max,nb,seed,sort,sep,repeat,Min,Max,Nb,Graine,Sep,Tri,Repet},%
+ keywordstyle={\color{orange}}
+ },%
+ #1
+}
+
+\newtcbinputlisting\DemoCodeFile[1]{%
+ enhanced,width=\linewidth,%
+ bicolor,size=title,%
+ colback=lightgray!10!white,%
+ colbacklower=lightgray!5!white,%
+ colframe=lightgray!75!black,%
+ listing options={%
+ breaklines=true,%
+ breakatwhitespace=true,%
+ style=tcblatex,
+ basicstyle=\scriptsize\ttfamily,%
+ tabsize=4,%
+ commentstyle={\itshape\color{gray}},%
+ lastline=113
+ },%
+ breakable,
+ listing only,%
+ listing file={#1}
+}
+
+\NewDocumentCommand\ShowCode{ m }{%
+ \lstinline{#1}%
+}
+
+\begin{document}
+
+\thispagestyle{empty}
+
+\begin{center}
+ \begin{minipage}{0.88\linewidth}
+ \begin{tcolorbox}[colframe=yellow,colback=yellow!15]
+ \begin{center}
+ \renewcommand{\arraystretch}{1.25}%
+ \begin{tabular}{c}
+ {\Huge \texttt{randintlist}}\\
+ \\
+ {\LARGE Creating random integer number lists,} \\
+ {\LARGE with multiple numbers or not,} \\
+ {\LARGE sorted or not.} \\
+ \\
+ {\small \texttt{Version \TPversion{} -- \TPdate}}
+ \end{tabular}
+ \end{center}
+ \end{tcolorbox}
+ \end{minipage}
+\end{center}
+
+\begin{center}
+ \begin{tabular}{c}
+ \texttt{Cédric Pierquet}\\
+ {\ttfamily c pierquet -- at -- outlook . fr}\\
+ \texttt{\url{https://github.com/cpierquet/randintlist}} \\
+ \end{tabular}
+\end{center}
+
+\hrule
+
+\vfill
+
+\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
+10 numbers, between 1 and 100, without repetition :
+
+\hfill\randintlist[min=1,max=100,nb=10]{\mylist}\textcolor{red}{\mylist}\hfill~
+
+The 5th value is :
+
+\hfill\textcolor{blue}{\getitemfromrandintlist{\mylist}{5}}\hfill~
+\end{tcolorbox}
+
+\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
+15 numbers, between 1 and 20, with repetition :
+
+\hfill\randintlist[min=1,max=20,nb=15,repeat]{\mylist}\textcolor{red}{\mylist}\hfill~
+
+The last value is :
+
+\hfill\textcolor{blue}{\getitemfromrandintlist{\mylist}{-1}}\hfill~
+\end{tcolorbox}
+
+\begin{tcolorbox}[colframe=lightgray,colback=lightgray!5]
+6 sorted numbers, between 1 and 51, without repetition :
+
+\hfill\randintlist[min=1,max=51,nb=6,sort=asc]{\mylist}ascending : \textcolor{red}{\mylist}\hfill~
+
+\hfill\randintlist[min=1,max=51,nb=6,sort=des,sep=>]{\mylist}descending : \textcolor{red}{\mylist}\hfill~
+\end{tcolorbox}
+
+\vfill~
+
+\hrule
+
+\medskip
+
+\emph{%
+ The \textsf{luarandom} package do the same things, but with the obligation to compile with \hologo{LuaLaTeX}.
+}
+
+\medskip
+
+\hrule
+
+\vspace*{5mm}
+
+\pagebreak
+
+\phantomsection
+
+\hypertarget{matoc}{}
+
+\tableofcontents
+
+\vspace*{5mm}
+
+%\hrule
+
+\pagebreak
+
+\section{Loading, useful packages}
+
+In order to load \texttt{randintlist}, simply use :
+
+\begin{DemoCode}{listing only}
+\usepackage{randintlist}
+\end{DemoCode}
+
+Loaded packages are \texttt{simplekv}, \texttt{listofitems}, \texttt{randomlist}, \texttt{xintexpr} and \texttt{xstring}
+
+\section{The Macros}
+
+\subsection{Global usage}
+
+Package \texttt{randintlist} supports the creation of random integer number lists where a number will appear only once or multiple times. Generated lists can te used with \texttt{listofitems}.
+
+\hfill\textbf{All engines \TeX\ are compatible with this package.}\hfill~
+
+\subsection{Generate the list}
+
+\begin{DemoCode}{listing only}
+%generate list
+\randintlist[keys]{\macro}
+\end{DemoCode}
+
+Available keys are :
+
+\begin{itemize}
+ \item \ShowCode{min} : minimum value (default \ShowCode{1}) ;
+ \item \ShowCode{max} : maximum value (default \ShowCode{50}) ;
+ \item \ShowCode{nb} : number of values (default \ShowCode{6}) ;
+ \item \ShowCode{sep} : separator for the list (default \ShowCode{,}) ;
+ \item \ShowCode{sort} : sorting options, within \ShowCode{no/asc/dec} (default \ShowCode{no}) ;
+ \item \ShowCode{repeat} : boolean to authorize repeating values (default \ShowCode{false}) ;
+ \item \ShowCode{seed} : random seed value according to used packages (default \ShowCode{-}).
+\end{itemize}
+
+\begin{DemoCode}{}
+%default values
+\randintlist{\mylistA}\mylistA
+\end{DemoCode}
+
+\begin{DemoCode}{}
+%10 between 1 and 50, with ascending
+\randintlist[sort=asc,min=1,max=50,nb=10]{\mylistB}\mylistB
+\end{DemoCode}
+
+\begin{DemoCode}{}
+%15 between 1 and 50, with ascending and repetitions allowed
+\randintlist[sort=asc,min=1,max=50,nb=15,repeat]{\mylistC}\mylistC
+\end{DemoCode}
+
+\begin{DemoCode}{}
+%list used with listofitems
+\randintlist{\mylistD}\mylistD\par
+\readlist*\mylistused{\mylistD}\showitems{\mylistused}\par
+\mylistused[1] ; \mylistused[-1]
+\end{DemoCode}
+
+\subsection{Accessing elements}
+
+\begin{DemoCode}{listing only}
+%accessing item
+\getitemfromrandintlist[separator]{\macro}{index}
+\end{DemoCode}
+
+\begin{DemoCode}{}
+%with default keys
+\randintlist{\mylistE}raw list : \mylistE\par
+items list :\par
+\xintFor* #1 in {\xintSeq{1}{6}}\do{\getitemfromrandintlist{\mylistE}{#1}\par}
+\getitemfromrandintlist{\mylistE}{1}
+\end{DemoCode}
+
+\subsection{Version française}
+
+Voilà les commandes en version française, la syntaxe et les clés ne seront pas explicitées.
+
+\begin{DemoCode}{listing only}
+%obtenir la liste
+\ListeRandint[Min=...,Max=...,Nb=...,Repet=...,Graine=...,Tri=...,Sep=...]{\macro}
+
+%extraire un élément
+\ExtraireEltListeRandint[sep]{\macro}{position}
+\end{DemoCode}
+
+\begin{DemoCode}{}
+%liste
+\ListeRandint[Min=5,Max=15,Nb=7,Repet,Tri=croiss,Sep={/}]{\maliste}\maliste
+
+%élément
+\ExtraireEltListeRandint[/]{\maliste}{4}
+\end{DemoCode}
+
+\pagebreak
+
+\section{Example}
+
+The following example uses \TikZ, and comes from \texttt{luarandom}'s documentation.
+
+\begin{DemoCode}{}
+\begin{tikzpicture}[scale=0.75]
+ \randintlist[min=1,max=100,nb=100]{\mylistsquare}
+ \draw[thin,gray] (0,0) grid (10,10) ;
+ \foreach \i in {1,...,100}{%
+ \xdef\tmpnumber{\getitemfromrandintlist{\mylistsquare}{\i}}%
+ \xdef\tmpnumberrow{\xinteval{\xintiiRem{\i-1}{10}}}%
+ \xdef\tmpnumbercol{\xinteval{\xintiiQuo{\i-1}{10}}}%
+ \draw ({0.5+\tmpnumbercol},{0.5+\tmpnumberrow}) node {\tmpnumber} ;
+ }%
+\end{tikzpicture}
+\end{DemoCode}
+
+\pagebreak
+
+\section{History}
+
+\texttt{0.1.0 : Initial version}
+
+\section{The code}
+
+\DemoCodeFile{randintlist.sty}
+
+\end{document}
diff --git a/Master/texmf-dist/tex/latex/randintlist/randintlist.sty b/Master/texmf-dist/tex/latex/randintlist/randintlist.sty
new file mode 100644
index 00000000000..87ed2de0221
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/randintlist/randintlist.sty
@@ -0,0 +1,188 @@
+% Author : C. Pierquet
+% licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{randintlist}[2024/09/23 0.1.0 Create a list of random numbers with or without multiple values]
+
+%------History
+% 0.1.0 Initial version
+
+%------Packages
+\RequirePackage{simplekv}
+\RequirePackage{listofitems}
+\RequirePackage{randomlist}
+\RequirePackage{xintexpr}
+\RequirePackage{xstring}
+
+%-----Macros for sorting and seed
+\ExplSyntaxOn
+\cs_new_eq:NN \randintseed \sys_gset_rand_seed:n
+\NewDocumentCommand\intascsortlist{m}
+{
+ \clist_sort:Nn #1
+ {
+ \fp_compare:nNnTF {##1} > {##2}
+ { \sort_return_swapped: }
+ { \sort_return_same: }
+ }
+}
+\NewDocumentCommand\intdessortlist{m}
+{
+ \clist_sort:Nn #1
+ {
+ \fp_compare:nNnTF {##1} < {##2}
+ { \sort_return_swapped: }
+ { \sort_return_same: }
+ }
+}
+\ExplSyntaxOff
+
+%----Macro for generating
+\defKV[randomlistintegers]{%
+ min=\def\TAEEmin{#1},%
+ max=\def\TAEEmax{#1},%
+ nb=\def\TAEEnb{#1},%
+ sep=\def\TAEEsep{#1},%
+ sort=\def\TAEEtri{#1},%
+ seed=\def\TAEEseed{#1}
+}
+
+\setKVdefault[randomlistintegers]{%
+ min=1,%
+ max=50,%
+ nb=6,%
+ sep={,},%
+ sort=no,%
+ repeat=false,%
+ seed={-}
+}
+
+\NewList{tmprandintlist}
+
+\NewDocumentCommand\randintlist{ O{} m }{%1=keys,2=listname
+ \useKVdefault[randomlistintegers]%
+ \setKV[randomlistintegers]{#1}%
+ \ifboolKV[randomlistintegers]{repeat}%repeat or not
+ {%repeat allowed
+ \IfStrEq{\TAEEseed}{-}%
+ {}%
+ {%
+ \randintseed{\TAEEseed}%
+ }%
+ %list creation (first then other)
+ \xdef#2{\fpeval{randint(\TAEEmin,\TAEEmax)}}%
+ \xintFor* ##1 in {\xintSeq{2}{\TAEEnb}}%
+ \do{\xdef#2{#2,\fpeval{randint(\TAEEmin,\TAEEmax)}}}%
+ }%
+ {%no repeating
+ %randomize numbers
+ \IfStrEq{\TAEEseed}{-}%
+ {}%
+ {%
+ \RLsetrandomseed{\TAEEseed}%
+ }%
+ \ClearList{tmprandintlist}%clearing the list
+ \xintFor* ##1 in {\xintSeq{\TAEEmin}{\TAEEmax}}%
+ \do{\InsertRandomItem{tmprandintlist}{##1}}%
+ %list creation (first then other)
+ \xdef#2{\tmprandintlist[0]}%
+ \xintFor* ##1 in {\xintSeq{1}{\TAEEnb-1}}%
+ \do{\xdef#2{#2,\tmprandintlist[##1]}}%
+ }%
+ %sorting
+ \IfStrEq{\TAEEtri}{asc}%if ascending
+ {\intascsortlist{#2}}%
+ {}%
+ \IfStrEq{\TAEEtri}{des}%if descending
+ {\intdessortlist{#2}}%
+ {}%
+ \StrSubstitute{#2}{,}{\TAEEsep}[#2]%swipping separator if necessary
+}
+
+%-----Macro for extracting
+\NewDocumentCommand\getitemfromrandintlist{ O{,} m m }{%
+ \IfEq{#1}{/}%
+ {%
+ \setsepchar[.]{#1}%
+ }%
+ {%
+ \setsepchar{#1}%
+ }%
+ \readlist*\TMPLISTRANDINT{#2}%
+ \TMPLISTRANDINT[#3]%
+}
+
+%-----french version
+\defKV[randomlisteentiers]{%
+ Min=\def\TAEEmin{#1},%
+ Max=\def\TAEEmax{#1},%
+ Nb=\def\TAEEnb{#1},%
+ Sep=\def\TAEEsep{#1},%
+ Tri=\def\TAEEtri{#1},%
+ Graine=\def\TAEEseed{#1}
+}
+
+\setKVdefault[randomlisteentiers]{%
+ Min=1,%
+ Max=50,%
+ Nb=6,%
+ Sep={,},%
+ Tri=non,%
+ Repet=false,%
+ Graine={-}
+}
+
+\NewDocumentCommand\ListeRandint{ O{} m }{%1=keys,2=listname
+ \useKVdefault[randomlisteentiers]%
+ \setKV[randomlisteentiers]{#1}%
+ \ifboolKV[randomlisteentiers]{Repet}%repeat or not
+ {%repeat allowed
+ \IfStrEq{\TAEEseed}{-}%
+ {}%
+ {%
+ \randintseed{\TAEEseed}%
+ }%
+ %list creation (first then other)
+ \xdef#2{\fpeval{randint(\TAEEmin,\TAEEmax)}}%
+ \xintFor* ##1 in {\xintSeq{2}{\TAEEnb}}%
+ \do{\xdef#2{#2,\fpeval{randint(\TAEEmin,\TAEEmax)}}}%
+ }%
+ {%no repeating
+ %randomize numbers
+ \IfStrEq{\TAEEseed}{-}%
+ {}%
+ {%
+ \RLsetrandomseed{\TAEEseed}%
+ }%
+ \ClearList{tmprandintlist}%clearing the list
+ \xintFor* ##1 in {\xintSeq{\TAEEmin}{\TAEEmax}}%
+ \do{\InsertRandomItem{tmprandintlist}{##1}}%
+ %list creation (first then other)
+ \xdef#2{\tmprandintlist[0]}%
+ \xintFor* ##1 in {\xintSeq{1}{\TAEEnb-1}}%
+ \do{\xdef#2{#2,\tmprandintlist[##1]}}%
+ }%
+ %sorting
+ \IfStrEq{\TAEEtri}{croiss}%if ascending
+ {\intascsortlist{#2}}%
+ {}%
+ \IfStrEq{\TAEEtri}{decroiss}%if descending
+ {\intdessortlist{#2}}%
+ {}%
+ \StrSubstitute{#2}{,}{\TAEEsep}[#2]%swipping separator if necessary
+}
+
+%-----Macro for extracting
+\NewDocumentCommand\ExtraireEltListeRandint{ O{,} m m }{%
+ \IfEq{#1}{/}%
+ {%
+ \setsepchar[.]{#1}%
+ }%
+ {%
+ \setsepchar{#1}%
+ }%
+ \readlist*\TMPLISTRANDINT{#2}%
+ \TMPLISTRANDINT[#3]%
+}
+
+\endinput \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 6c0f4ebe1b2..30e830c8b2c 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -730,7 +730,7 @@ my @TLP_working = qw(
quickreaction quicktype quiver quiz2socrative quizztex
quotchap quoting quotmark
quran quran-bn quran-de quran-en quran-es quran-id quran-ur qyxf-book
- r_und_s ragged2e raleway ran_toks randbild randexam
+ r_und_s ragged2e raleway ran_toks randbild randexam randintlist
random randomlist randomwalk randtext
rank-2-roots rbt-mathnotes rccol rcs rcs-multi rcsinfo
readablecv readarray realboxes realhats realscripts realtranspose rec-thy
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 2695e25956a..8e48561214e 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -1871,6 +1871,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`);
'quran-en' => '&POST_onelevel',
'quran-es' => '&POST_onelevel',
'quran-id' => '&POST_onelevel',
+ 'randintlist' => '&POST_onelevel',
'recipebook' => '&POST_rmsymlink',
'regulatory' => '&POST_onelevel',
'resolsysteme' => '&POST_onelevel',
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index e02576500b3..1d0f47bbdc5 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -1170,6 +1170,7 @@ depend quoting
depend quotmark
depend ran_toks
depend randexam
+depend randintlist
depend randtext
depend rccol
depend rcs-multi
diff --git a/Master/tlpkg/tlpsrc/randintlist.tlpsrc b/Master/tlpkg/tlpsrc/randintlist.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/randintlist.tlpsrc