summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/macrolist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-07-26 20:30:56 +0000
committerKarl Berry <karl@freefriends.org>2021-07-26 20:30:56 +0000
commit20c23ef020fe9c84c498fda3807e85403256f199 (patch)
tree47da1ded878a6edad4f810a5d20cffee07026c4e /Master/texmf-dist/source/latex/macrolist
parent9de42f6753253d4c200fa10a656f3be80c9b1467 (diff)
macrolist (26jul21)
git-svn-id: svn://tug.org/texlive/trunk@60081 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/macrolist')
-rw-r--r--Master/texmf-dist/source/latex/macrolist/macrolist.dtx31
1 files changed, 18 insertions, 13 deletions
diff --git a/Master/texmf-dist/source/latex/macrolist/macrolist.dtx b/Master/texmf-dist/source/latex/macrolist/macrolist.dtx
index 382faf2930e..59d3041f3f3 100644
--- a/Master/texmf-dist/source/latex/macrolist/macrolist.dtx
+++ b/Master/texmf-dist/source/latex/macrolist/macrolist.dtx
@@ -16,7 +16,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{macrolist}[2021/07/23 v1.2.0 Create lists of macros and perform operations on them]
+\ProvidesPackage{macrolist}[2021/07/25 v1.2.1 Create lists of macros and perform operations on them]
\RequirePackage{pgffor}
%</package>
@@ -94,6 +94,7 @@
\csname macrolist@list@#1\the\numexpr #2\relax\endcsname%
}
% \fi
+% \changes{v1.2.1}{2021/07/25}{Fix behavior of listindexof and listcontains for empty lists}
% \changes{v1.2.0}{2021/07/23}{Add listindexof and listcontains}
% \DescribeMacro{\listindexof}
%
@@ -106,12 +107,14 @@
\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
- }%
+ \ifnum\listsize{#1}>0\relax
+ \def\macrolist@el{#2}%
+ \listforeach{#1}{\macrolist@listindexel}[\listsize{#1}][1]{%
+ \ifx\macrolist@el\macrolist@listindexel
+ \xdef\macrolist@listindex{\macrolist@index}%
+ \fi
+ }%
+ \fi
\macrolist@listindex%
\let\macrolist@listindex\relax%
}
@@ -125,12 +128,14 @@
\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\listsize{#1}>0\relax
+ \def\macrolist@el{#2}%
+ \listforeach{#1}{\macrolist@listindexel}[\listsize{#1}][1]{%
+ \ifx\macrolist@el\macrolist@listindexel
+ \xdef\macrolist@listindex{\macrolist@index}%
+ \fi
+ }%
+ \fi
\ifnum\macrolist@listindex>0\relax
#3%
\else