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 --- Master/texmf-dist/doc/generic/listofitems/README | 6 ++-- .../doc/generic/listofitems/listofitems-en.pdf | Bin 443430 -> 368032 bytes .../doc/generic/listofitems/listofitems-en.tex | 34 ++++++++++----------- .../doc/generic/listofitems/listofitems-fr.pdf | Bin 407222 -> 331528 bytes .../doc/generic/listofitems/listofitems-fr.tex | 16 +++++----- .../tex/generic/listofitems/listofitems.tex | 27 ++++++++++------ 6 files changed, 45 insertions(+), 38 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/generic/listofitems/README b/Master/texmf-dist/doc/generic/listofitems/README index 2f274eceb04..b8e7890fd82 100644 --- a/Master/texmf-dist/doc/generic/listofitems/README +++ b/Master/texmf-dist/doc/generic/listofitems/README @@ -4,9 +4,9 @@ ___________________________________ listofitems package - v1.0 + v1.1 - 20/08/2016 + 01/09/2016 ___________________________________ Authors : Christian Tellechea, Steven B. Segletes @@ -27,4 +27,4 @@ dont le s\'eparateur a \'et\'e choisi par l'utilisateur et d'acc\'eder This package allows one to capture all the items of a list, for which the parsing character has been selected by the user, and to access any -of these items with a simple syntax. \ No newline at end of file +of these items with a simple syntax. diff --git a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.pdf b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.pdf index 9fb4af47a80..7e9bd771b39 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 0b2d7c5b5b0..765cd29b9a0 100644 --- a/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex +++ b/Master/texmf-dist/doc/generic/listofitems/listofitems-en.tex @@ -4,9 +4,9 @@ \usepackage[utf8]{inputenc} \usepackage{listofitems,babel,xspace} \usepackage[bottom]{footmisc} -\usepackage{libertine}\usepackage[libertine]{newtxmath} +\usepackage{libertine}\usepackage[italic]{mathastext} \usepackage[scaled=0.8]{luximono} -\usepackage[margin=2.84cm]{geometry} +\usepackage[margin=3cm]{geometry} \usepackage{fancybox} \usepackage{xcolor} \def\listofitems{\textsf{\loiname}\xspace} @@ -89,12 +89,12 @@ \makeatother % FOR AMERICAN-ENGLISH VERSION \usepackage{setspace} -\setstretch{1.02} +\setstretch{1.01} \usepackage{enumitem} \newcommand\no[1]{number #1} \let\bsc\textsc \def\americanloidate{\expandafter\americanloidatei\loidate/} -\def\americanloidatei#1/#2/#3/{#3 \ifcase #2 \or January\or February\or March\or April\or May\or +\def\americanloidatei#1/#2/#3/{\number#3\relax\space\ifcase #2 \or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi{} #1} %\newcommand\flag[1]{\textcolor{red}{#1}}% DIAGNOSTIC FLAG FOR FURTHER TRANSLATION %\newcommand\cflag[1]{\textcolor{blue}{#1}}% DIAGNOSTIC FLAG FOR FURTHER TRANSLATION @@ -136,13 +136,10 @@ A component may, in turn, be a list with a parsing delimiter different from \def\listofitems{\textsf\loiname\xspace} \section{Preface} - -\begin{sloppypar} This package loads no external packages, must be used with the - \eTeX{} engine, and must be called in (pdf)(Xe)(lua)\LaTeX{} with + \eTeX{} engine, and must be called in (pdf)\hskip0pt(Xe)\hskip0pt(lua)\LaTeX{} with the invocation \code|\usepackage{listofitems}| -\end{sloppypar} and under (pdf)(Xe)(Lua)\TeX {} by way of \code|\input listofitems.tex| @@ -172,12 +169,10 @@ To set ``\verb-/-'' as the \verb|| for a simple list, for example ``\verb|.|'', and write ``\verb+\setsepchar[.]{/}+''. \medbreak -\begin{sloppypar} It is not possible to select \verb-|- as the \verb|| because it would conflict with the logical \textbf{OR}, denoted ``\verb-||-'' (see below). However, one can work around this limitation, at one's own peril, writing ``\verb-\setsepchar{{|}}-''. -\end{sloppypar} \paragraph{Read a list} To read the list of items, the \verb|\readlist{}| should be called. @@ -222,6 +217,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 + item of rank \verb||. +The last parse-character (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} To specify several possible separators, use the \textbf{OR} operator, denoted ``\verb-||-''. @@ -230,10 +232,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]\par -2) \term[2]\par -3) \term[3]\par -4) \term[4]/ +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])/ \paragraph{Number of items} If we write \verb|\readlist{}|, then the macro \verb|len| @@ -277,7 +279,6 @@ For these spaces to be ignored when reading the \verb||, execute the starr \showitems\foo| \paragraph{Managing empty items} -\begin{sloppypar} By default, the \listofitems package retains and accounts for empty items. Thus, in the previous ex\-am\-ple, the 2nd expansion of \verb|\foo[7]| is empty. For empty items of the list (i.e., those list items defined by two @@ -286,7 +287,6 @@ For empty items of the list (i.e., those list items defined by two execute the macro \verb|\ignoreemptyitems| . To return to the default package behavior, simply execute the macro \verb|\reademptyitems|. -\end{sloppypar} This option can be used alone or in combination with \verb|\readlist*|, in which case the suppression of extreme (leading/trailing) spaces occurs @@ -401,7 +401,6 @@ Term 3: \numbers[3] (factors: \numbers[3,1], \numbers[3,2] and \numbers[3,3])= \paragraph{Number of list items} -\begin{sloppypar} The macro \verb|\listlen[]| requires 2 expansions in order to give the number of items in the list specified by the \verb||. @@ -411,7 +410,6 @@ The \verb|| of the \verb|| must be strictly less than that For the case where the \verb|| is empty, \verb|\listlen[]|, with 2 expansions, yields the identical result as \verb|len| with 1 expansion. -\end{sloppypar} \exemple|\setsepchar{\\/,/ } \readlist\baz{1,2 a b,3 c\\4 d e f,5,6\\7,,8, ,9 xy z} diff --git a/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.pdf b/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.pdf index 07f1b2307fe..af268df94f7 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/doc/generic/listofitems/listofitems-fr.tex b/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.tex index 43f17933043..375327991f8 100644 --- a/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.tex +++ b/Master/texmf-dist/doc/generic/listofitems/listofitems-fr.tex @@ -2,11 +2,11 @@ % % Fichier compilé avec pdflatex \documentclass[frenchb,a4paper]{article} -\usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} \usepackage{listofitems,babel,xspace} \usepackage[bottom]{footmisc} -\usepackage{libertine}\usepackage[libertine]{newtxmath} +\usepackage{libertine}\usepackage[italic,frenchmath]{mathastext} \usepackage[scaled=0.8]{luximono} \usepackage[margin=3cm]{geometry} \usepackage{fancybox} @@ -147,7 +147,7 @@ Si la \verb|| est contenue dans une macro, alors cette macro est dévelop \readlist\foo\liste| \paragraph{Accéder à un élément} -La macro \verb|\foo| attend un argument numérique \emph{obligatoire} entre crochets, que nous notons $i$ et qui désigne le rang de l'élément auquel on souhaite accéder. Ainsi, \verb|\foo[1]| est\footnote{Il faut 2 développements à \texttt{\textbackslash foo[}$i$\texttt] pour obtenir l'élément \no$i$.} \og\verb|12|\fg. De la même façon, \verb|\foo[4]| est \og\verb|{\bfseries z}|\fg. +La macro \verb|\foo| attend un argument numérique \emph{obligatoire} entre crochets, que nous notons $i$ et qui désigne le rang de l'élément auquel on souhaite accéder. Ainsi, \verb|\foo[1]| est\footnote{Il faut 2 développements à \texttt{\textbackslash foo[}$i$\texttt] pour obtenir l'élément \no$i$.} \og\verb|12|\fg. De la même façon, \verb|\foo[4]| est \og\verb|{\bfseries z}|\fg. Le nombre $i$ peut également être négatif auquel cas le comptage se fait à partir de la fin de la liste : $-1$ représente le dernier rang, $-2$ l'avant-dernier, etc. Si le nombre d'éléments est $n$, alors l'argument $-n$ est le premier élément. \medbreak @@ -156,15 +156,17 @@ D'une façon générale, si une \verb|| a une longueur $n$, alors l'index Si l'index est vide, alors \verb|\foo[]| se développe en la \verb|| entière. +La macro \verb|\foosep| est créé. Elle s'utilise avec la syntaxe \verb|\foosep[]| et permet d'accéder au séparateur qui suit l'élément de rang \verb||. Le dernier séparateur (celui qui suit le dernier élément) est défini par \listofitems. Si l'\verb|| est vide, \verb|\foosep[]| a un développement vide. + \paragraph{Choisir plusieurs séparateurs possibles} Pour spécifier plusieurs séparateurs possibles, il faut utiliser l'opérateur \textbf{OU} noté \og\verb-||-\fg{}. On peut par exemple utiliser cette fonctionnalité pour isoler les termes dans une somme algébrique : \exemple/\setsepchar{+||-} \readlist\terme{17-8+4-11} -1) \terme[1]\par -2) \terme[2]\par -3) \terme[3]\par -4) \terme[4]/ +1) \terme[1] (séparateur = \termesep[1])\par +2) \terme[2] (séparateur = \termesep[2])\par +3) \terme[3] (séparateur = \termesep[3])\par +4) \terme[4] (séparateur = \termesep[4])/ \paragraph{Nombre d'éléments} Si l'on écrit \verb|\readlist{}| alors la macro \verb|len| contient\footnote{C'est-à-dire qu'elle est purement développable et se développe en un nombre} le nombre d'éléments de la \verb||. Dans l'exemple avec \verb|\foo|, la macro \verb|\foolen| contient \foolen. 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