From 721b1dbe9754ce2f222164010982be4e784f05f3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 18 Nov 2016 23:20:01 +0000 Subject: listofitems (18nov16) git-svn-id: svn://tug.org/texlive/trunk@42530 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/listofitems/README | 4 +- .../doc/generic/listofitems/listofitems-en.pdf | Bin 368542 -> 368982 bytes .../doc/generic/listofitems/listofitems-en.tex | 52 ++++++++++----------- .../doc/generic/listofitems/listofitems-fr.pdf | Bin 332234 -> 332236 bytes .../tex/generic/listofitems/listofitems.tex | 23 +++++---- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/Master/texmf-dist/doc/generic/listofitems/README b/Master/texmf-dist/doc/generic/listofitems/README index fd70040e2ed..29c36faab02 100644 --- a/Master/texmf-dist/doc/generic/listofitems/README +++ b/Master/texmf-dist/doc/generic/listofitems/README @@ -4,9 +4,9 @@ ___________________________________ listofitems package - v1.2 + v1.3 - 22/10/2016 + 18/11/2016 ___________________________________ Authors : Christian Tellechea, Steven B. Segletes diff --git a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.pdf b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.pdf index 9585e81b2a8..1d493ffa34d 100644 Binary files a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.pdf and b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.pdf differ diff --git a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex index 2f4b2d5449b..72f24c410df 100644 --- a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex +++ b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex @@ -119,7 +119,7 @@ \vskip2cm \leftskip=.2\linewidth \rightskip=.2\linewidth \small This simple package is designed to read a list of items whose - parsing character may be selected by the user. + parsing separator may be selected by the user. Once the list is read, its items are stored in a structure that behaves as a dimensioned array. As such, it becomes very easy to access an item @@ -145,27 +145,27 @@ and under (pdf)(Xe)(Lua)\TeX {} by way of \code|\input listofitems.tex| \section{Read a Simple List} -\paragraph{Set the parsing character} -The default parsing character is the comma and if we want change it, we must do so +\paragraph{Set the parsing separator} +The default parsing separator is the comma and if we want change it, we must do so before reading a list of items, with the definition - \verb|\setsepchar{}|. -A \verb|| is a set of tokens which possess catcodes different from + \verb|\setsepchar{}|. +A \verb|| is a set of tokens which possess catcodes different from 1 and 2 (the opening and closing braces), 14 (usually \verb|%|) and 15. The token of catcode 6 (usually \verb|#|) is accepted only if it is followed by an integer, denoting the argument of a macro; -In no case should this token be provided alone as the \verb||. +In no case should this token be provided alone as the \verb||. Commands can be included in this set of tokens, including the \TeX{} primitive \verb|\par|.% \smallbreak -The parsing-character \verb|| ``\verb-/-'' is reserved by default +The parsing-separator \verb|| ``\verb-/-'' is reserved by default for nested lists (see page 3). %\ref{nested.list.delimiters}). It is therefore not proper to write "\verb-\setsepchar{/}-" because the \listofitems{} package would misunderstand that you want to read a nested list. -To set ``\verb-/-'' as the \verb|| for a simple list, +To set ``\verb-/-'' as the \verb|| for a simple list, it is necessary, using the optional argument, to choose - a different parsing-character \verb|| for nested lists, + a different parsing-separator \verb|| for nested lists, for example ``\verb|.|'', and write ``\verb+\setsepchar[.]{/}+''. \medbreak @@ -220,13 +220,13 @@ Otherwise, a compilation error occurs. If the index is empty, \verb|\foo[]| produces the complete \verb||. The macro \verb|\foosep| is created. It is used with the syntax - \verb|\foosep[]| and allows access to the parse-character that follows the + \verb|\foosep[]| and allows access to the parsing-separator that follows the item of rank \verb||. -The last parse-character (the one following the last item) is implicitly +The last parsing-separator (the one following the last item) is implicitly defined by \listofitems. If the \verb|| is empty, \verb|\foosep[]| is empty. -\paragraph{Select several possible parsing characters} +\paragraph{Select several possible parsing separators} To specify several possible separators, use the \textbf{OR} operator, denoted ``\verb-||-''. One can use this feature, for example, to isolate the terms in an @@ -234,10 +234,10 @@ One can use this feature, for example, to isolate the terms in an \exemple/\setsepchar{+||-} \readlist\term{17-8+4-11} -1) \term[1] (parse character = \termsep[1])\par -2) \term[2] (parse character = \termsep[2])\par -3) \term[3] (parse character = \termsep[3])\par -4) \term[4] (parse character = \termsep[4])/ +1) \term[1] (parsing separator = \termsep[1])\par +2) \term[2] (parsing separator = \termsep[2])\par +3) \term[3] (parsing separator = \termsep[3])\par +4) \term[4] (parsing separator = \termsep[4])/ \paragraph{Number of items} If we write \verb|\readlist{}|, then the macro \verb|len| @@ -314,7 +314,7 @@ The \verb|| is a macro chosen by the user that will loop over the valu The macro \verb|cnt| represents the sequence number of the item in \verb||. -\exemple|\setsepchar{ }% parse-character = space +\exemple|\setsepchar{ }% parsing-separator = space \readlist\phrase{One phrase to test.} \foreachitem\word\in\phrase{List item number \wordcnt{}: \word\par}| @@ -324,7 +324,7 @@ The \verb|\itemtomacro[index]| assigns to the \verb|| The \verb|| thus defined is purely expandable provided that the tokens in the items are expandable. -\exemple|\setsepchar{ }% parse-character = space +\exemple|\setsepchar{ }% parsing-separator = space \readlist\phrase{One phrase to test.} \itemtomacro\phrase[2]\aword \meaning\aword\par @@ -334,24 +334,24 @@ The \verb|| thus defined is purely expandable provided that the tokens \section{Nested Lists} We speak of a list being ``nested'' when asking \listofitems to read a list where the items are, in turn, understood as being a list (implying a parsing - character different from the top-tier list). + separator different from the top-tier list). The nesting depth is not limited, but in practice, a depth of 2 or 3 will usually suffice. -\paragraph{Defining the parsing characters}\label{nested.list.delimiters} +\paragraph{Defining the parsing separators}\label{nested.list.delimiters} To indicate that a list will be nested, so that the list parsing will be performed recursively, one must specify multiple - parsing characters, each corresponding to the particular tier of nesting. -This list of parsing characters is itself given as a delimited list to + parsing separators, each corresponding to the particular tier of nesting. +This list of parsing separators is itself given as a delimited list to the macro \verb|\setsepchar|, with the syntax - \verb|\setsepchar[]{}|. + \verb|\setsepchar[]{}|. By default, the \verb|| is ``\texttt{/}''. Thus, writing \code|\setsepchar{\\/,/ }| -indicates a recursive depth of 3, with the parsing-character list delimiter defaulting +indicates a recursive depth of 3, with the parsing-separator list delimiter defaulting to ``\texttt{/}'': \begin{itemize}[itemsep=0pt,topsep=0pt,partopsep=0pt,parsep=0pt,label=---] @@ -444,10 +444,10 @@ g) \showitems\baz[3,5]| \paragraph{Empty items and extreme (leading/trailing) spaces} The removal of empty items and/or leading/\allowbreak trailing spaces will occur in \emph{all} the items, regardless of the degree of nesting. -It is clear that a space, ``\verb*| |'', is useless as a parsing character if you want +It is clear that a space, ``\verb*| |'', is useless as a parsing separator if you want to use \verb|\readlist*|. Therefore, in the following example, ``\verb|*|'' is instead selected as the (3rd-tier) - parsing character. + parsing separator. Further, we remove only the extreme spaces, but retain empty items. diff --git a/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.pdf b/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.pdf index 2ba691b6eaa..042a368926c 100644 Binary files a/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.pdf and b/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.pdf differ diff --git a/Master/texmf-dist/tex/generic/listofitems/listofitems.tex b/Master/texmf-dist/tex/generic/listofitems/listofitems.tex index 558556286eb..726b75efb2e 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.2} % +\def\loiver {1.3} % % % -\def\loidate {2016/10/22} % +\def\loidate {2016/11/18} % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -188,7 +188,7 @@ \def\greadlist{% \let\loi_def\gdef \let\loi_edef\xdef \def\loi_let{\global\let}% \loi_nestcnt1 % niveau initial = 1 - \loi_argcsname\let{loi_previndex[\number\loi_nestcnt]}\empty + \loi_argcsname\loi_let{loi_previndex[\number\loi_nestcnt]}\empty \loi_ifstar{\_removeextremespacestrue\readlist_i}{\_removeextremespacesfalse\readlist_i}% } \def\readlist{% @@ -200,13 +200,13 @@ \long\def\readlist_i#1#2{% #1=macro stockant les \'el\'ements #2=liste des \'el\'ements \loi_ifcs{#2} {\loi_exparg{\readlist_i#1}{#2}} - {\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_edef\loi_listname{\loi_macroname#1}% + \loi_argcsname\loi_let{\loi_listname nest}\nestdepth + \loi_argcsname\loi_def{\loi_listname[]}{#2}% la liste enti\`ere + \loi_argcsname\loi_def{\loi_listname sep[]}{}% s\'eparateur vide \loi_ifempty{#2} {\loi_def#1[##1]{}% - \loi_argcsname\def{\loi_listname len}{0}\loi_argcsname\loi_def{\loi_listname len[0]}{0}% + \loi_argcsname\loi_def{\loi_listname len}{0}\loi_argcsname\loi_def{\loi_listname len[0]}{0}% \loi_error{Empty list ignored, nothing to do}% } {\loi_edef#1[##1]{\unexpanded{\romannumeral\expandafter\loi_auxmacrolistitem\romannumeral\loi_normalizeindex}{\loi_listname}{##1}{\csname\loi_listname nest\endcsname}{\loi_listname}}% @@ -221,7 +221,7 @@ \romannumeral\loi_ifempty{#1}{\loi_stop}{\loi_stop\loi_error{#1}}% } \def\readlist_ii{% - \loi_argcsname\let\loi_currentsep{loi_listofsep[\number\loi_nestcnt]}% + \loi_argcsname\loi_let\loi_currentsep{loi_listofsep[\number\loi_nestcnt]}% \expandafter\readlist_iii\loi_currentsep||\_nil } \long\def\readlist_iii#1||#2\_nil#3{\readlist_iv1{#3#1}}% #1= #3=liste -> rajoute un \'el\'ement vide pour le test ifempty ci dessous @@ -372,4 +372,7 @@ v1.1 01/09/2016 - bug corrig\'e dans \loi_restorecatcode v1.2 22/10/2016 - - macros \greadlist et \gitemtomacro pour la globalit\'e \ No newline at end of file + - macros \greadlist et \gitemtomacro pour la globalit\'e + +v1.3 18/11/2016 + - bugs corrig\'es dans la gestion de la globalit\'e \ No newline at end of file -- cgit v1.2.3