summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/macrolist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-25 20:48:38 +0000
committerKarl Berry <karl@freefriends.org>2021-07-25 20:48:38 +0000
commit768d6790ab7c65a44384ce0aefc24e179aab38fd (patch)
tree74620d1bee1206fbdfa97b3a31ce54b0c9b5b4ff /Master/texmf-dist/tex/latex/macrolist
parent6f654705f79b314523e5e0b829da91294b8a3eb6 (diff)
macrolist (25jul21)
git-svn-id: svn://tug.org/texlive/trunk@60063 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/macrolist')
-rw-r--r--Master/texmf-dist/tex/latex/macrolist/macrolist.sty29
1 files changed, 28 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/latex/macrolist/macrolist.sty b/Master/texmf-dist/tex/latex/macrolist/macrolist.sty
index 34de7dcc21a..36397cc9175 100644
--- a/Master/texmf-dist/tex/latex/macrolist/macrolist.sty
+++ b/Master/texmf-dist/tex/latex/macrolist/macrolist.sty
@@ -15,7 +15,7 @@
%% version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{macrolist}[2021/07/23 v1.1.1 Create lists of macros and perform operations on them]
+\ProvidesPackage{macrolist}[2021/07/23 v1.2.0 Create lists of macros and perform operations on them]
\RequirePackage{pgffor}
@@ -32,6 +32,33 @@
\macrolist@inbounds{#1}{#2}%
\csname macrolist@list@#1\the\numexpr #2\relax\endcsname%
}
+\newcommand{\listindexof}[2]{%
+ \def\macrolist@listindex{0}%
+ \macrolist@exists{#1}%
+ \def\macrolist@el{#2}%
+ \listforeach{#1}{\macrolist@listindexel}[\listsize{#1}][1]{%
+ \ifx\macrolist@el\macrolist@listindexel
+ \xdef\macrolist@listindex{\macrolist@index}%
+ \fi
+ }%
+ \macrolist@listindex%
+ \let\macrolist@listindex\relax%
+}
+\newcommand{\listcontains}[4]{%
+ \def\macrolist@listindex{0}%
+ \macrolist@exists{#1}%
+ \def\macrolist@el{#2}%
+ \listforeach{#1}{\macrolist@listindexel}[\listsize{#1}][1]{%
+ \ifx\macrolist@el\macrolist@listindexel
+ \xdef\macrolist@listindex{\macrolist@index}%
+ \fi
+ }%
+ \ifnum\macrolist@listindex>0\relax
+ #3%
+ \else
+ #4%
+ \fi
+}
\newcommand{\listadd}[1]{
\macrolist@exists{#1}
\def\macrolist@currlist{#1}