texlive[59919] Master: macrolist (13jul21)

commits+karl at tug.org commits+karl at tug.org
Tue Jul 13 22:03:55 CEST 2021


Revision: 59919
          http://tug.org/svn/texlive?view=revision&revision=59919
Author:   karl
Date:     2021-07-13 22:03:54 +0200 (Tue, 13 Jul 2021)
Log Message:
-----------
macrolist (13jul21)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/macrolist/
    trunk/Master/texmf-dist/doc/latex/macrolist/README.md
    trunk/Master/texmf-dist/doc/latex/macrolist/macrolist.pdf
    trunk/Master/texmf-dist/source/latex/macrolist/
    trunk/Master/texmf-dist/source/latex/macrolist/macrolist.dtx
    trunk/Master/texmf-dist/source/latex/macrolist/macrolist.ins
    trunk/Master/texmf-dist/tex/latex/macrolist/
    trunk/Master/texmf-dist/tex/latex/macrolist/macrolist.sty
    trunk/Master/tlpkg/tlpsrc/macrolist.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/macrolist/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/macrolist/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/macrolist/README.md	2021-07-13 20:03:54 UTC (rev 59919)
@@ -0,0 +1,37 @@
+# The LaTeX package macrolist - version 1.0.0 (2021/07/12)
+
+> Copyright (C) 2021 Dennis Chen <proofprogram at gmail.com>
+>
+> This file may be distributed and/or modified under
+> the conditions the LaTeX Project Public License (LPPL),
+> either version 1.3 of this license or (at your option)
+> any later version. The latest version of this license
+> can be found in
+> http://www.latex-project.org/lppl.txt
+> and version 1.3 or later is part of all distributions of LaTeX
+> version 2005/12/01 or later.
+
+`macrolist` provides lists and common list functions, such as `add`, `remove`, `foreach`, as well as `removelast` and `join`.
+
+## Package contents
+
+- `README.md` this file
+- `macrolist.pdf` documentation PDF with implementation details
+- `macrolist.dtx` contains package and documentation code
+- `macrolist.ins` generates .sty from .dtx
+
+## File generation
+
+A working TeX installation is required.
+
+Run
+
+    tex macrolist.ins
+
+to generate `macrolist.sty`. To use it, you need to put `macrolist.sty` into a directory searched by TeX.
+
+Run
+
+    pdflatex macrolist.dtx
+
+to generate `macrolist.pdf`, which contains the package documentation.


Property changes on: trunk/Master/texmf-dist/doc/latex/macrolist/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/macrolist/macrolist.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/macrolist/macrolist.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/macrolist/macrolist.pdf	2021-07-13 20:02:54 UTC (rev 59918)
+++ trunk/Master/texmf-dist/doc/latex/macrolist/macrolist.pdf	2021-07-13 20:03:54 UTC (rev 59919)

Property changes on: trunk/Master/texmf-dist/doc/latex/macrolist/macrolist.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/macrolist/macrolist.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/macrolist/macrolist.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/macrolist/macrolist.dtx	2021-07-13 20:03:54 UTC (rev 59919)
@@ -0,0 +1,325 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2021 Dennis Chen <proofprogram at gmail.com>
+%
+% This file may be distributed and/or modified under
+% the conditions the LaTeX Project Public License (LPPL),
+% either version 1.3 of this license or (at your option)
+% any later version. The latest version of this license
+% can be found in
+%   http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+% \fi
+%
+% \iffalse
+%<*package>
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{macrolist}[2021/07/09 v1.0.0 Create lists of macros and perform operations on them]
+
+\RequirePackage{pgffor}
+%</package>
+
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{macrolist}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+    \DocInput{macrolist.dtx}
+    \PrintIndex
+\end{document}
+%</driver>
+% \fi
+% \changes{v1.0.0}{2021/07/01}{Initial version}
+%
+% \GetFileInfo{macrolist.sty}
+%
+% \title{\textsf{macrolist} -- Create lists of macros and manipulate them}
+% \author{Dennis Chen \\ proofprogram at gmail.com}
+% \date{\fileversion, v. \filedate\thanks{\url{https://github/com/chennisden/macrolist}}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% The \textsf{macrolist} package allows you to create lists and manipulate them, with utilities such as |\listforeach| and an implementation of arr.join() from Javascript. Contrary to the name of the package, non-macros and groups of macros can be put into an item of the list.
+% \end{abstract}
+%
+% \section{Usage}
+%
+% \DescribeMacro{\newlist}
+% To create a list, pass in |\newlist{listname}| to create a list with the name \textsf{listname}.
+%
+% The package checks that \textsf{listname} is not the name of another list, and will throw an error if another list \textsf{listname} has already been defined.
+%
+% \iffalse
+\newcommand{\newlist}[1]{
+    \ifcsname c at macrolist@list@#1\endcsname
+        \PackageError{macrolist}{The list '#1' is already defined}{}
+    \else
+        \newcounter{macrolist at list@#1}
+        \setcounter{macrolist at list@#1}{0}
+    \fi
+}
+% \fi
+%
+% \DescribeMacro{\listelement}
+%
+% To execute the \textsf{i}th element of \textsf{listname}, write |\listelement{listname}{i}|. Note that \textit{lists are 1-indexed}, meaning the first element is numbered 1, the second element numbered 2, and so on.
+%
+% An error will be thrown if \textsf{listname} is not a defined list, if \textsf{i} is empty, or if \textsf{i} is greater than the size of the list.
+%
+% \iffalse
+\newcommand{\listelement}[2]{%
+    \macrolist at inbounds{#1}{#2}%
+    \csname macrolist at list@#1\the\numexpr #2\relax\endcsname%
+}
+% \fi
+%
+% \DescribeMacro{\listadd}
+%
+% To add something to the list \textsf{listname}, pass in |\listadd{listname}[position]{element}|, where \textsf{position} is an optional argument. If nothing is passed in for \textsf{position}, then by default \textsf{element} will be added to the end of the list.
+%
+% \iffalse
+\newcommand{\listadd}[1]{
+    \macrolist at exists{#1}
+    \def\macrolist at currlist{#1}
+    \macrolist at listadd
+}
+%% We write \listadd this way such that the optional argument will be positioned correctly
+\newcommand{\macrolist at listadd}[2][]{
+    \stepcounter{macrolist at list@\macrolist at currlist}
+
+    \if\relax\detokenize{#1}\relax
+        \expandafter\def\csname macrolist at list@\macrolist at currlist\listsize{\macrolist at currlist}\endcsname{#2}
+    \else
+        \expandafter\ifnum\csname themacrolist at list@\macrolist at currlist\endcsname=#1
+            \expandafter\def\csname macrolist at list@\macrolist at currlist\listsize{\macrolist at currlist}\endcsname{#2}
+        \else
+            \macrolist at inbounds{\macrolist at currlist}{#1}
+            \foreach \macrolist at index in {\listsize{\macrolist at currlist}, ...,\the\numexpr #1+1\relax} {
+                \global\expandafter\let\csname macrolist at list@\macrolist at currlist\macrolist at index\expandafter\endcsname\csname macrolist at list@\macrolist at currlist\the\numexpr\macrolist at index-1\relax\endcsname
+            }
+            \expandafter\def\csname macrolist at list@\macrolist at currlist#1\endcsname{#2}
+        \fi
+    \fi
+}
+% \fi
+%
+% \DescribeMacro{\listremove}
+%
+% To remove an element in a list, write |\listremove{listname}{index}|.
+%
+% \iffalse
+\newcommand{\listremove}[2]{
+    \macrolist at inbounds{#1}{#2}
+
+    \ifnum\numexpr#2\relax=\listsize{#1}
+    \else
+        \foreach \macrolist at index in {#2, ..., \the\numexpr\listsize{#1}-1\relax} {
+            \global\expandafter\let\csname macrolist at list@#1\macrolist at index\expandafter\endcsname\csname macrolist at list@#1\the\numexpr\macrolist at index+1\endcsname
+        }
+    \fi
+
+    \expandafter\let\csname macrolist at list@#1\listsize{#1}\endcsname\relax
+    \addtocounter{macrolist at list@#1}{-1}
+}
+% \fi
+%
+% \DescribeMacro{\listremovelast}
+%
+% To remove the last element in a list, write |\listremovelast{listname}|. This behaves like C++'s |pop_back|.
+%
+% \iffalse
+\newcommand{\listremovelast}[1]{
+    \macrolist at exists{#1}
+    \expandafter\let\csname macrolist at list@#1\listsize{#1}\endcsname\relax
+    \addtocounter{macrolist at list@#1}{-1}
+}
+% \fi
+%
+% \DescribeMacro{\listclear}
+%
+% To clear a list, write |\listclear{listname}|.
+%
+% \iffalse
+\newcommand{\listclear}[2]{
+    \macrolist at inbounds{#1}{#2}
+
+    \foreach \macrolist at index in {1, ..., \listsize{#1}} {
+        \expandafter\let\csname \macrolist at list@#1\macrolist at index\endcsname\relax
+    }
+
+    \setcounter{macrolist at list@#1}{0}
+}
+% \fi
+%
+% \DescribeMacro{\listsize}
+%
+% To get the size of a list, write |\listsize{listname}|.
+%
+% \iffalse
+\newcommand*{\listsize}[1]{%
+    \macrolist at exists{#1}%
+    \csname themacrolist at list@#1\endcsname
+}
+% \fi
+%
+% \DescribeMacro{\listforeach}
+%
+% To write a for each loop, write
+% \begin{verbatim}
+%\begin{listforeach}{listname}{\element}[begin][end]{action}
+% \end{verbatim}
+%
+%
+% Note that begin and end are optional arguments, and by default, they take the values \textsf{1} and |\listsize{listname}|. If you pass in \textsf{begin}, you must also pass in \textsf{end}.
+%
+% \iffalse
+\newcommand{\listforeach}[2]
+{
+    \def\macrolist at foreachstart{0} % Reset
+    % This is used to make optional arguments line up correctly
+
+    \def\macrolist at start{1}
+    \def\macrolist at end{\listsize{#1}}
+    \def\macrolist at listname{#1}
+    \def\macrolist at element{#2}
+    \macrolist at listforeachi
+}
+
+\newcommand{\macrolist at listforeachi}[1][]{
+    \if\relax\detokenize{#1}\relax
+    \else
+        \def\macrolist at start{#1}
+        \def\macrolist at foreachstart{1}
+    \fi
+    \macrolist at listforeachii
+}
+
+\newcommand{\macrolist at listforeachii}[1][]{
+    \if\relax\detokenize{#1}\relax
+        \ifnum\macrolist at foreachstart=1
+            \PackageError{macrolist}{You must either pass in both a starting and ending position or neither}{}
+        \fi
+    \else
+        \def\macrolist at end{#1}
+    \fi
+    \macrolist at listforeachaction
+}
+
+\newcommand{\macrolist at listforeachaction}[1]{
+
+    \macrolist at exists{\macrolist at listname}
+
+    \ifnum\numexpr\macrolist at start\relax>\listsize{\macrolist at listname}%
+        \PackageError{macrolist}{The starting index of the loop is out of the bounds of list '\macrolist at listname'}{}
+    \fi
+
+    \ifnum\numexpr\macrolist at end\relax>\listsize{\macrolist at listname}
+        \PackageError{macrolist}{The ending index of the loop is out of the bounds of list '\macrolist at listname'}{}
+    \fi
+
+    \foreach \macrolist at index in {\the\numexpr\macrolist at start\relax, ..., \the\numexpr\macrolist at end\relax} {%
+        \expandafter\expandafter\expandafter\let\expandafter\expandafter\macrolist at element\csname macrolist at list@\macrolist at listname\macrolist at index\endcsname
+        #1%
+    }%
+}
+% \fi
+%
+% \DescribeMacro{\listjoin}
+%
+% Executing |\listjoin{listname}{joiner}| returns all of the elements separated by \textsf{joiner}. This behaves like Javascript's \textsf{arr.join()}.
+%
+% \iffalse
+\newcommand{\listjoin}[2]{%
+    \ifnum\listsize{#1}>1
+        \listforeach{#1}{\macrolist at joinelement}[1][\listsize{#1}-1]{\macrolist at joinelement#2}%
+    \fi
+    \ifnum\listsize{#1}>0
+        \listelement{#1}{\listsize{#1}}%
+    \fi
+}
+% \fi
+%
+% \section{Example}
+% Here is the source code for a small document using \textsf{macrolist}.
+%
+% \begin{verbatim}
+%\documentclass{article}
+%\usepackage{macrolist}
+%
+%\begin{document}
+%
+%\newlist{mylist}
+%\listadd{mylist}{Some text}
+%% List: Some text
+%
+%\newcommand\macro{This is a macro}
+%
+%\listadd{mylist}{\macro}
+%% List: Some text, \macro
+%
+%\listelement{mylist}{1}
+%% Prints out "Some text"
+%
+%\listadd{mylist}[1]{Element inserted into beginning}
+%% List: Element inserted into beginning, Some text, \macro
+%
+%\listremove{mylist}{1}
+%% List: Some text, \macro
+%
+%\listforeach{mylist}{\element}{We're printing out \textbf{\element}. }
+%% We're printing out \textbf{Some text}. We're printing out \textbf{\macro}.
+%
+%\listjoin{mylist}{, }
+%% Some text, \macro
+%
+%\end{document}
+% \end{verbatim}
+%
+% \section{Implementation details}
+%
+% All internal macros are namespaced to prevent package conflicts.
+%
+% \begin{macro}{\macrolist at exists}
+% One internal macro we use is |\macrolist at exists{listname}|, which checks that \textsf{listname} exists. It throws an error otherwise.
+%
+%    \begin{macrocode}
+\newcommand*{\macrolist at exists}[1]{%
+    \ifcsname c at macrolist@list@#1\endcsname
+    \else
+        \PackageError{macrolist}
+        {The first argument is not a defined list}
+        {Make sure you have defined the list before trying to operate on it.}
+    \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\macrolist at inbounds}
+% We use |\macrolist at inbounds{listname}{index}| to check that first, \textsf{listname} is a defined list using |\macrolist at exists|, and second, that \textsf{index} is within bounds. It throws an error otherwise.
+%    \begin{macrocode}
+\newcommand*{\macrolist at inbounds}[2]{%
+    \macrolist at exists{#1}%
+    %
+    \if\relax\detokenize{#2}
+        \PackageError{macrolist}
+        {No number has been passed into the second argument of your command
+        }{Pass in a number to the second argument of your command.}
+    \fi
+    %
+    \ifnum\numexpr#2 \relax>\listsize{#1}
+        \PackageError{macrolist}
+        {Index out of bounds}
+        {The number you have passed in to the second argument of your command\MessageBreak
+        is out of the bounds of list '#1'.}
+    \fi
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \Finale
+\endinput
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/source/latex/macrolist/macrolist.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/macrolist/macrolist.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/macrolist/macrolist.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/macrolist/macrolist.ins	2021-07-13 20:03:54 UTC (rev 59919)
@@ -0,0 +1,45 @@
+%% Copyright (C) 2021 Dennis Chen <proofprogram at gmail.com>
+%%
+%% This work may be distributed and/or modified under
+%% the conditions the LaTeX Project Public License (LPPL),
+%% either version 1.3 of this license or (at your option)
+%% any later version. The latest version of this license
+%% can be found in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/macrolist}
+
+\preamble
+This work may be distributed and/or modified under
+the conditions the LaTeX Project Public License (LPPL),
+either version 1.3 of this license or (at your option)
+any later version. The latest version of this license
+can be found in
+    http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+\endpreamble
+
+\generate{\file{macrolist.sty}{\from{macrolist.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{*                                                           *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* files into a directory searched by TeX:                   *}
+\Msg{*                                                           *}
+\Msg{*     macrolist.sty                                         *}
+\Msg{*                                                           *}
+\Msg{* To produce the documentation, run the file                *}
+\Msg{* macrolist.dtx through LaTeX.                              *}
+\Msg{*                                                           *}
+\Msg{* Happy TeXing!                                             *}
+\Msg{*                                                           *}
+\Msg{*************************************************************}
+
+\endbatchfile
\ No newline at end of file

Added: trunk/Master/texmf-dist/tex/latex/macrolist/macrolist.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/macrolist/macrolist.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/macrolist/macrolist.sty	2021-07-13 20:03:54 UTC (rev 59919)
@@ -0,0 +1,178 @@
+%%
+%% This is file `macrolist.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% macrolist.dtx  (with options: `package')
+%% This work may be distributed and/or modified under
+%% the conditions the LaTeX Project Public License (LPPL),
+%% either version 1.3 of this license or (at your option)
+%% any later version. The latest version of this license
+%% can be found in
+%%     http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{macrolist}[2021/07/09 v1.0.0 Create lists of macros and perform operations on them]
+
+\RequirePackage{pgffor}
+
+\newcommand{\newlist}[1]{
+    \ifcsname c at macrolist@list@#1\endcsname
+        \PackageError{macrolist}{The list '#1' is already defined}{}
+    \else
+        \newcounter{macrolist at list@#1}
+        \setcounter{macrolist at list@#1}{0}
+    \fi
+}
+\newcommand{\listelement}[2]{%
+    \macrolist at inbounds{#1}{#2}%
+    \csname macrolist at list@#1\the\numexpr #2\relax\endcsname%
+}
+\newcommand{\listadd}[1]{
+    \macrolist at exists{#1}
+    \def\macrolist at currlist{#1}
+    \macrolist at listadd
+}
+%% We write \listadd this way such that the optional argument will be positioned correctly
+\newcommand{\macrolist at listadd}[2][]{
+    \stepcounter{macrolist at list@\macrolist at currlist}
+
+    \if\relax\detokenize{#1}\relax
+        \expandafter\def\csname macrolist at list@\macrolist at currlist\listsize{\macrolist at currlist}\endcsname{#2}
+    \else
+        \expandafter\ifnum\csname themacrolist at list@\macrolist at currlist\endcsname=#1
+            \expandafter\def\csname macrolist at list@\macrolist at currlist\listsize{\macrolist at currlist}\endcsname{#2}
+        \else
+            \macrolist at inbounds{\macrolist at currlist}{#1}
+            \foreach \macrolist at index in {\listsize{\macrolist at currlist}, ...,\the\numexpr #1+1\relax} {
+                \global\expandafter\let\csname macrolist at list@\macrolist at currlist\macrolist at index\expandafter\endcsname\csname macrolist at list@\macrolist at currlist\the\numexpr\macrolist at index-1\relax\endcsname
+            }
+            \expandafter\def\csname macrolist at list@\macrolist at currlist#1\endcsname{#2}
+        \fi
+    \fi
+}
+\newcommand{\listremove}[2]{
+    \macrolist at inbounds{#1}{#2}
+
+    \ifnum\numexpr#2\relax=\listsize{#1}
+    \else
+        \foreach \macrolist at index in {#2, ..., \the\numexpr\listsize{#1}-1\relax} {
+            \global\expandafter\let\csname macrolist at list@#1\macrolist at index\expandafter\endcsname\csname macrolist at list@#1\the\numexpr\macrolist at index+1\endcsname
+        }
+    \fi
+
+    \expandafter\let\csname macrolist at list@#1\listsize{#1}\endcsname\relax
+    \addtocounter{macrolist at list@#1}{-1}
+}
+\newcommand{\listremovelast}[1]{
+    \macrolist at exists{#1}
+    \expandafter\let\csname macrolist at list@#1\listsize{#1}\endcsname\relax
+    \addtocounter{macrolist at list@#1}{-1}
+}
+\newcommand{\listclear}[2]{
+    \macrolist at inbounds{#1}{#2}
+
+    \foreach \macrolist at index in {1, ..., \listsize{#1}} {
+        \expandafter\let\csname \macrolist at list@#1\macrolist at index\endcsname\relax
+    }
+
+    \setcounter{macrolist at list@#1}{0}
+}
+\newcommand*{\listsize}[1]{%
+    \macrolist at exists{#1}%
+    \csname themacrolist at list@#1\endcsname
+}
+\newcommand{\listforeach}[2]
+{
+    \def\macrolist at foreachstart{0} % Reset
+    % This is used to make optional arguments line up correctly
+
+    \def\macrolist at start{1}
+    \def\macrolist at end{\listsize{#1}}
+    \def\macrolist at listname{#1}
+    \def\macrolist at element{#2}
+    \macrolist at listforeachi
+}
+
+\newcommand{\macrolist at listforeachi}[1][]{
+    \if\relax\detokenize{#1}\relax
+    \else
+        \def\macrolist at start{#1}
+        \def\macrolist at foreachstart{1}
+    \fi
+    \macrolist at listforeachii
+}
+
+\newcommand{\macrolist at listforeachii}[1][]{
+    \if\relax\detokenize{#1}\relax
+        \ifnum\macrolist at foreachstart=1
+            \PackageError{macrolist}{You must either pass in both a starting and ending position or neither}{}
+        \fi
+    \else
+        \def\macrolist at end{#1}
+    \fi
+    \macrolist at listforeachaction
+}
+
+\newcommand{\macrolist at listforeachaction}[1]{
+
+    \macrolist at exists{\macrolist at listname}
+
+    \ifnum\numexpr\macrolist at start\relax>\listsize{\macrolist at listname}%
+        \PackageError{macrolist}{The starting index of the loop is out of the bounds of list '\macrolist at listname'}{}
+    \fi
+
+    \ifnum\numexpr\macrolist at end\relax>\listsize{\macrolist at listname}
+        \PackageError{macrolist}{The ending index of the loop is out of the bounds of list '\macrolist at listname'}{}
+    \fi
+
+    \foreach \macrolist at index in {\the\numexpr\macrolist at start\relax, ..., \the\numexpr\macrolist at end\relax} {%
+        \expandafter\expandafter\expandafter\let\expandafter\expandafter\macrolist at element\csname macrolist at list@\macrolist at listname\macrolist at index\endcsname
+        #1%
+    }%
+}
+\newcommand{\listjoin}[2]{%
+    \ifnum\listsize{#1}>1
+        \listforeach{#1}{\macrolist at joinelement}[1][\listsize{#1}-1]{\macrolist at joinelement#2}%
+    \fi
+    \ifnum\listsize{#1}>0
+        \listelement{#1}{\listsize{#1}}%
+    \fi
+}
+%% List: Some text
+%% List: Some text, \macro
+%% Prints out "Some text"
+%% List: Element inserted into beginning, Some text, \macro
+%% List: Some text, \macro
+%% We're printing out \textbf{Some text}. We're printing out \textbf{\macro}.
+%% Some text, \macro
+\newcommand*{\macrolist at exists}[1]{%
+    \ifcsname c at macrolist@list@#1\endcsname
+    \else
+        \PackageError{macrolist}
+        {The first argument is not a defined list}
+        {Make sure you have defined the list before trying to operate on it.}
+    \fi
+}
+\newcommand*{\macrolist at inbounds}[2]{%
+    \macrolist at exists{#1}%
+    %
+    \if\relax\detokenize{#2}
+        \PackageError{macrolist}
+        {No number has been passed into the second argument of your command
+        }{Pass in a number to the second argument of your command.}
+    \fi
+    %
+    \ifnum\numexpr#2 \relax>\listsize{#1}
+        \PackageError{macrolist}
+        {Index out of bounds}
+        {The number you have passed in to the second argument of your command\MessageBreak
+        is out of the bounds of list '#1'.}
+    \fi
+}
+\endinput
+%%
+%% End of file `macrolist.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/macrolist/macrolist.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2021-07-13 20:02:54 UTC (rev 59918)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2021-07-13 20:03:54 UTC (rev 59919)
@@ -490,7 +490,7 @@
     luasseq luatex85 luatexbase luatexja luatexko luatextra
     luatodonotes luavlna luaxml
     lwarp lxfonts ly1 lyluatex
-  m-tx macros2e macroswap mafr magaz magicnum magra
+  m-tx macrolist macros2e macroswap mafr magaz magicnum magra
     mahjong mailing mailmerge
     make4ht makebarcode makebase makebox
     makecell makecirc makecmds makecookbook

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2021-07-13 20:02:54 UTC (rev 59918)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2021-07-13 20:03:54 UTC (rev 59919)
@@ -747,6 +747,7 @@
 depend lua-check-hyphen
 depend lua-physical
 depend luatodonotes
+depend macrolist
 depend macroswap
 depend magaz
 depend magicnum

Added: trunk/Master/tlpkg/tlpsrc/macrolist.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.