From 470aa345999d2c666bfc3fac175ffe03dd7ac528 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 2 Sep 2016 00:04:23 +0000 Subject: listofitems (1sep16) git-svn-id: svn://tug.org/texlive/trunk@41971 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/listofitems/listofitems.tex | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'Master/texmf-dist/tex') diff --git a/Master/texmf-dist/tex/generic/listofitems/listofitems.tex b/Master/texmf-dist/tex/generic/listofitems/listofitems.tex index 7d9e154292a..c0c5d1eaa5b 100644 --- a/Master/texmf-dist/tex/generic/listofitems/listofitems.tex +++ b/Master/texmf-dist/tex/generic/listofitems/listofitems.tex @@ -3,9 +3,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \def\loiname {listofitems} % -\def\loiver {1.0} % +\def\loiver {1.1} % % % -\def\loidate {2016/8/20} % +\def\loidate {2016/9/01} % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -35,7 +35,7 @@ % - test (latex) : listofitems-test-latex (.tex et .pdf) % - fichier lisezmoi : README % -------------------------------------------------------------------- -\expandafter\edef\csname loi\string_restorecatcode\endcsname{\catcode\number`\_=\number\catcode`\_\relax} +\expandafter\edef\csname loi_restorecatcode\endcsname{\catcode\number`\_=\number\catcode`\_\relax} \catcode`\_11 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -78,7 +78,7 @@ \def\loi_argcsname_i#1{\expandafter\loi_temp\csname#1\endcsname} %--- macros de test -\long\def\loi_ifnum#1{\ifnum#1\expandafter\loi_first\else\expandafter\loi_second\fi} +\def\loi_ifnum#1{\ifnum#1\expandafter\loi_first\else\expandafter\loi_second\fi} \long\def\loi_ifx#1{\ifx#1\expandafter\loi_first\else\expandafter\loi_second\fi} \long\def\loi_ifempty#1{\loi_exparg\loi_ifx{\expandafter\relax\detokenize{#1}\relax}} \def\loi_ifstar#1#2{\def\loi_ifstar_i{\loi_ifx{*\loi_nxttok}{\loi_first{#1}}{#2}}\futurelet\loi_nxttok\loi_ifstar_i} @@ -194,18 +194,20 @@ {\edef\loi_listname{\loi_macroname#1}% \loi_argcsname\let{\loi_listname nest}\nestdepth \loi_argcsname\def{\loi_listname[]}{#2}% la liste enti\`ere + \loi_argcsname\def{\loi_listname sep[]}{}% s\'eparateur vide \loi_ifempty{#2} {\def#1[##1]{}% \loi_argcsname\def{\loi_listname len}{0}\loi_argcsname\def{\loi_listname len[0]}{0}% \loi_error{Empty list ignored, nothing to do}% } - {\edef#1[##1]{\unexpanded{\romannumeral\expandafter\loi_auxmacrolist\romannumeral\loi_normalizeindex}{\loi_listname}{##1}{\csname\loi_listname nest\endcsname}{\loi_listname}}% + {\edef#1[##1]{\unexpanded{\romannumeral\expandafter\loi_auxmacrolistitem\romannumeral\loi_normalizeindex}{\loi_listname}{##1}{\csname\loi_listname nest\endcsname}{\loi_listname}}% + \loi_argcsname\edef{\loi_listname sep}[##1]{\unexpanded{\romannumeral\expandafter\loi_auxmacrolistitem\romannumeral\loi_normalizeindex}{\loi_listname}{##1}{\csname\loi_listname nest\endcsname}{\loi_listname sep}}% \readlist_ii{#2}% \loi_argcsname\loi_argcsname\let{\loi_listname len}{\loi_listname len[0]}% longueur du niveau 0 }% }% } -\def\loi_auxmacrolist#1#2#3{% +\def\loi_auxmacrolistitem#1#2#3{% \expandafter\expandafter\expandafter\loi_stop\csname#3[#2]\expandafter\endcsname \romannumeral\loi_ifempty{#1}{\loi_stop}{\loi_stop\loi_error{#1}}% } @@ -226,9 +228,9 @@ \long\def\readlist_vi#1#2#3||{% #1=liste restante #2=dernier #3= \loi_ifx{\loi_quark#3} {\loi_ifempty{#2}% si #1 vide, aucun n'a \'et\'e trouv\'e, il reste \`a lire "\_nil" - {\long\def\readlist_vii##1\_nil##2{\loi_exparg{\readlist_ix{##2}{}}{\loi_gobarg##1}}}% ##2=compteur d'index + {\long\def\readlist_vii##1\_nil##2{\loi_exparg{\readlist_ix{##2}{}}{\loi_gobarg##1}{#2}}}% ##2=compteur d'index {\long\def\readlist_vii##1#2{\loi_exparg\readlist_viii{\loi_gobarg##1}\relax}% - \long\def\readlist_viii##1##2\_nil##3{\loi_exparg{\readlist_ix{##3}}{\loi_gobarg##2}{##1}}% ##3=compteur d'index + \long\def\readlist_viii##1##2\_nil##3{\loi_exparg{\readlist_ix{##3}}{\loi_gobarg##2}{##1}{#2}}% ##3=compteur d'index }% \readlist_vii\relax% le \relax meuble l'argument d\'elimit\'e } @@ -245,10 +247,11 @@ {\loi_exparg{\loi_exparg{\readlist_x{#1}{#2}}}{\loi_removeextremespaces{#3}}}% red\'efinir l'\'el\'ement courant {\readlist_x{#1}{#2}{#3}}% } -\long\def\readlist_x#1#2#3{% #1=compteur d'index #2=liste restante #3=\'el\'ement courant +\long\def\readlist_x#1#2#3#4{% #1=compteur d'index #2=liste restante #3=\'el\'ement courant #4=sep utilis\'e \loi_ifnum{0\if_ignoreemptyitems1\fi\loi_ifempty{#3}1{}=11 } {\readlist_iv{#1}{#2}}% si l'on n'ignore pas les \'el\'ements vides : {\loi_argcsname\def{\loi_listname[\csname loi_previndex[\number\loi_nestcnt]\endcsname#1]}{#3}% assignation de l'item ctuel \`a la macro + \loi_argcsname\def{\loi_listname sep[\csname loi_previndex[\number\loi_nestcnt]\endcsname#1]}{#4}% assignation du actuel \`a la macro \sep \loi_ifnum{\loi_nestcnt<\nestdepth\relax}% si imbrication max non atteinte {\advance\loi_nestcnt1 \loi_argcsname\edef{loi_previndex[\number\loi_nestcnt]}{\csname loi_previndex[\number\numexpr\loi_nestcnt-1]\endcsname#1,}% @@ -349,4 +352,8 @@ ###################################################################### v1.0 19/8/2016 - - Premi\`ere version publique \ No newline at end of file + - Premi\`ere version publique + +v1.1 01/09/2016 + - Stockage des s\'eparateurs dans sep + - bug corrig\'e dans \loi_restorecatcode \ No newline at end of file -- cgit v1.2.3