diff options
author | Karl Berry <karl@freefriends.org> | 2013-07-12 22:54:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-07-12 22:54:42 +0000 |
commit | 60ede63177ff54dd8d1934012fbecce179a633ee (patch) | |
tree | 9dbd9e4608c9a0caa9864fedf49f0a2aea36fedf /Master/texmf-dist/source/latex/l3kernel | |
parent | c2d4fa6f59f3c566ccd85e3b250f0a27485bbaea (diff) |
l3 (12jul13)
git-svn-id: svn://tug.org/texlive/trunk@31181 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel')
22 files changed, 1029 insertions, 618 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 176bf791101..612cfb35e2c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -49,8 +49,8 @@ %<*driver|package> \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2013/03/14} -\def\ExplFileVersion{4469} +\def\ExplFileDate{2013/07/12} +\def\ExplFileVersion{4544} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -894,7 +894,7 @@ % is concerned with code, and some with coding style. % % \begin{itemize} -% \item \pkg{expl3} is mainly focussed on programming. This means that +% \item \pkg{expl3} is mainly focused on programming. This means that % some areas still require the use of \LaTeXe{} internal macros. % For example, you may well need \tn{@ifpackageloaded}, as there % is currently no native \LaTeX3 package loading module. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins new file mode 100644 index 00000000000..b869a70fee5 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins @@ -0,0 +1,93 @@ +\iffalse meta-comment + +File l3.ins Copyright (C) 2011,2012 The LaTeX3 Project + +It may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\let\jobname\relax +\input l3docstrip.dtx +\askforoverwritefalse + +\preamble + +EXPERIMENTAL CODE + +Do not distribute this file without also distributing the +source files specified above. + +Do not distribute a modified version of this file. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +% ===== PACKAGE ONLY ====== +\generate{\file{expl3.sty} {\from{expl3.dtx} {package}}} +% ======================== +\generate{\file{l3bootstrap.sty} {\from{l3bootstrap.dtx}{package}}} +\generate{\file{l3names.sty} {\from{l3names.dtx} {package}}} +\generate{\file{l3basics.sty} {\from{l3basics.dtx} {package}}} +\generate{\file{l3expan.sty} {\from{l3expan.dtx} {package}}} +\generate{\file{l3tl.sty} {\from{l3tl.dtx} {package}}} +\generate{\file{l3seq.sty} {\from{l3seq.dtx} {package}}} +\generate{\file{l3int.sty} {\from{l3int.dtx} {package}}} +\generate{\file{l3quark.sty} {\from{l3quark.dtx} {package}}} +\generate{\file{l3prg.sty} {\from{l3prg.dtx} {package}}} +\generate{\file{l3clist.sty} {\from{l3clist.dtx} {package}}} +\generate{\file{l3token.sty} {\from{l3token.dtx} {package}}} +\generate{\file{l3prop.sty} {\from{l3prop.dtx} {package}}} +\generate{\file{l3msg.sty} {\from{l3msg.dtx} {package}}} +\generate{\file{l3file.sty} {\from{l3file.dtx} {package}}} +\generate{\file{l3skip.sty} {\from{l3skip.dtx} {package}}} +\generate{\file{l3keys.sty} {\from{l3keys.dtx} {package}}} +\generate + {% + \file{l3fp.sty} + {% + \from{l3fp.dtx} {package} + \from{l3fp-aux.dtx} {package} + \from{l3fp-traps.dtx} {package} + \from{l3fp-round.dtx} {package} + \from{l3fp-parse.dtx} {package} + \from{l3fp-logic.dtx} {package} + \from{l3fp-basics.dtx} {package} + \from{l3fp-extended.dtx}{package} + \from{l3fp-expo.dtx} {package} + \from{l3fp-trig.dtx} {package} + \from{l3fp-convert.dtx} {package} + \from{l3fp-assign.dtx} {package} + \from{l3fp-old.dtx} {package} + }% + } +\generate{\file{l3box.sty} {\from{l3box.dtx} {package}}} +\generate{\file{l3coffins.sty} {\from{l3coffins.dtx} {package}}} +\generate{\file{l3color.sty} {\from{l3color.dtx} {package}}} +\generate{\file{l3luatex.sty} {\from{l3luatex.dtx} {package}}} +\generate{\file{l3candidates.sty}{\from{l3candidates.dtx}{package}}} + +\generate{\file{l3doc.cls} {\from{l3doc.dtx} {class}}} +\generate{\file{l3doc.ist} {\from{l3doc.dtx} {docist}}} + +\generate{\file{l3dvipdfmx.def} {\from{l3drivers.dtx} {package,dvipdfmx} }} +\generate{\file{l3dvips.def} {\from{l3drivers.dtx} {package,dvips} }} +\generate{\file{l3pdfmode.def} {\from{l3drivers.dtx} {package,pdfmode} }} +\generate{\file{l3xdvipdfmx.def} {\from{l3drivers.dtx} {package,xdvipdfmx}}} + +\generate{\file{l3docstrip.tex} {\from{l3docstrip.dtx} {program}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 98fe66d8b35..b00dee6ec9e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3basics.dtx 4428 2013-01-10 13:23:29Z bruno $ +\GetIdInfo$Id: l3basics.dtx 4521 2013-07-09 11:45:31Z joseph $ {L3 Basic definitions} %</driver|package> %<*driver> @@ -185,15 +185,15 @@ % \end{description} % % Finally, the functions in -% Subsections~\ref{sec:defining-new-function-1}~and -% \ref{sec:defining-new-function-2} are primarily meant to define +% Subsections~\ref{sec:l3basics:defining-new-function-1}~and +% \ref{sec:l3basics:defining-new-function-2} are primarily meant to define % \emph{base functions} only. Base functions can only have the following % argument specifiers: % \begin{description} % \item[|N| and |n|] No manipulation. % \item[|T| and |F|] Functionally equivalent to |n| (you are actually % encouraged to use the family of |\prg_new_conditional:| functions -% described in Section~\ref{sec:new-conditional-functions}). +% described in Section~\ref{sec:l3basics:new-conditional-functions}). % \item[|p| and |w|] These are special cases. % \end{description} % @@ -201,10 +201,10 @@ % other argument specifiers in your function names, but they do not handle % expansion for you. You should define the base function and then use % \cs{cs_generate_variant:Nn} to generate custom variants as described in -% Section~\ref{sec:defining-variants}. +% Section~\ref{sec:l3basics:defining-variants}. % % \subsection{Defining new functions using parameter text} -% \label{sec:defining-new-function-1} +% \label{sec:l3basics:defining-new-function-1} % % \begin{function}{\cs_new:Npn, \cs_new:cpn, \cs_new:Npx, \cs_new:cpx} % \begin{syntax} @@ -393,7 +393,7 @@ % \end{function} % % \subsection{Defining new functions using the signature} -% \label{sec:defining-new-function-2} +% \label{sec:l3basics:defining-new-function-2} % % \begin{function} % { @@ -982,7 +982,7 @@ % \end{function} % % \section{Predicates and conditionals} -% \label{sec:predicates} +% \label{sec:l3basics:predicates} % % \LaTeX3 has three concepts for conditional flow processing: % \begin{description} @@ -1337,7 +1337,7 @@ % \begin{function}{\__cs_tmp:w} % Function used for various short-term usages, for instance defining % functions whose definition involves tokens which are hard to insert -% normally (spaces, charactes with category other). +% normally (spaces, characters with category other). % \end{function} % % \begin{function}{\__kernel_register_show:N, \__kernel_register_show:c} @@ -1899,7 +1899,7 @@ % name. In the absence of a colon, we throw an error and don't define % any conditional. The fourth and fifth arguments build up the % defining function. The sixth is the parameters to use (possibly -% empty), the seventh is the list of forms to define, the eigth is the +% empty), the seventh is the list of forms to define, the eighth is the % replacement text which we will augment when defining the forms. % The use of \cs{etex_detokenize:D} makes the later loop more robust. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index b6e89bde0be..ddb859bd03a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3box.dtx 4411 2013-01-08 12:21:52Z bruno $ +\GetIdInfo$Id: l3box.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -490,7 +490,7 @@ % \end{syntax} % Typesets the \meta{contents} into a vertical box of natural height % and includes this box in the current list for typesetting. The -% baseline of the box will tbe equal to that of the \emph{first} +% baseline of the box will be equal to that of the \emph{first} % item added to the box. % \begin{texnote} % This is the \TeX{} primitive \tn{vtop}. @@ -529,7 +529,7 @@ % \cs{vbox_set_top:Nn} \meta{box} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The baseline of the box will tbe equal +% result inside the \meta{box}. The baseline of the box will be equal % to that of the \emph{first} item added to the box. % \end{function} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index e144922e224..1eaf1bdeb0f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3candidates.dtx Copyright(C) 2012 The LaTeX3 Project +%% File: l3candidates.dtx Copyright(C) 2012,2013 The LaTeX3 Project %% %% It may be distributed and/or modified under the conditions of the %% LaTeX Project Public License (LPPL), either version 1.3c of this @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3candidates.dtx 4468 2013-03-14 20:30:45Z joseph $ +\GetIdInfo$Id: l3candidates.dtx 4521 2013-07-09 11:45:31Z joseph $ {L3 Experimental additions to l3kernel} %</driver|package> %<*driver> @@ -264,7 +264,7 @@ % % \section{Additions to \pkg{l3clist}} % -% \begin{function}{\clist_item:Nn, \clist_item:cn, \clist_item:nn} +% \begin{function}[EXP]{\clist_item:Nn, \clist_item:cn, \clist_item:nn} % \begin{syntax} % \cs{clist_item:Nn} \meta{comma list} \Arg{integer expression} % \end{syntax} @@ -326,37 +326,6 @@ % is not empty. % \end{function} % -% \begin{function}[EXP, added = 2012-06-26]{\clist_use:Nnnn} -% \begin{syntax} -% \cs{clist_use:Nnnn} \meta{clist~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two} -% \end{syntax} -% Places the contents of the \meta{clist~var} in the input stream, -% with the appropriate \meta{separator} between the items. Namely, if -% the comma list has more than $2$ items, the \meta{separator between -% more than two} is placed between each pair of items except the -% last, for which the \meta{separator between final two} is used. If -% the comma list has $2$ items, then they are placed in the input -% stream separated by the \meta{separator between two}. If the comma -% list has $1$ item, it is placed in the input stream, and a comma -% list with no items produces no output. An error will be raised if -% the variable does not exist or if it is invalid. -% -% For example, -% \begin{verbatim} -% \clist_set:Nn \l_tmpa_clist { a , b , , c , {de} , f } -% \clist_use:Nnnn \l_tmpa_clist { ~and~ } { ,~ } { ,~and~ } -% \end{verbatim} -% will insert \enquote{\texttt{a, b, c, de, and f}} in the input -% stream. The first separator argument is not used in this case -% because the comma list has more than $2$ items. -% \begin{texnote} -% The result is returned within the \tn{unexpanded} -% primitive (\cs{exp_not:n}), which means that the \meta{items} -% will not expand further when appearing in an \texttt{x}-type -% argument expansion. -% \end{texnote} -% \end{function} -% % \section{Additions to \pkg{l3coffins}} % % \begin{function}{\coffin_resize:Nnn, \coffin_resize:cnn} @@ -622,38 +591,45 @@ % \end{texnote} % \end{function} % -% \begin{function}[EXP, added = 2012-06-26]{\seq_use:Nnnn} +% \section{Additions to \pkg{l3skip}} +% +% \begin{function}[added = 2013-05-06, EXP]{\dim_to_pt:n} % \begin{syntax} -% \cs{seq_use:Nnnn} \meta{seq~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two} +% \cs{dim_to_pt:n} \Arg{dimexpr} % \end{syntax} -% Places the contents of the \meta{seq~var} in the input stream, with -% the appropriate \meta{separator} between the items. Namely, if the -% sequence has more than $2$ items, the \meta{separator between more -% than two} is placed between each pair of items except the last, -% for which the \meta{separator between final two} is used. If the -% sequence has $2$ items, then they are placed in the input stream -% separated by the \meta{separator between two}. If the sequence has -% $1$ item, it is placed in the input stream, and an empty sequence -% produces no output. An error will be raised if the variable does -% not exist or if it is invalid. -% -% For example, +% Evaluates the \meta{dimension expression}, and leaves the result, +% expressed in points (\texttt{pt}) in the input stream, with \emph{no +% units}. The result is rounded by \TeX{} to four or five decimal +% places. If the decimal part of the result is zero, it is omitted, +% together with the decimal marker. +% +% If the \meta{dimension expression} contains additional tokens such +% as redundant units, these will be ignored, so for example % \begin{verbatim} -% \seq_set_split:Nnn \l_tmpa_seq { | } { a | b | c | {de} | f } -% \seq_use:Nnnn \l_tmpa_seq { ~and~ } { ,~ } { ,~and~ } +% \dim_to_pt:n { 1 bp pt } % \end{verbatim} -% will insert \enquote{\texttt{a, b, c, de, and f}} in the input -% stream. The first separator argument is not used in this case -% because the sequence has more than $2$ items. -% \begin{texnote} -% The result is returned within the \tn{unexpanded} -% primitive (\cs{exp_not:n}), which means that the \meta{items} -% will not expand further when appearing in an \texttt{x}-type -% argument expansion. -% \end{texnote} +% leaves |1.00374| in the input stream, \emph{i.e.}~the magnitude of +% one \enquote{big point} when converted to points. % \end{function} % -% \section{Additions to \pkg{l3skip}} +% \begin{function}[added = 2013-05-06, EXP]{\dim_to_unit:nn} +% \begin{syntax} +% \cs{dim_to_unit:nn} \Arg{dimexpr_1} \Arg{dimexpr_2} +% \end{syntax} +% Evaluates the \meta{dimension expressions}, and leaves the value of +% \meta{dimexpr_1}, expressed in a unit given by \meta{dimexpr_2}, in +% the input stream. The result is a decimal number, rounded by \TeX{} +% to four or five decimal places. If the decimal part of the result +% is zero, it is omitted, together with the decimal marker. +% +% If the \meta{dimension expressions} contain additional tokens such +% as redundant units, these will be ignored, so for example +% \begin{verbatim} +% \dim_to_unit:nn { 1 bp pt } { 1 mm } +% \end{verbatim} +% leaves |0.35277| in the input stream, \emph{i.e.}~the magnitude of +% one \enquote{big point} when converted to millimeters. +% \end{function} % % \begin{function}{\skip_split_finite_else_action:nnNN} % \begin{syntax} @@ -940,8 +916,8 @@ % The next step is to work out the $x$ and $y$ coordinates of vertices of % the rotated box in relation to its original coordinates. The box can be % visualized with vertices $B$, $C$, $D$ and $E$ is illustrated -% (Figure~\ref{fig:rotation}). The vertex $O$ is the reference point on the -% baseline, and in this implementation is also the centre of rotation. +% (Figure~\ref{fig:l3candidates:rotation}). The vertex $O$ is the reference point +% on the baseline, and in this implementation is also the centre of rotation. % \begin{figure} % \centering % \setlength{\unitlength}{3pt}^^A @@ -958,7 +934,7 @@ % \put(21,59){O} % \end{picture} % \caption{Co-ordinates of a box prior to rotation.} -% \label{fig:rotation} +% \label{fig:l3candidates:rotation} % \end{figure} % The formulae are, for a point $P$ and angle $\alpha$: % \[ @@ -1602,7 +1578,7 @@ % any argument: this avoids losing braces. The argument % of \cs{tl_if_empty:oTF} is empty if |#1| is |?| followed % by blank spaces (besides, this particular variant of -% the emptyness test is optimized). If the item of the +% the emptiness test is optimized). If the item of the % comma list is blank, grab the next one. As soon as one % item is non-blank, exit: the second auxiliary will grab % \cs{prg_return_false:} as |#2|, unless every item in @@ -1628,62 +1604,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\clist_use:Nnnn} -% \begin{macro}[EXP, aux] -% {\@@_use:wwn, \@@_use:nwwwwnwn, \@@_use:nwwn} -% First check that the variable exists. Then count the items in the -% comma list. If it has none, output nothing. If it has one item, -% output that item, brace stripped (note that space-trimming has -% already been done when the comma list was assigned). If it has two, -% place the \meta{separator~between~two} in the middle. -% -% Otherwise, \cs{@@_use:nwwwwnwn} takes the following arguments; 1: -% a \meta{separator}, 2, 3, 4: three items from the comma list (or -% quarks), 5: the rest of the comma list, 6: a \meta{continuation} -% function (\texttt{use_ii} or \texttt{use_iii} with its -% \meta{separator} argument), 7: junk, and 8: the temporary result, -% which is built in a brace group following \cs{q_stop}. The -% \meta{separator} and the first of the three items are placed in the -% result, then we use the \meta{continuation}, placing the remaining -% two items after it. When we begin this loop, the three items really -% belong to the comma list, the first \cs{q_mark} is taken as a -% delimiter to the \texttt{use_ii} function, and the continuation is -% \texttt{use_ii} itself. When we reach the last two items of the -% original token list, \cs{q_mark} is taken as a third item, and now -% the seconf \cs{q_mark} serves as a delimiter to \texttt{use_ii}, -% switching to the other \meta{continuation}, \texttt{use_iii}, which -% uses the \meta{separator between final two}. -% \begin{macrocode} -\cs_new:Npn \clist_use:Nnnn #1#2#3#4 - { - \clist_if_exist:NTF #1 - { - \int_case:nnn { \clist_count:N #1 } - { - { 0 } { } - { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } } - { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} } - } - { - \exp_after:wN \@@_use:nwwwwnwn - \exp_after:wN { \exp_after:wN } #1 , - \q_mark , { \@@_use:nwwwwnwn {#3} } - \q_mark , { \@@_use:nwwn {#4} } - \q_stop { } - } - } - { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } - } -\cs_new:Npn \@@_use:wwn #1 , #2 , #3 { \exp_not:n { #1 #3 #2 } } -\cs_new:Npn \@@_use:nwwwwnwn - #1#2 , #3 , #4 , #5 \q_mark , #6#7 \q_stop #8 - { #6 {#3} , {#4} , #5 \q_mark , {#6} #7 \q_stop { #8 #1 #2 } } -\cs_new:Npn \@@_use:nwwn #1#2 , #3 \q_stop #4 - { \exp_not:n { #4 #1 #2 } } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Additions to \pkg{l3coffins}} % % \begin{macrocode} @@ -2260,25 +2180,24 @@ % \end{macro} % % \begin{macro}[EXP]{\prop_get:Nn, \prop_get:cn} -% \begin{macro}[aux, EXP]{\@@_get:Nn, \@@_get:No} % \begin{macro}[aux, EXP]{\@@_get_Nn:nwn} % Getting the value corresponding to a key in a property list in an -% expandable fashion is a simple instance of mapping some tokens. -% Map the function \cs{prop_get:nnn} which takes as its three -% arguments the \meta{key} that we are looking for, the current -% \meta{key} and the current \meta{value}. If the \meta{keys} match, -% the \meta{value} is returned. If none of the keys match, this expands -% to nothing. +% expandable fashion is similar to mapping some tokens. Go through +% the property list one \meta{key}--\meta{value} pair at a time: the +% arguments of \cs{@@_get_Nn:nwn} are the \meta{key} we are looking +% for, a \meta{key} of the property list, and its associated value. +% The \meta{keys} are compared (as strings). If they match, the +% \meta{value} is returned, within \cs{exp_not:n}. The loop +% terminates even if the \meta{key} is missing, and yields an empty +% value, because we have appended the appropriate +% \meta{key}--\meta{empty value} pair to the property list. % \begin{macrocode} \cs_new:Npn \prop_get:Nn #1#2 - { \@@_get:No #1 { \tl_to_str:n {#2} } } -\cs_new:Npn \@@_get:Nn #1#2 { - \exp_last_unbraced:Nno \@@_get_Nn:nwn {#2} #1 - \s_@@ #2 \s_@@ { } + \exp_last_unbraced:Noo \@@_get_Nn:nwn { \tl_to_str:n {#2} } #1 + \s_@@ \tl_to_str:n {#2} \s_@@ { } \__prg_break_point: } -\cs_generate_variant:Nn \@@_get:Nn { No } \cs_new:Npn \@@_get_Nn:nwn #1 \s_@@ #2 \s_@@ #3 { \str_if_eq_x:nnTF {#1} {#2} @@ -2289,7 +2208,6 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \subsection{Additions to \pkg{l3seq}} % @@ -2531,50 +2449,46 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\seq_use:Nnnn} -% \begin{macro}[EXP, aux] -% {\@@_use:NnNnn, \@@_use:nwwwwnwn, \@@_use:nwwn} -% See \cs{clist_use:Nnnn} for a general explanation. The main -% difference is that we use \cs{@@_item:n} as a delimiter rather than -% commas. We also need to add \cs{@@_item:n} at various places. +% \subsection{Additions to \pkg{l3skip}} +% +% \begin{macrocode} +%<@@=dim> +% \end{macrocode} +% +% \begin{macro}[EXP]{\dim_to_pt:n} +% A copy of the internal function \cs{@@_strip_pt:n}, which should +% perhaps be eliminated in favor of \cs{dim_to_pt:n}. % \begin{macrocode} -\cs_new:Npn \seq_use:Nnnn #1#2#3#4 +\cs_new_eq:NN \dim_to_pt:n \@@_strip_pt:n +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\dim_to_unit:nn} +% \begin{macro}[aux, EXP]{\@@_to_unit:n} +% An analog of \cs{dim_ratio:nn} that produces a decimal number as its +% result, rather than a rational fraction for use within dimension +% expressions. The naive implementation as +% \begin{verbatim} +% \cs_new:Npn \dim_to_unit:nn #1#2 +% { \dim_to_pt:n { 1pt * \dim_ratio:nn {#1} {#2} } } +% \end{verbatim} +% would not ignore trailing tokens (see documentation), so we need a +% bit more work. +% \begin{macrocode} +\cs_new:Npn \dim_to_unit:nn #1#2 { - \seq_if_exist:NTF #1 + \dim_to_pt:n { - \int_case:nnn { \seq_count:N #1 } - { - { 0 } { } - { 1 } { \exp_after:wN \@@_use:NnNnn #1 \@@_item:n { } { } } - { 2 } { \exp_after:wN \@@_use:NnNnn #1 {#2} } - } - { - \exp_after:wN \@@_use:nwwwwnwn - \exp_after:wN { \exp_after:wN } #1 \@@_item:n - \q_mark { \@@_use:nwwwwnwn {#3} } - \q_mark { \@@_use:nwwn {#4} } - \q_stop { } - } + 1pt * \@@_to_unit:n { \dim_to_pt:n {#1} pt } + / \@@_to_unit:n { \dim_to_pt:n {#2} pt } } - { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } } -\cs_new:Npn \@@_use:NnNnn \@@_item:n #1 \@@_item:n #2#3 - { \exp_not:n { #1 #3 #2 } } -\cs_new:Npn \@@_use:nwwwwnwn - #1 \@@_item:n #2 \@@_item:n #3 \@@_item:n #4#5 - \q_mark #6#7 \q_stop #8 - { - #6 \@@_item:n {#3} \@@_item:n {#4} #5 - \q_mark {#6} #7 \q_stop { #8 #1 #2 } - } -\cs_new:Npn \@@_use:nwwn #1 \@@_item:n #2 #3 \q_stop #4 - { \exp_not:n { #4 #1 #2 } } +\cs_new:Npn \@@_to_unit:n #1 + { \__int_value:w \@@_eval:w #1 \@@_eval_end: } % \end{macrocode} % \end{macro} % \end{macro} % -% \subsection{Additions to \pkg{l3skip}} -% % \begin{macrocode} %<@@=skip> % \end{macrocode} @@ -2613,7 +2527,7 @@ % There are four cases: empty token list, token list starting with % a normal token, with a brace group, or with a space token. % If the token list starts with a normal token, remove it -% and check for emptyness. Otherwise, compare with a single +% and check for emptiness. Otherwise, compare with a single % space, only case where we have a single token. % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } @@ -2668,7 +2582,7 @@ % \begin{macro}[EXP]{\tl_count_tokens:n} % \begin{macro}[EXP,aux]{\@@_act_count_normal:nN, % \@@_act_count_group:nn,\@@_act_count_space:n} -% The token coung is computed through an \cs{int_eval:n} construction. +% The token count is computed through an \cs{int_eval:n} construction. % Each \texttt{1+} is output to the \emph{left}, into the integer % expression, and the sum is ended by the \cs{c_zero} inserted by % \cs{@@_act_end:wn}. Somewhat a hack. @@ -2694,7 +2608,7 @@ % \end{macro} % % \begin{variable}{\c_@@_act_uppercase_tl, \c_@@_act_lowercase_tl} -% These constants contain the correspondance between lowercase +% These constants contain the correspondence between lowercase % and uppercase letters, in the form |aAbBcC...| and |AaBbCc...| % respectively. % \begin{macrocode} @@ -2715,7 +2629,7 @@ % \begin{macro}[EXP,aux]{\@@_act_case_normal:nN, % \@@_act_case_group:nn,\@@_act_case_space:n} % The only difference between uppercasing and lowercasing is -% the table of correspondance that is used. As for other +% the table of correspondence that is used. As for other % token list actions, we feed \cs{@@_act:NNNnn} three % functions, and this time, we use the \meta{parameters} % argument to carry which case-changing we are applying. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 333bbb9402a..1065a889bc5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -37,7 +37,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3clist.dtx 4414 2013-01-08 12:32:12Z bruno $ +\GetIdInfo$Id: l3clist.dtx 4500 2013-05-26 11:18:19Z bruno $ {L3 Comma separated lists} %</driver|package> %<*driver> @@ -420,6 +420,64 @@ % \emph{i.e.}~every item in a \meta{comma list} is unique. % \end{function} % +% \section{Using the content of comma lists directly} +% +% \begin{function}[EXP, added = 2013-05-26]{\clist_use:Nnnn, \clist_use:cnnn} +% \begin{syntax} +% \cs{clist_use:Nnnn} \meta{clist~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two} +% \end{syntax} +% Places the contents of the \meta{clist~var} in the input stream, +% with the appropriate \meta{separator} between the items. Namely, if +% the comma list has more than two items, the \meta{separator between +% more than two} is placed between each pair of items except the +% last, for which the \meta{separator between final two} is used. If +% the comma list has exactly two items, then they are placed in the input +% stream separated by the \meta{separator between two}. If the comma +% list has a single item, it is placed in the input stream, and a comma +% list with no items produces no output. An error will be raised if +% the variable does not exist or if it is invalid. +% +% For example, +% \begin{verbatim} +% \clist_set:Nn \l_tmpa_clist { a , b , , c , {de} , f } +% \clist_use:Nnnn \l_tmpa_clist { ~and~ } { ,~ } { ,~and~ } +% \end{verbatim} +% will insert \enquote{\texttt{a, b, c, de, and f}} in the input +% stream. The first separator argument is not used in this case +% because the comma list has more than $2$ items. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{items} +% will not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% +% \begin{function}[EXP, added = 2013-05-26]{\clist_use:Nn, \clist_use:cn} +% \begin{syntax} +% \cs{clist_use:Nn} \meta{clist~var} \Arg{separator} +% \end{syntax} +% Places the contents of the \meta{clist~var} in the input stream, +% with the \meta{separator} between the items. If the comma +% list has a single item, it is placed in the input stream, and a comma +% list with no items produces no output. An error will be raised if +% the variable does not exist or if it is invalid. +% +% For example, +% \begin{verbatim} +% \clist_set:Nn \l_tmpa_clist { a , b , , c , {de} , f } +% \clist_use:Nn \l_tmpa_clist { ~and~ } +% \end{verbatim} +% will insert \enquote{\texttt{a and b and c and de and f}} in the input +% stream. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{items} +% will not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% % \section{Comma lists as stacks} % % Comma lists can be used as stacks, where data is pushed to and popped @@ -1347,6 +1405,70 @@ % \end{macro} % \end{macro} % +% \subsection{Using comma lists} +% +% \begin{macro}[EXP]{\clist_use:Nnnn, \clist_use:cnnn} +% \begin{macro}[EXP, aux] +% {\@@_use:wwn, \@@_use:nwwwwnwn, \@@_use:nwwn} +% \begin{macro}[EXP]{\clist_use:Nn, \clist_use:cn} +% First check that the variable exists. Then count the items in the +% comma list. If it has none, output nothing. If it has one item, +% output that item, brace stripped (note that space-trimming has +% already been done when the comma list was assigned). If it has two, +% place the \meta{separator~between~two} in the middle. +% +% Otherwise, \cs{@@_use:nwwwwnwn} takes the following arguments; 1: +% a \meta{separator}, 2, 3, 4: three items from the comma list (or +% quarks), 5: the rest of the comma list, 6: a \meta{continuation} +% function (\texttt{use_ii} or \texttt{use_iii} with its +% \meta{separator} argument), 7: junk, and 8: the temporary result, +% which is built in a brace group following \cs{q_stop}. The +% \meta{separator} and the first of the three items are placed in the +% result, then we use the \meta{continuation}, placing the remaining +% two items after it. When we begin this loop, the three items really +% belong to the comma list, the first \cs{q_mark} is taken as a +% delimiter to the \texttt{use_ii} function, and the continuation is +% \texttt{use_ii} itself. When we reach the last two items of the +% original token list, \cs{q_mark} is taken as a third item, and now +% the second \cs{q_mark} serves as a delimiter to \texttt{use_ii}, +% switching to the other \meta{continuation}, \texttt{use_iii}, which +% uses the \meta{separator between final two}. +% \begin{macrocode} +\cs_new:Npn \clist_use:Nnnn #1#2#3#4 + { + \clist_if_exist:NTF #1 + { + \int_case:nnn { \clist_count:N #1 } + { + { 0 } { } + { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } } + { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} } + } + { + \exp_after:wN \@@_use:nwwwwnwn + \exp_after:wN { \exp_after:wN } #1 , + \q_mark , { \@@_use:nwwwwnwn {#3} } + \q_mark , { \@@_use:nwwn {#4} } + \q_stop { } + } + } + { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } + } +\cs_generate_variant:Nn \clist_use:Nnnn { c } +\cs_new:Npn \@@_use:wwn #1 , #2 , #3 { \exp_not:n { #1 #3 #2 } } +\cs_new:Npn \@@_use:nwwwwnwn + #1#2 , #3 , #4 , #5 \q_mark , #6#7 \q_stop #8 + { #6 {#3} , {#4} , #5 \q_mark , {#6} #7 \q_stop { #8 #1 #2 } } +\cs_new:Npn \@@_use:nwwn #1#2 , #3 \q_stop #4 + { \exp_not:n { #4 #1 #2 } } +\cs_new:Npn \clist_use:Nn #1#2 + { \clist_use:Nnnn #1 {#2} {#2} {#2} } +\cs_generate_variant:Nn \clist_use:Nn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Viewing comma lists} % % \begin{macro}{\clist_show:N, \clist_show:c} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 4696adddd6f..4fded9b0079 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3drivers.dtx 4280 2012-11-07 07:13:51Z joseph $ +\GetIdInfo$Id: l3drivers.dtx 4505 2013-06-28 22:06:04Z joseph $ {L3 Experimental drivers} %</driver|package> %<*driver> @@ -227,14 +227,14 @@ { \tex_special:D { ps:gsave } } %</dvips> %<*dvipdfmx|xdvipdfmx> - { \tex_special:D { pdf:bcontent } } + { \tex_special:D { pdf:content~q } } %</dvipdfmx|xdvipdfmx> \cs_new_protected_nopar:Npn \@@_graphic_state_restore: %<*dvips> { \tex_special:D { ps:grestore } } %</dvips> %<*dvipdfmx|xdvipdfmx> - { \tex_special:D { pdf:econtent } } + { \tex_special:D { pdf:content~Q } } %</dvipdfmx|xdvipdfmx> %</!pdfmode> % \end{macrocode} @@ -353,10 +353,32 @@ } %</!dvips> % \end{macrocode} +% For \texttt{(x)dvipdfmx} the is a bit more to do yet. Using +% \texttt{pdf:bcontent}/\texttt{pdf:econtent} for scoping seems the easiest +% approach, but only works reliably when all of the specials used are +% \texttt{pdf:\ldots} ones. As (some) PostScript specials can also be used +% with \texttt{(x)dvipdfmx}, that is not safe and can give unexpected output. +% To get everything in the right place, what is required is that the +% insertion point for the clip and the \TeX{} box material are the same. That +% is done by flipping the axes twice with an additional scope level in +% between. The scoping level moves to the \enquote{current point}, which +% due to the axis inversion is the \emph{start} of the clip. The second +% inversion puts things back to normal, the \TeX{} material is inserted and +% then the extra scope is closed (below). +% \begin{macrocode} +%<*dvipdfmx|xdvipdfmx> + \@@_pdf_matrix:n { -1~0~0~-1 } + \@@_graphic_state_save: + \@@_pdf_matrix:n { -1~0~0~-1 } +%</dvipdfmx|xdvipdfmx> +% \end{macrocode} % Insert the material in a box of no width, restore the graphic state % and then insert the necessary width. % \begin{macrocode} \hbox_overlap_right:n { \box_use:N #1 } +%<*dvipdfmx|xdvipdfmx> + \@@_graphic_state_restore: +%</dvipdfmx|xdvipdfmx> \@@_graphic_state_restore: \skip_horizontal:n { \box_wd:N #1 } } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 739acab95e5..9d19c801958 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3expan.dtx 4458 2013-02-03 15:49:37Z bruno $ +\GetIdInfo$Id: l3expan.dtx 4521 2013-07-09 11:45:31Z joseph $ {L3 Argument expansion} %</driver|package> %<*driver> @@ -78,7 +78,7 @@ % variants. % % \section{Defining new variants} -% \label{sec:defining-variants} +% \label{sec:l3expan:defining-variants} % % The definition of variant forms for base functions may be necessary % when writing new functions or when applying a kernel function in a @@ -117,7 +117,7 @@ % % \section{Methods for defining variants} % -% \begin{function}[updated = 2012-08-28]{\cs_generate_variant:Nn} +% \begin{function}[updated = 2013-07-09]{\cs_generate_variant:Nn} % \begin{syntax} % \cs{cs_generate_variant:Nn} \meta{parent control sequence} \Arg{variant argument specifiers} % \end{syntax} @@ -447,7 +447,7 @@ % \end{syntax} % These functions absorb the number of arguments given by their % specification, carry out the expansion -% indicated and leave the the results in the input stream, with the +% indicated and leave the results in the input stream, with the % last argument not surrounded by the usual braces. % Of these, the \texttt{:Nno}, \texttt{:Noo}, and \texttt{:Nfo} % variants need special (slower) processing. @@ -648,8 +648,8 @@ % point, and so is never going to be expandable.) % % The definition of expansion functions with this technique happens -% in section~\ref{sec:gendef}. -% In section~\ref{sec:handtune} some common cases are coded by a more direct +% in section~\ref{sec:l3expan:gendef}. +% In section~\ref{sec:l3expan:handtune} some common cases are coded by a more direct % method for efficiency, typically using calls to \cs{exp_after:wN}. % % \begin{variable}{\l_@@_internal_tl} @@ -877,7 +877,7 @@ % \end{macro} % % \subsection{Hand-tuned definitions} -% \label{sec:handtune} +% \label{sec:l3expan:handtune} % % One of the most important features of these functions is that they % are fully expandable and therefore allow to prefix them with @@ -1027,7 +1027,7 @@ % \end{macro} % % \subsection{Definitions with the automated technique} -% \label{sec:gendef} +% \label{sec:l3expan:gendef} % % Some of these could be done more efficiently, but the complexity of % coding then becomes an issue. Notice that the auto-generated functions diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index 67461fd01c9..6b76cf6b341 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3file.dtx 4446 2013-01-14 00:03:17Z bruno $ +\GetIdInfo$Id: l3file.dtx 4483 2013-05-01 10:57:41Z bruno $ {L3 File and I/O operations} %</driver|package> %<*driver> @@ -910,7 +910,7 @@ % auxiliary function does not issue an error if the file is not found. % \begin{macrocode} \prg_new_protected_conditional:Npnn \ior_open:Nn #1#2 { T , F , TF } - { \__file_name_sanitize:nn {#2} { \@@_open:NnTF #1 } } + { \__file_name_sanitize:nn {#2} { \@@_open_aux:NnTF #1 } } \cs_generate_variant:Nn \ior_open:NnT { c } \cs_generate_variant:Nn \ior_open:NnF { c } \cs_generate_variant:Nn \ior_open:NnTF { c } @@ -1374,7 +1374,7 @@ % \c_@@_wrap_indent_marker_tl, % \c_@@_wrap_unindent_marker_tl % } -% Every special action of the wrapping code is preceeded by +% Every special action of the wrapping code is preceded by % the same recognizable string, \cs{c_@@_wrap_marker_tl}. % Upon seeing that \enquote{word}, the wrapping code reads % one space-delimited argument to know what operation to @@ -1683,7 +1683,7 @@ % Deprecated on 2012-06-28, for removal by 2012-12-31. % % \begin{macro}{\iow_wrap:xnnnN} -% This was renamed and one unneed argument was removed. +% This was renamed and one unneeded argument was removed. % \begin{macrocode} %<*deprecated> \cs_new_protected:Npn \iow_wrap:xnnnN #1#2#3#4#5 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins new file mode 100644 index 00000000000..76fe0ee3e76 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3format.ins @@ -0,0 +1,92 @@ +\iffalse meta-comment + +File l3format.ins Copyright (C) 2011,2012 The LaTeX3 Project + +It may be distributed and/or modified under the conditions of the +LaTeX Project Public License (LPPL), either version 1.3c of this +license or (at your option) any later version. The latest version +of this license is in the file + + http://www.latex-project.org/lppl.txt + +This file is part of the "l3kernel bundle" (The Work in LPPL) +and all files in that bundle must be distributed together. + +The released version of this bundle is available from CTAN. + +\fi + +\let\jobname\relax +\input l3docstrip.dtx +\askforoverwritefalse + +\preamble + +EXPERIMENTAL CODE + +Do not distribute this file without also distributing the +source files specified above. + +Do not distribute a modified version of this file. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +\generate + { + \file{l3format.ltx} + { + \from{l3bootstrap.dtx} {initex} + \from{l3names.dtx} {initex} + \from{l3basics.dtx} {initex} + \from{l3expan.dtx} {initex} + \from{l3tl.dtx} {initex} + \from{l3seq.dtx} {initex} + % ===== ===FORMAT ONLY ========= + \from{l3alloc.dtx} {initex} + % ============================== + \from{l3int.dtx} {initex} + \from{l3quark.dtx} {initex} + \from{l3prg.dtx} {initex} + \from{l3clist.dtx} {initex} + \from{l3token.dtx} {initex} + \from{l3prop.dtx} {initex} + \from{l3msg.dtx} {initex} + \from{l3file.dtx} {initex} + \from{l3skip.dtx} {initex} + \from{l3keys.dtx} {initex} + \from{l3fp.dtx} {initex} + \from{l3fp-aux.dtx} {initex} + \from{l3fp-traps.dtx} {initex} + \from{l3fp-round.dtx} {initex} + \from{l3fp-parse.dtx} {initex} + \from{l3fp-logic.dtx} {initex} + \from{l3fp-basics.dtx} {initex} + \from{l3fp-extended.dtx}{initex} + \from{l3fp-expo.dtx} {initex} + \from{l3fp-trig.dtx} {initex} + \from{l3fp-convert.dtx} {initex} + \from{l3fp-assign.dtx} {initex} + \from{l3fp-old.dtx} {initex} + \from{l3box.dtx} {initex} + \from{l3coffins.dtx} {initex} + \from{l3color.dtx} {initex} + \from{l3luatex.dtx} {initex} + \from{l3candidates.dtx} {initex} + % ======== FORMAT ONLY ========= + \from{l3final.dtx} {initex} + % ============================== + } + } + +\generate{\file{l3dvips.ltx} {\from{l3drivers.dtx}{initex,dvips} }} +\generate{\file{l3pdfmode.ltx} {\from{l3drivers.dtx}{initex,pdfmode} }} +\generate{\file{l3xdvipdfmx.ltx}{\from{l3drivers.dtx}{initex,xdvipdfmx}}} + +\generate{\file{l3docstrip.tex}{\from{l3docstrip.dtx}{program}}} + +\endbatchfile
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index 6dee0ef45bc..cdc2e983983 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -36,7 +36,7 @@ % %<*driver> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-basics.dtx 4163 2012-08-30 16:33:11Z bruno $ +\GetIdInfo$Id: l3fp-basics.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Floating-point arithmetic} \documentclass[full]{l3doc} \begin{document} @@ -895,7 +895,7 @@ % \end{quote} % Note the three semicolons at the end of the definition. One is for % the last \cs{@@_mul_significand_drop:NNNNNw}; one is for -% \cs{@@_round_digit:Nw} later on; and one, preceeded by +% \cs{@@_round_digit:Nw} later on; and one, preceded by % \cs{exp_after:wN}, which is correctly expanded (within an % \cs{__int_eval:w}), is used by \cs{@@_basics_pack_low:NNNNNw}. % @@ -1020,7 +1020,7 @@ % exceptions display |/| rather than |*|. In the formula for % dispatch, we replace |- \c_two +| by |-|. The case of normal % numbers is treated using \cs{@@_div_npos_o:Nww} rather than -% \cs{@@_mul_npos_o:Nww}. There are two additionnal cases: if the +% \cs{@@_mul_npos_o:Nww}. There are two additional cases: if the % first operand is normal and the second is a zero, then the division % by zero exception is raised: cases $10$ and $11$ of the % \cs{if_case:w} construction in \cs{@@_mul_cases_o:NnNnww} are diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index d6f76c3b0c1..f0782a2eed4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -36,7 +36,7 @@ % %<*driver> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-expo.dtx 4163 2012-08-30 16:33:11Z bruno $ +\GetIdInfo$Id: l3fp-expo.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Floating-point exponential-related functions} \documentclass[full]{l3doc} \begin{document} @@ -96,7 +96,7 @@ % \ln (a \cdot 10^b) = b \cdot \ln (10) - \ln (c/5) + \ln (ac/5). % \end{equation*} % The logarithms $\ln(10)$ and $\ln(c/5)$ are looked up in a table. The -% last term is computed using the following Talor series of $\ln$ near +% last term is computed using the following Taylor series of $\ln$ near % $1$: % \begin{equation*} % \ln\left(\frac{ac}{5}\right) @@ -264,7 +264,7 @@ % both $A$ and $Z$ are arbitrary, in the range $[0.1,1)$, % and we had to monitor the growth of the sequence of % remainders $A$, $B$, $C$, etc. to ensure that no overflow -% occured during the computation of the next quotient. +% occurred during the computation of the next quotient. % The main source of risk was our choice to define the % quotient as roughly $10^9 \cdot A / 10^5 \cdot Z$: then % $A$ was bound to be below $2.147\cdots$, and this limit diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 9d5ff40b7ca..79e96d7715c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -36,7 +36,7 @@ % %<*driver> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-extended.dtx 4339 2012-11-24 19:16:43Z joseph $ +\GetIdInfo$Id: l3fp-extended.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Floating-point extended precision fixed-points} \documentclass[full]{l3doc} \begin{document} @@ -482,7 +482,7 @@ % $a_{1} \cdot b_{1}$ for $10^{-8}$, $(a_{1} \cdot b_{2} + a_{2} \cdot % b_{1})$ for $10^{-12}$, and $(a_{1} \cdot b_{3} + a_{2} \cdot b_{2} % + a_{3} \cdot b_{1} + c_{3} c_{4})$ for $10^{-16}$. The $a$--$b$ -% products huse the sign |#1|. Note that |#2| is empty for +% products use the sign |#1|. Note that |#2| is empty for % \cs{@@_fixed_one_minus_mul:wwn}. We call the \texttt{ii} auxiliary % for levels $10^{-20}$ and $10^{-24}$, keeping the pieces of \meta{a} % we've read, but not \meta{b}, since there is another copy later in diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index cd67aa2b2c1..a9e926bcaeb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -36,7 +36,7 @@ % %<*driver> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp-parse.dtx 4339 2012-11-24 19:16:43Z joseph $ +\GetIdInfo$Id: l3fp-parse.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Floating-point expression parsing} \documentclass[full]{l3doc} \begin{document} @@ -341,9 +341,9 @@ % and in red. Tokens that have not yet been read (and could % still be hidden in macros) are in gray. % -% In a first reading, the disinction between the \meta{precedence} +% In a first reading, the distinction between the \meta{precedence} % \fpPrecedence{+}, the operation \fpOperation{+}, and the character -% token |+| should not matter. It is only required to accomodate for +% token |+| should not matter. It is only required to accommodate for % multi-token infix operators such as |**|: indeed, when controlling % expansion, we need to skip over those tokens using \cs{exp_after:wN}, % and this only skips one token. Thus |**| needs to be replaced by a @@ -412,7 +412,7 @@ % taken care of by the same mechanism, and functions (\texttt{sin}, % \texttt{exp}, etc.) as well. Finding the argument of the unary % |-|, for instance, is very similar to grabbing the second operand -% of a binary infix operator, with a small subtelty on precedence +% of a binary infix operator, with a small subtlety on precedence % explained below. Once that argument is found, its sign can be % flipped. A left parenthesis is just a prefix operator which % removes the closing parenthesis (with some extra checks). @@ -866,9 +866,9 @@ % first token after \texttt{f}-expansion: % \begin{itemize} % \item \cs{tex_relax:D} in some form. That can be an internal -% floating point, a premature end, or an unitialized register. +% floating point, a premature end, or an uninitialized register. % \item A register. We interpret this as the significand of a floating -% point number. This is subtely different from unpacking it, for +% point number. This is subtly different from unpacking it, for % instance, \texttt{\cs{c_minus_one}**2} gives $1$, while % \texttt{-1**2} gives $-1$. % \item A digit, or a dot. That marks the start of the significand for @@ -1537,7 +1537,7 @@ % \begin{macro}[aux, rEXP]{\@@_parse_exponent:Nw} % This auxiliary is convenient to smuggle some material through % \cs{fi:} ending conditional processing. We place those \cs{fi:} -% (argument |#2|) at a very odd place becase this allows us to insert +% (argument |#2|) at a very odd place because this allows us to insert % \cs{__int_eval:w} \ldots{} there if needed. % \begin{macrocode} \cs_new:Npn \@@_parse_exponent:Nw #1 #2 \@@_parse_expand:w diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 09efdfdd58f..d4f0a435ec9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3fp.dtx 4449 2013-01-19 23:55:05Z bruno $ +\GetIdInfo$Id: l3fp.dtx 4521 2013-07-09 11:45:31Z joseph $ {L3 Floating points} %</driver|package> %<*driver> @@ -119,11 +119,11 @@ % Floating point numbers can be given either explicitly (in a form such % as |1.234e-34|, or |-.0001|), or as a stored floating point variable, % which is automatically replaced by its current value. See -% section~\ref{sec:fp-floats} for a description of what a floating point is, -% section~\ref{sec:fp-precedence} for details about how an expression is -% parsed, and section~\ref{sec:fp-operations} to know what the various +% section~\ref{sec:l3fp:fp-floats} for a description of what a floating point is, +% section~\ref{sec:l3fp:fp-precedence} for details about how an expression is +% parsed, and section~\ref{sec:l3fp:fp-operations} to know what the various % operations do. Some operations may raise exceptions (error messages), -% described in section~\ref{sec:fp-exceptions}. +% described in section~\ref{sec:l3fp:fp-exceptions}. % % An example of use could be the following. % \begin{verbatim} @@ -533,7 +533,7 @@ % \end{variable} % % \section{Floating point exceptions} -% \label{sec:fp-exceptions} +% \label{sec:l3fp:fp-exceptions} % % \emph{The functions defined in this section are experimental, and % their functionality may be altered or removed altogether.} @@ -637,7 +637,7 @@ % % \section{Floating point expressions} % -% \subsection{Input of floating point numbers} \label{sec:fp-floats} +% \subsection{Input of floating point numbers} \label{sec:l3fp:fp-floats} % % We support four types of floating point numbers: % \begin{itemize} @@ -705,7 +705,7 @@ % \texttt{exp(1)} or \cs{c_e_fp}. % % \subsection{Precedence of operators} -% \label{sec:fp-precedence} +% \label{sec:l3fp:fp-precedence} % % We list here all the operations supported in floating point % expressions, in order of decreasing precedence: operations listed @@ -731,7 +731,7 @@ % Functions are called on the value of their argument, contrarily to % \TeX{} macros. % -% \subsection{Operations} \label{sec:fp-operations} +% \subsection{Operations} \label{sec:l3fp:fp-operations} % % We now present the various operations allowed in floating point % expressions, from the lowest precedence to the highest. When used as @@ -789,7 +789,7 @@ % \cs{fp_eval:n} \{ \meta{operand_1} \meta{comparison} \meta{operand_2} \} % \end{syntax} % The \meta{comparison} consists of a non-empty string of |<|, |=|, -% |>|, and |?|, optionally preceeded by |!|. It may not start with +% |>|, and |?|, optionally preceded by |!|. It may not start with % |?|. This evaluates to $+1$ if the \meta{comparison} between the % \meta{operand_1} and \meta{operand_2} is true, and $+0$ otherwise. % \end{function} @@ -879,7 +879,7 @@ % \cs{fp_eval:n} \{ |max(| \meta{fpexpr_1} |,| \meta{fpexpr_2} |,| \ldots{} |)| \} % \cs{fp_eval:n} \{ |min(| \meta{fpexpr_1} |,| \meta{fpexpr_2} |,| \ldots{} |)| \} % \end{syntax} -% Evalutes each \meta{fpexpr} and computes the largest (smallest) of +% Evaluates each \meta{fpexpr} and computes the largest (smallest) of % those. If any of the \meta{fpexpr} is a \nan{}, the result is % \nan{}. Those operations do not raise exceptions. % \end{function} @@ -1081,7 +1081,7 @@ % \begin{itemize} % \item Optimize argument reduction for trigonometric functions: we % don't need $6\times 4$ digits here, only $4\times 4$. -% \item In subsection~\ref{sec:fp-floats}, write a grammar. +% \item In subsection~\ref{sec:l3fp:fp-floats}, write a grammar. % \item Fix the |TWO BARS| business with the index. % \item It would be nice if the \texttt{parse} auxiliaries for each % operation were set up in the corresponding module, rather than diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index dcea709ebbc..f1f034553aa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3int.dtx 4444 2013-01-13 20:27:20Z bruno $ +\GetIdInfo$Id: l3int.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Integers} %</driver|package> %<*driver> @@ -949,7 +949,7 @@ % \begin{macro}{\int_eval:n} % Wrapper for \cs{@@_eval:w}. Can be used in an integer expression % or directly in the input stream. In format mode, there is already -% a definition in \pkg{l3alloc} for bookstrapping, which is therefore +% a definition in \pkg{l3alloc} for bootstrapping, which is therefore % corrected to the \enquote{real} version here. % \begin{macrocode} %<*initex> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 3d38853224a..3ad30990c73 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3keys.dtx 4461 2013-02-24 18:55:17Z joseph $ +\GetIdInfo$Id: l3keys.dtx 4544 2013-07-12 07:14:52Z joseph $ {L3 Experimental key-value interfaces} %</driver|package> %<*driver> @@ -68,21 +68,22 @@ % \begin{documentation} % % The key--value method is a popular system for creating large numbers -% of settings for controlling function or package behaviour. For the -% user, the system normally results in input of the form +% of settings for controlling function or package behaviour. The +% system normally results in input of the form % \begin{verbatim} -% \PackageControlMacro{ +% \MyModuleSetup{ % key-one = value one, % key-two = value two % } % \end{verbatim} % or % \begin{verbatim} -% \PackageMacro[ +% \MyModuleMacro[ % key-one = value one, % key-two = value two -% ]{argument}. +% ]{argument} % \end{verbatim} +% for the user. % % The high level functions here are intended as a method to create % key--value controls. Keys are themselves created using a key--value @@ -90,15 +91,15 @@ % required. Each key is created by setting one or more \emph{properties} % of the key: % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % key-one .code:n = code including parameter #1, -% key-two .tl_set:N = \l_module_store_tl +% key-two .tl_set:N = \l_mymodule_store_tl % } % \end{verbatim} % These values can then be set as with other key--value approaches: % \begin{verbatim} -% \keys_set:nn { module } +% \keys_set:nn { mymodule } % { % key-one = value one, % key-two = value two @@ -108,15 +109,15 @@ % At a document level, \cs{keys_set:nn} will be used within a % document function, for example % \begin{verbatim} -% \DeclareDocumentCommand \SomePackageSetup { m } -% { \keys_set:nn { module } { #1 } } -% \DeclareDocumentCommand \SomePackageMacro { o m } -% { -% \group_begin: -% \keys_set:nn { module } { #1 } -% % Main code for \SomePackageMacro -% \group_end: -% } +% \DeclareDocumentCommand \MyModuleSetup { m } +% { \keys_set:nn { mymodule } { #1 } } +% \DeclareDocumentCommand \MyModuleMacro { o m } +% { +% \group_begin: +% \keys_set:nn { mymodule } { #1 } +% % Main code for \MyModuleMacro +% \group_end: +% } % \end{verbatim} % % Key names may contain any tokens, as they are handled internally @@ -126,13 +127,13 @@ % groups. Functions and variables are \emph{not} expanded when creating % key names, and so % \begin{verbatim} -% \tl_set:Nn \l_module_tmp_tl { key } -% \keys_define:nn { module } +% \tl_set:Nn \l_mymodule_tmp_tl { key } +% \keys_define:nn { mymodule } % { -% \l_module_tmp_tl .code:n = code +% \l_mymodule_tmp_tl .code:n = code % } % \end{verbatim} -% will create a key called \cs{l_module_tmp_tl}, and not one called +% will create a key called \cs{l_mymodule_tmp_tl}, and not one called % \texttt{key}. % % \section{Creating keys} @@ -164,32 +165,36 @@ % \end{function} % % The various properties available take either no arguments at -% all, or require exactly one argument. This is indicated in the +% all, or require one or more arguments. This is indicated in the % name of the property using an argument specification. In the following % discussion, each property is illustrated attached to an % arbitrary \meta{key}, which when used may be supplied with a % \meta{value}. All key \emph{definitions} are local. % -% \begin{function}{.bool_set:N, .bool_gset:N} +% \begin{function}[updated = 2013-07-08] +% {.bool_set:N, .bool_set:c, .bool_gset:N, .bool_gset:c} % \begin{syntax} % \meta{key} .bool_set:N = \meta{boolean} % \end{syntax} % Defines \meta{key} to set \meta{boolean} to \meta{value} (which % must be either \texttt{true} or \texttt{false}). If the variable -% does not exist, it will be created at the point that the key is -% set up. +% does not exist, it will be created globally at the point that +% the key is set up. % \end{function} % -% \begin{function}[added = 2011-08-28] -% {.bool_set_inverse:N, .bool_gset_inverse:N} +% \begin{function}[added = 2011-08-28, updated = 2013-07-08] +% { +% .bool_set_inverse:N, .bool_set_inverse:c, +% .bool_gset_inverse:N, .bool_gset_inverse:c +% } % \begin{syntax} % \meta{key} .bool_set_inverse:N = \meta{boolean} % \end{syntax} % Defines \meta{key} to set \meta{boolean} to the logical % inverse of \meta{value} (which must be either \texttt{true} or % \texttt{false}). -% If the \meta{boolean} does not exist, it will be created at the point -% that the key is set up. +% If the \meta{boolean} does not exist, it will be created globally +% at the point that the key is set up. % \end{function} % % \begin{function}{.choice:} @@ -198,10 +203,11 @@ % \end{syntax} % Sets \meta{key} to act as a choice key. Each valid choice % for \meta{key} must then be created, as discussed in -% section~\ref{sec:choice}. +% section~\ref{sec:l3keys:choice}. % \end{function} % -% \begin{function}[added = 2011-08-21]{.choices:nn} +% \begin{function}[added = 2011-08-21, updated = 2013-07-10] +% {.choices:nn, .choices:Vn, .choices:on, .choices:xn} % \begin{syntax} % \meta{key} .choices:nn \meta{choices} \meta{code} % \end{syntax} @@ -210,22 +216,10 @@ % \cs{l_keys_choice_tl} will be the name of the choice made, and % \cs{l_keys_choice_int} will be the position of the choice in the list % of \meta{choices} (indexed from~$1$). -% Choices are discussed in detail in section~\ref{sec:choice}. +% Choices are discussed in detail in section~\ref{sec:l3keys:choice}. % \end{function} % -% \begin{function}{.choice_code:n, .choice_code:x} -% \begin{syntax} -% \meta{key} .choice_code:n = \meta{code} -% \end{syntax} -% Stores \meta{code} for use when \texttt{.generate_choices:n} creates -% one or more choice sub-keys of the current key. Inside \meta{code}, -% \cs{l_keys_choice_tl} will expand to the name of the choice made, and -% \cs{l_keys_choice_int} will be the position of the choice in the list -% given to \texttt{.generate_choices:n}. Choices are discussed in -% detail in section~\ref{sec:choice}. -% \end{function} -% -% \begin{function}[added=2011/09/11] +% \begin{function}[added=2011-09-11] % {.clist_set:N, .clist_set:c, .clist_gset:N, .clist_gset:c} % \begin{syntax} % \meta{key} .clist_set:N = \meta{comma list variable} @@ -233,21 +227,22 @@ % Defines \meta{key} to set \meta{comma list variable} to \meta{value}. % Spaces around commas and empty items will be stripped. % If the variable does not exist, it -% will be created at the point that the key is set up. +% will be created globally at the point that the key is set up. % \end{function} % -% \begin{function}{.code:n, .code:x} +% \begin{function}[updated = 2013-07-10]{.code:n} % \begin{syntax} % \meta{key} .code:n = \meta{code} % \end{syntax} % Stores the \meta{code} for execution when \meta{key} is used. The -% The \meta{code} can include one parameter ("#1"), which will be the +% The \meta{code} can include one parameter (|#1|), which will be the % \meta{value} given for the \meta{key}. The \texttt{x}-type variant % will expand \meta{code} at the point where the \meta{key} is % created. % \end{function} % -% \begin{function}{.default:n, .default:V} +% \begin{function}[updated = 2013-07-09] +% {.default:n, .default:V, .default:o, .default:x} % \begin{syntax} % \meta{key} .default:n = \meta{default} % \end{syntax} @@ -255,12 +250,12 @@ % value is given. This will be used if only the key name is given, % but not if a blank \meta{value} is given: % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % key .code:n = Hello~#1, % key .default:n = World % } -% \keys_set:nn { module } +% \keys_set:nn { mymodule } % { % key = Fred, % Prints 'Hello Fred' % key, % Prints 'Hello World' @@ -275,7 +270,7 @@ % \end{syntax} % Defines \meta{key} to set \meta{dimension} to \meta{value} (which % must a dimension expression). If the variable does not exist, it -% will be created at the point that the key is set up. +% will be created globally at the point that the key is set up. % \end{function} % % \begin{function}{.fp_set:N, .fp_set:c, .fp_gset:N, .fp_gset:c} @@ -283,29 +278,18 @@ % \meta{key} .fp_set:N = \meta{floating point} % \end{syntax} % Defines \meta{key} to set \meta{floating point} to \meta{value} -% (which must a floating point number). If the variable does not exist, -% it will be created at the point that the key is set up. +% (which must a floating point expression). If the variable does not exist, +% it will be created globally at the point that the key is set up. % \end{function} % -% \begin{function}{.generate_choices:n} -% \begin{syntax} -% \meta{key} .generate_choices:n = \Arg{list} -% \end{syntax} -% This property will mark \meta{key} as a multiple choice key, -% and will use the \meta{list} to define the choices. The \meta{list} -% should consist of a comma-separated list of choice names. Each -% choice will be set up to execute \meta{code} as set using -% \texttt{.choice_code:n} (or \texttt{.choice_code:x}). Choices are -% discussed in detail in section~\ref{sec:choice}. -% \end{function} -% -% \begin{function}[added = 2012-06-02]{.initial:n, .initial:V} +% \begin{function}[updated = 2013-07-09] +% {.initial:n, .initial:V, .initial:o, .initial:x} % \begin{syntax} % \meta{key} .initial:n = \meta{value} % \end{syntax} % Initialises the \meta{key} with the \meta{value}, equivalent to % \begin{quote} -% \cs{keys_set:nn} \marg{module} \{ \meta{key} = \meta{value} \} +% \cs{keys_set:nn} \Arg{module} \{ \meta{key} = \meta{value} \} % \end{quote} % \end{function} % @@ -315,10 +299,10 @@ % \end{syntax} % Defines \meta{key} to set \meta{integer} to \meta{value} (which % must be an integer expression). If the variable does not exist, it -% will be created at the point that the key is set up. +% will be created globally at the point that the key is set up. % \end{function} % -% \begin{function}{.meta:n, .meta:x} +% \begin{function}[updated = 2013-07-10]{.meta:n} % \begin{syntax} % \meta{key} .meta:n = \Arg{keyval list} % \end{syntax} @@ -327,6 +311,17 @@ % is used, then the value will be passed through to the subsidiary % \meta{keys} for processing (as |#1|). % \end{function} +% +% \begin{function}[added = 2013-07-10]{.meta:nn} +% \begin{syntax} +% \meta{key} .meta:nn = \Arg{path} \Arg{keyval list} +% \end{syntax} +% Makes \meta{key} a meta-key, which will set \meta{keyval list} in +% one go using the \meta{path} in place of the current one. +% If \meta{key} is given with a value at the time the key +% is used, then the value will be passed through to the subsidiary +% \meta{keys} for processing (as |#1|). +% \end{function} % % \begin{function}[added = 2011-08-21]{.multichoice:} % \begin{syntax} @@ -334,12 +329,11 @@ % \end{syntax} % Sets \meta{key} to act as a multiple choice key. Each valid choice % for \meta{key} must then be created, as discussed in -% section~\ref{sec:choice}. -% -% \textbf{This property is experimental.} +% section~\ref{sec:l3keys:choice}. % \end{function} % -% \begin{function}[added = 2011-08-21]{.multichoices:nn} +% \begin{function}[added = 2011-08-21, updated = 2013-07-10] +% {.multichoices:nn, .multichoices:Vn, .multichoices:on, .multichoices:xn} % \begin{syntax} % \meta{key} .multichoices:nn \meta{choices} \meta{code} % \end{syntax} @@ -349,9 +343,7 @@ % \cs{l_keys_choice_tl} will be the name of the choice made, and % \cs{l_keys_choice_int} will be the position of the choice in the list % of \meta{choices} (indexed from~$1$). -% Choices are discussed in detail in section~\ref{sec:choice}. -% -% \textbf{This property is experimental.} +% Choices are discussed in detail in section~\ref{sec:l3keys:choice}. % \end{function} % % \begin{function}{.skip_set:N, .skip_set:c, .skip_gset:N, .skip_gset:c} @@ -360,7 +352,7 @@ % \end{syntax} % Defines \meta{key} to set \meta{skip} to \meta{value} (which % must be a skip expression). If the variable does not exist, it -% will be created at the point that the key is set up. +% will be created globally at the point that the key is set up. % \end{function} % % \begin{function}{.tl_set:N, .tl_set:c, .tl_gset:N, .tl_gset:c} @@ -368,8 +360,8 @@ % \meta{key} .tl_set:N = \meta{token list variable} % \end{syntax} % Defines \meta{key} to set \meta{token list variable} to \meta{value}. -% If the variable does not exist, it will be created at the point that -% the key is set up. +% If the variable does not exist, it will be created globally +% at the point that the key is set up. % \end{function} % % \begin{function}{.tl_set_x:N, .tl_set_x:c, .tl_gset_x:N, .tl_gset_x:c} @@ -379,7 +371,7 @@ % Defines \meta{key} to set \meta{token list variable} to \meta{value}, % which will be subjected to an \texttt{x}-type expansion % (\emph{i.e.}~using \cs{tl_set:Nx}). If the variable does not exist, -% it will be created at the point that the key is set up. +% it will be created globally at the point that the key is set up. % \end{function} % % \begin{function}{.value_forbidden:} @@ -410,7 +402,7 @@ % \end{verbatim} % or to the key name: % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { subgroup / key .code:n = code } % \end{verbatim} % As illustrated, the best choice of token for sub-dividing keys in @@ -422,7 +414,7 @@ % particularly relevant to making multiple choices. % % \section{Choice and multiple choice keys} -% \label{sec:choice} +% \label{sec:l3keys:choice} % % The \pkg{l3keys} system supports two types of choice key, in which a series % of pre-defined input values are linked to varying implementations. Choice @@ -433,7 +425,7 @@ % Mutually-exclusive choices are created by setting the \texttt{.choice:} % property: % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { key .choice: } % \end{verbatim} % For keys which are set up as choices, the valid choices are generated @@ -442,53 +434,29 @@ % % In many cases, choices execute similar code which is dependant only % on the name of the choice or the position of the choice in the -% list of choices. Here, the keys can share the same code, and can -% be rapidly created using the \texttt{.choice_code:n} and -% \texttt{.generate_choices:n} properties: -% \begin{verbatim} -% \keys_define:nn { module } -% { -% key .choice_code:n = -% { -% You~gave~choice~'\int_use:N \l_keys_choice_tl',~ -% which~is~in~position~ -% \int_use:N \l_keys_choice_int \c_space_tl -% in~the~list. -% }, -% key .generate_choices:n = -% { choice-a, choice-b, choice-c } -% } -% \end{verbatim} -% Following common computing practice, \cs{l_keys_choice_int} is -% indexed from~$1$. -% -% The same approach is also implemented by the \emph{experimental} -% property \texttt{.choices:nn}. This combines the functionality of -% \texttt{.choice_code:n} and \texttt{.generate_choices:n} into one -% property: +% list of all possibilities. Here, the keys can share the same code, and can +% be rapidly created using the \texttt{.choices:nn} property. % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % key .choices:nn = % { choice-a, choice-b, choice-c } % { -% You~gave~choice~'\int_use:N \l_keys_choice_tl',~ -% which~is~in~position~ -% \int_use:N \l_keys_choice_int \c_space_tl +% You~gave~choice~'\tl_use:N \l_keys_choice_tl',~ +% which~is~in~position~\int_use:N \l_keys_choice_int \c_space_tl % in~the~list. % } % } % \end{verbatim} -% Note that the \texttt{.choices:nn} property should \emph{not} be mixed with -% use of \texttt{.generate_choices:n}. +% The index \cs{l_keys_choice_int} in the list of choices starts at~$1$. % % \begin{variable}{\l_keys_choice_int, \l_keys_choice_tl} -% Inside the code block for a choice generated using -% \texttt{.generate_choice:} or \texttt{.choices:nn}, -% the variables \cs{l_keys_choice_tl} and -% \cs{l_keys_choice_int} are available to indicate the name of the -% current choice, and its position in the comma list. The position -% is indexed from $0$. +% Inside the code block for a choice generated using \texttt{.choices:nn}, +% the variables \cs{l_keys_choice_tl} and \cs{l_keys_choice_int} are +% available to indicate the name of the current choice, and its position in +% the comma list. The position is indexed from~$1$. Note that, as with +% standard key code generated using \texttt{.code:n}, the value passed to +% the key (i.e.~the choice name) is also available as |#1|. % \end{variable} % % On the other hand, it is sometimes useful to create choices which @@ -496,32 +464,54 @@ % by setting the \texttt{.choice:} property of a key, then manually % defining sub-keys. % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % key .choice:, % key / choice-a .code:n = code-a, % key / choice-b .code:n = code-b, % key / choice-c .code:n = code-c, % } -%\end{verbatim} +% \end{verbatim} % % It is possible to mix the two methods, but manually-created choices % should \emph{not} use \cs{l_keys_choice_tl} or \cs{l_keys_choice_int}. % These variables do not have defined behaviour when used outside of -% code created using \texttt{.generate_choices:n} +% code created using \texttt{.choices:nn} % (\emph{i.e.}~anything might happen). -% +% +% It is possible to allow choice keys to take values which have not previously +% been defined by adding code for the special \texttt{unknown} choice. The +% general behavior of the \texttt{unknown} key is described in +% Section~\ref{sec:l3keys:unknown}. A typical example in the case of a choice +% would be to issue a custom error message: +% \begin{verbatim} +% \keys_define:nn { mymodule } +% { +% key .choice:, +% key / choice-a .code:n = code-a, +% key / choice-b .code:n = code-b, +% key / choice-c .code:n = code-c, +% key / unknown .code:n = +% \msg_error:nnxxx { mymodule } { unknown-choice } +% { key } % Name of choice key +% { choice-a , choice-b , choice-c } % Valid choices +% { \exp_not:n {#1} } % Invalid choice given +% % +% % +% } +% \end{verbatim} +% % Multiple choices are created in a very similar manner to mutually-exclusive % choices, using the properties \texttt{.multichoice:} and % \texttt{.multichoices:nn}. As with mutually exclusive choices, multiple % choices are define as sub-keys. Thus both % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % key .multichoices:nn = % { choice-a, choice-b, choice-c } % { -% You~gave~choice~'\int_use:N \l_keys_choice_tl',~ +% You~gave~choice~'\tl_use:N \l_keys_choice_tl',~ % which~is~in~position~ % \int_use:N \l_keys_choice_int \c_space_tl % in~the~list. @@ -530,28 +520,36 @@ % \end{verbatim} % and % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % key .multichoice:, % key / choice-a .code:n = code-a, % key / choice-b .code:n = code-b, % key / choice-c .code:n = code-c, % } -%\end{verbatim} -% are valid. The \texttt{.multichoices:nn} property causes -% \cs{l_keys_choice_tl} and \cs{l_keys_choice_int} to be set in exactly -% the same way as described for \texttt{.choices:nn}. -% -% When multiple choice keys are set, the value is treated as a comma-separated -% list: +% \end{verbatim} +% are valid. +% +% When a multiple choice key is set % \begin{verbatim} -% \keys_set:nn { module } +% \keys_set:nn { mymodule } % { % key = { a , b , c } % 'key' defined as a multiple choice % } -%\end{verbatim} -% Each choice will be applied in turn, with the usual handling of unknown -% values. +% \end{verbatim} +% each choice is applied in turn, equivalent to a \texttt{clist} mapping or +% to applying each value individually: +% \begin{verbatim} +% \keys_set:nn { mymodule } +% { +% key = a , +% key = b , +% key = c , +% } +% \end{verbatim} +% Thus each separate choice will have passed to it the +% \cs{l_keys_choice_tl} and \cs{l_keys_choice_int} in exactly +% the same way as described for \texttt{.choices:nn}. % % \section{Setting keys} % @@ -565,37 +563,51 @@ % by defining a special \texttt{unknown} key: this will be illustrated % later. % \end{function} +% +% \begin{variable}{\l_keys_key_tl, \l_keys_path_tl, \l_keys_value_tl} +% For each key processed, information of the full \emph{path} of the +% key, the \emph{name} of the key and the \emph{value} of the key is +% available within three token list variables. These may be used within +% the code of the key. +% +% The \emph{value} is everything after the \texttt{=}, which may be +% empty if no value was given. This is stored in \cs{l_keys_value_tl}, and +% is not processed in any way by \cs{keys_set:nn}. +% +% The \emph{path} of the key is a \enquote{full} description of the key, +% and is unique for each key. It consists of the module and full key name, +% thus for example +% \begin{verbatim} +% \keys_set:nn { mymodule } { key-a = some-value } +% \end{verbatim} +% has path \texttt{mymodule/key-a} while +% \begin{verbatim} +% \keys_set:nn { mymodule } { subset / key-a = some-value } +% \end{verbatim} +% has path \texttt{mymodule/subset/key-a}. This information is stored in +% \cs{l_keys_path_tl}, and will have been processed by \cs{tl_to_str:n}. +% +% The \emph{name} of the key is the part of the path after the last +% \texttt{/}, and thus is not unique. In the preceding examples, both keys +% have name \texttt{key-a} despite having different paths. This information +% is stored in \cs{l_keys_key_tl}, and will have been processed by +% \cs{tl_to_str:n}. +% \end{variable} +% +% \section{Handling of unknown keys} +% \label{sec:l3keys:unknown} % -% If a key is not known, \cs{keys_set:nn} will look for a special -% \texttt{unknown} key for the same module. This mechanism can be -% used to create new keys from user input. +% If a key has not previously been defined (is unknown), \cs{keys_set:nn} will +% look for a special \texttt{unknown} key for the same module, and if this is +% not defined raises an error indicating that the key name was unknown. This +% mechanism can be used for example to issue custom error texts. % \begin{verbatim} -% \keys_define:nn { module } +% \keys_define:nn { mymodule } % { % unknown .code:n = % You~tried~to~set~key~'\l_keys_key_tl'~to~'#1'. % } -%\end{verbatim} -% -% \begin{variable}{\l_keys_key_tl} -% When processing an unknown key, the name of the key is available -% as \cs{l_keys_key_tl}. Note that this will have been processed -% using \cs{tl_to_str:n}. -% \end{variable} -% -% \begin{variable}{\l_keys_path_tl} -% When processing an unknown key, the path of the key used is available -% as \cs{l_keys_path_tl}. Note that this will have been processed -% using \cs{tl_to_str:n}. -% \end{variable} -% -% \begin{variable}{\l_keys_value_tl} -% When processing an unknown key, the value of the key is available as -% \cs{l_keys_value_tl}. Note that this will be empty if no value was given -% for the key. -% \end{variable} -% -% \section{Setting known keys only} +% \end{verbatim} % % \begin{function}[added = 2011-08-23] % { @@ -603,13 +615,16 @@ % \keys_set_known:nvN, \keys_set_known:noN % } % \begin{syntax} -% \cs{keys_set_known:nn} \Arg{module} \Arg{keyval list} \meta{clist} +% \cs{keys_set_known:nn} \Arg{module} \Arg{keyval list} \meta{tl} % \end{syntax} -% Parses the \meta{keyval list}, and sets those keys which are defined -% for \meta{module}. Any keys which are unknown are not processed further -% by the parser. +% In some cases, the desired behavior is to simply ignore unknown keys, +% collecting up information on these for later processing. The +% \cs{keys_set_known:nnN} function parses the \meta{keyval list}, and sets +% those keys which are defined for \meta{module}. Any keys which are unknown +% are not processed further by the parser. % The key--value pairs for each \emph{unknown} key name will be -% stored in the \meta{clist}. +% stored in the \meta{tl} in a comma-separated form (\emph{i.e.}~an edited +% version of the \meta{keyval list}). % \end{function} % % \section{Utility functions for keys} @@ -629,7 +644,7 @@ % \cs{keys_if_choice_exist:nnnTF} \meta{module} \meta{key} \meta{choice} \Arg{true code} \Arg{false code} % \end{syntax} % Tests if the \meta{choice} is defined for the \meta{key} within the -% \meta{module},, \emph{i.e.}~if any code has been defined for +% \meta{module}, \emph{i.e.}~if any code has been defined for % \meta{key}/\meta{choice}. The test is \texttt{false} if the \meta{key} % itself is not defined. % \end{function} @@ -657,7 +672,7 @@ % braces, spaces and the category codes of separators. % % While the functions described earlier are used as a high-level interface -% for processing such input, in especial circumstances you may wish to use +% for processing such input, in special circumstances you may wish to use % a lower-level approach. % The low-level parsing system converts a \meta{key--value list} % into \meta{keys} and associated \meta{values}. After the parsing phase @@ -665,15 +680,16 @@ % available for further processing. This processing is not carried out by the % low-level parser itself, and so the parser requires the names of % two functions along with the key--value list. One function is -% needed to process key--value pairs (\emph{i.e}~two arguments), -% and a second function if required for keys given without arguments -% (\emph{i.e.}~a single argument). +% needed to process key--value pairs (it receives two arguments), +% and a second function is required for keys given without any value +% (it is called with a single argument). % -% The parser does not double |#| tokens or expand any input. The tokens -% |=| and |,| are corrected so that the parser does not \enquote{miss} +% The parser does not double |#| tokens or expand any input. Active +% tokens |=| and |,| appearing at the outer level of braces are converted +% to category \enquote{other} (12) so that the parser does not \enquote{miss} % any due to category code changes. Spaces are removed from the ends -% of the keys and values. Values which are given in braces will have -% exactly one set removed, thus +% of the keys and values. Keys and values which are given in braces +% will have exactly one set removed (after space trimming), thus % \begin{verbatim} % key = {value here}, % \end{verbatim} @@ -710,8 +726,8 @@ % Note that there is a difference between an empty value (an equals % sign followed by nothing) and a missing value (no equals sign at % all). Spaces are trimmed from the ends of the \meta{key} and \meta{value}, -% and any \emph{outer} set of braces are removed from the \meta{value} as -% part of the processing. +% then one \emph{outer} set of braces is removed from the \meta{key} +% and \meta{value} as part of the processing. % \end{function} % % \end{documentation} @@ -733,7 +749,7 @@ % \end{macrocode} % % \subsection{Low-level interface} -% +% % \begin{macrocode} %<@@=keyval> % \end{macrocode} @@ -741,7 +757,8 @@ % For historical reasons this code uses the `keyval' module prefix. % % \begin{variable}{\g_@@_level_int} -% For nesting purposes an integer is needed for the current level. +% To allow nesting of \cs{keyval_parse:NNn}, an integer is needed for +% the current level. % \begin{macrocode} \int_new:N \g_@@_level_int % \end{macrocode} @@ -763,8 +780,8 @@ \tl_new:N \l_@@_sanitise_tl \tl_new:N \l_@@_parse_tl % \end{macrocode} -%\end{variable} -%\end{variable} +% \end{variable} +% \end{variable} % % \begin{macro}{\@@_parse:n} % The parsing function first deals with the category codes for @@ -817,7 +834,7 @@ % \end{macro} % % \begin{macro}{\@@_split_key_value:w} -% \begin{macro}[aux]{\@@_split_key_value:wTF} +% \begin{macro}[aux, EXP]{\@@_split_key_value:wTF} % The key and value are handled separately. First the key is grabbed and % saved as \cs{l_@@_key_tl}. Then a check is need to see if there is % a value at all: if not then the key name is simply added to the output. @@ -946,7 +963,7 @@ % \end{macrocode} % % \subsection{Constants and variables} -% +% % \begin{macrocode} %<@@=keys> % \end{macrocode} @@ -1081,8 +1098,11 @@ \cs_if_exist:cTF { \c_@@_props_root_tl \l_@@_property_tl } { \@@_define_key:n {#2} } { - \__msg_kernel_error:nnxx { kernel } { property-unknown } - { \l_@@_property_tl } { \l_keys_path_tl } + \str_if_eq_x:nnF { \l_@@_property_tl } { .abort: } + { + \__msg_kernel_error:nnxx { kernel } { property-unknown } + { \l_@@_property_tl } { \l_keys_path_tl } + } } } % \end{macrocode} @@ -1101,7 +1121,10 @@ \tl_set:Nx \l_keys_path_tl { \l_@@_module_tl / } \tl_if_in:nnTF {#1} { . } { \@@_property_find:w #1 \q_stop } - { \__msg_kernel_error:nnx { kernel } { key-no-property } {#1} } + { + \__msg_kernel_error:nnx { kernel } { key-no-property } {#1} + \tl_set:Nn \l_@@_property_tl { .abort: } + } } \cs_new_protected:Npn \@@_property_find:w #1 . #2 \q_stop { @@ -1148,12 +1171,12 @@ % % \subsection{Turning properties into actions} % -% \begin{macro}[int]{\@@_bool_set:NN} +% \begin{macro}[int]{\@@_bool_set:Nn, \@@_bool_set:cn} % Boolean keys are really just choices, but all done by hand. The -% second argument here is the scope: either empty or \texttt{g} for +% second argument here is the scope: either empty or \texttt{ g } for % global. % \begin{macrocode} -\cs_new:Npn \@@_bool_set:NN #1#2 +\cs_new_protected:Npn \@@_bool_set:Nn #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } \@@_choice_make: @@ -1168,13 +1191,14 @@ } \@@_default_set:n { true } } +\cs_generate_variant:Nn \@@_bool_set:Nn { c } % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_bool_set_inverse:NN} +% \begin{macro}[int]{\@@_bool_set_inverse:Nn, \@@_bool_set_inverse:cn} % Inverse boolean setting is much the same. % \begin{macrocode} -\cs_new:Npn \@@_bool_set_inverse:NN #1#2 +\cs_new_protected:Npn \@@_bool_set_inverse:Nn #1#2 { \bool_if_exist:NF #1 { \bool_new:N #1 } \@@_choice_make: @@ -1189,6 +1213,7 @@ } \@@_default_set:n { true } } +\cs_generate_variant:Nn \@@_bool_set_inverse:Nn { c } % \end{macrocode} % \end{macro} % @@ -1232,60 +1257,8 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_choices_generate:n} -% \begin{macro}[aux]{\@@_choices_generate_aux:n} -% Creating multiple-choices means setting up the \enquote{indicator} -% code, then applying whatever the user wanted. -% \begin{macrocode} -\cs_new_protected:Npn \@@_choices_generate:n #1 - { - \cs_if_exist:cTF - { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } - { - \@@_choice_make: - \int_zero:N \l_keys_choice_int - \clist_map_function:nN {#1} \@@_choices_generate_aux:n - } - { - \__msg_kernel_error:nnx { kernel } - { generate-choices-before-code } { \l_keys_path_tl } - } - } -\cs_new_protected:Npn \@@_choices_generate_aux:n #1 - { - \int_incr:N \l_keys_choice_int - \@@_cmd_set:nx { \l_keys_path_tl / #1 } - { - \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1} - \int_set:Nn \exp_not:N \l_keys_choice_int - { \int_use:N \l_keys_choice_int } - \exp_not:v - { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[int]{\@@_choice_code_store:n, \@@_choice_code_store:x} -% The code for making multiple choices is stored in a token list. -% \begin{macrocode} -\cs_new_protected:Npn \@@_choice_code_store:n #1 - { - \cs_if_exist:cF - { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } - { - \tl_new:c - { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } - } - \tl_set:cn { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } - {#1} - } -\cs_generate_variant:Nn \@@_choice_code_store:n { x } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_cmd_set:nn, \@@_cmd_set:nx, \@@_cmd_set:Vo} +% \begin{macro}[int] +% {\@@_cmd_set:nn, \@@_cmd_set:nx, \@@_cmd_set:Vn, \@@_cmd_set:Vo} % \begin{macro}[aux]{\@@_cmd_set:n} % Creating a new command means tidying up the properties and then making % the internal function which actually does the work. @@ -1295,12 +1268,7 @@ \@@_cmd_set:n {#1} \cs_set:cpn { \c_@@_code_root_tl #1 } ##1 {#2} } -\cs_new_protected:Npn \@@_cmd_set:nx #1#2 - { - \@@_cmd_set:n {#1} - \cs_set:cpx { \c_@@_code_root_tl #1 } ##1 {#2} - } -\cs_generate_variant:Nn \@@_cmd_set:nn { Vo } +\cs_generate_variant:Nn \@@_cmd_set:nn { nx , Vn , Vo } \cs_new_protected:Npn \@@_cmd_set:n #1 { \tl_clear_new:c { \c_@@_vars_root_tl #1 .default } @@ -1311,34 +1279,30 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_default_set:n, \@@_default_set:V} +% \begin{macro}[int]{\@@_default_set:n} % Setting a default value is easy. % \begin{macrocode} \cs_new_protected:Npn \@@_default_set:n #1 { \tl_set:cn { \c_@@_vars_root_tl \l_keys_path_tl .default } {#1} } -\cs_generate_variant:Nn \@@_default_set:n { V } % \end{macrocode} % \end{macro} -% -% \begin{macro}[aux]{\@@_initialise:n, \@@_initialise:V} -% \begin{macro}[aux, EXP]{\@@_initialise:wn} +% +% \begin{macro}[int]{\@@_initialise:n} +% \begin{macro}[aux]{\@@_initialise:wn} % A set up for initialisation from which the key system requires that % the path is split up into a module and a key name. At this stage, % \cs{l_keys_path_tl} will contain \texttt{/} so a split is easy to do. % \begin{macrocode} \cs_new_protected:Npn \@@_initialise:n #1 - { - \use:x - { \exp_after:wN \@@_initialise:wn \l_keys_path_tl \q_stop {#1} } - } -\cs_generate_variant:Nn \@@_initialise:n { V } -\cs_new:Npn \@@_initialise:wn #1 / #2 \q_stop #3 - { \keys_set:nn {#1} { #2 = \exp_not:n { {#3} } } } + { \exp_after:wN \@@_initialise:wn \l_keys_path_tl \q_stop {#1} } +\cs_new_protected:Npn \@@_initialise:wn #1 / #2 \q_stop #3 + { \keys_set:nn {#1} { #2 = {#3} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\@@_meta_make:n, \@@_meta_make:x} +% \begin{macro}[int]{\@@_meta_make:n} +% \begin{macro}[int]{\@@_meta_make:nn} % To create a meta-key, simply set up to pass data through. % \begin{macrocode} \cs_new_protected:Npn \@@_meta_make:n #1 @@ -1346,13 +1310,11 @@ \@@_cmd_set:Vo \l_keys_path_tl { \exp_after:wN \keys_set:nn \exp_after:wN { \l_@@_module_tl } {#1} } } -\cs_new_protected:Npn \@@_meta_make:x #1 - { - \@@_cmd_set:nx { \l_keys_path_tl } - { \exp_not:N \keys_set:nn { \l_@@_module_tl } {#1} } - } +\cs_new_protected:Npn \@@_meta_make:nn #1#2 + { \@@_cmd_set:Vn \l_keys_path_tl { \keys_set:nn {#1} {#2} } } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}[int]{\@@_multichoice_find:n} % \begin{macro}[int]{\@@_multichoice_make:} @@ -1408,93 +1370,95 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\@@_variable_set:NnNN, \@@_variable_set:cnNN} -% \begin{macro}[int]{\@@_variable_set:NnN, \@@_variable_set:cnN} +% \begin{macro}[int]{\@@_variable_set:NnnN, \@@_variable_set:cnnN} % Setting a variable takes the type and scope separately so that -% it is easy to make a new variable if needed. The three-argument -% version is set up so that the use of |{ }| as an \texttt{N}-type -% variable is only done once! +% it is easy to make a new variable if needed. % \begin{macrocode} -\cs_new_protected:Npn \@@_variable_set:NnNN #1#2#3#4 +\cs_new_protected:Npn \@@_variable_set:NnnN #1#2#3#4 { \use:c { #2_if_exist:NF } #1 { \use:c { #2 _new:N } #1 } \@@_cmd_set:nx { \l_keys_path_tl } - { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 {##1} } + { \exp_not:c { #2 _ #3 set:N #4 } \exp_not:N #1 \exp_not:n { {##1} } } } -\cs_new_protected:Npn \@@_variable_set:NnN #1#2#3 - { \@@_variable_set:NnNN #1 {#2} { } #3 } -\cs_generate_variant:Nn \@@_variable_set:NnNN { c } -\cs_generate_variant:Nn \@@_variable_set:NnN { c } +\cs_generate_variant:Nn \@@_variable_set:NnnN { c } % \end{macrocode} % \end{macro} -% \end{macro} % % \subsection{Creating key properties} % % The key property functions are all wrappers for internal functions, % meaning that things stay readable and can also be altered later on. -% -% \begin{macro}{.bool_set:N} -% \begin{macro}{.bool_gset:N} +% +% Importantly, while key properties have \enquote{normal} argument specs, the +% underlying code always supplies one braced argument to these. As such, argument +% expansion is handled by hand rather than using the standard tools. This shows +% up particularly for the two-argument properties, where things would otherwise +% go badly wrong. +% +% \begin{macro}{.bool_set:N, .bool_set:c} +% \begin{macro}{.bool_gset:N, .bool_gset:c} % One function for this. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .bool_set:N } #1 - { \@@_bool_set:NN #1 { } } + { \@@_bool_set:Nn #1 { } } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_set:c } #1 + { \@@_bool_set:cn {#1} { } } \cs_new_protected:cpn { \c_@@_props_root_tl .bool_gset:N } #1 - { \@@_bool_set:NN #1 g } + { \@@_bool_set:Nn #1 { g } } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_gset:c } #1 + { \@@_bool_set:cn {#1} { g } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{.bool_set_inverse:N} -% \begin{macro}{.bool_gset_inverse:N} +% \begin{macro}{.bool_set_inverse:N, .bool_set_inverse:c} +% \begin{macro}{.bool_gset_inverse:N, .bool_gset_inverse:c} % One function for this. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .bool_set_inverse:N } #1 - { \@@_bool_set_inverse:NN #1 { } } + { \@@_bool_set_inverse:Nn #1 { } } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_set_inverse:c } #1 + { \@@_bool_set_inverse:cn {#1} { } } \cs_new_protected:cpn { \c_@@_props_root_tl .bool_gset_inverse:N } #1 - { \@@_bool_set_inverse:NN #1 g } + { \@@_bool_set_inverse:Nn #1 { g } } +\cs_new_protected:cpn { \c_@@_props_root_tl .bool_gset_inverse:c } #1 + { \@@_bool_set_inverse:cn {#1} { g } } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{.choice:} % Making a choice is handled internally, as it is also needed by -% \texttt{.generate_choices:n}. +% \texttt{.generate_choices:n}. % \begin{macrocode} \cs_new_protected_nopar:cpn { \c_@@_props_root_tl .choice: } { \@@_choice_make: } % \end{macrocode} % \end{macro} % -% \begin{macro}{.choices:nn} +% \begin{macro} +% {.choices:nn, .choices:Vn, .choices:on, .choices:xn} % For auto-generation of a series of mutually-exclusive choices. % Here, |#1| will consist of two separate % arguments, hence the slightly odd-looking implementation. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .choices:nn } #1 { \@@_choices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .choices:Vn } #1 + { \exp_args:NV \@@_choices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .choices:on } #1 + { \exp_args:No \@@_choices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .choices:xn } #1 + { \exp_args:Nx \@@_choices_make:nn #1 } % \end{macrocode} % \end{macro} % -% \begin{macro}{.code:n, .code:x} +% \begin{macro}{.code:n} % Creating code is simply a case of passing through to the underlying % \texttt{set} function. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .code:n } #1 { \@@_cmd_set:nn { \l_keys_path_tl } {#1} } -\cs_new_protected:cpn { \c_@@_props_root_tl .code:x } #1 - { \@@_cmd_set:nx { \l_keys_path_tl } {#1} } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{.choice_code:n, .choice_code:x} -% Storing the code for choices -% \begin{macrocode} -\cs_new_protected:cpn { \c_@@_props_root_tl .choice_code:n } #1 - { \@@_choice_code_store:n {#1} } -\cs_new_protected:cpn { \c_@@_props_root_tl .choice_code:x } #1 - { \@@_choice_code_store:x {#1} } % \end{macrocode} % \end{macro} % @@ -1502,24 +1466,28 @@ % \begin{macro}{.clist_gset:N, .clist_gset:c} % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .clist_set:N } #1 - { \@@_variable_set:NnN #1 { clist } n } + { \@@_variable_set:NnnN #1 { clist } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .clist_set:c } #1 - { \@@_variable_set:cnN {#1} { clist } n } + { \@@_variable_set:cnnN {#1} { clist } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .clist_gset:N } #1 - { \@@_variable_set:NnNN #1 { clist } g n } + { \@@_variable_set:NnnN #1 { clist } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .clist_gset:c } #1 - { \@@_variable_set:cnNN {#1} { clist } g n } + { \@@_variable_set:cnnN {#1} { clist } { g } n } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{.default:n, .default:V} +% \begin{macro}{.default:n, .default:V, .default:o, .default:x} % Expansion is left to the internal functions. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .default:n } #1 { \@@_default_set:n {#1} } \cs_new_protected:cpn { \c_@@_props_root_tl .default:V } #1 - { \@@_default_set:V #1 } + { \exp_args:NV \@@_default_set:n #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .default:o } #1 + { \exp_args:No \@@_default_set:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .default:x } #1 + { \exp_args:Nx \@@_default_set:n {#1} } % \end{macrocode} % \end{macro} % @@ -1528,13 +1496,13 @@ % Setting a variable is very easy: just pass the data along. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .dim_set:N } #1 - { \@@_variable_set:NnN #1 { dim } n } + { \@@_variable_set:NnnN #1 { dim } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .dim_set:c } #1 - { \@@_variable_set:cnN {#1} { dim } n } + { \@@_variable_set:cnnN {#1} { dim } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .dim_gset:N } #1 - { \@@_variable_set:NnNN #1 { dim } g n } + { \@@_variable_set:NnnN #1 { dim } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .dim_gset:c } #1 - { \@@_variable_set:cnNN {#1} { dim } g n } + { \@@_variable_set:cnnN {#1} { dim } { g } n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1544,32 +1512,28 @@ % Setting a variable is very easy: just pass the data along. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .fp_set:N } #1 - { \@@_variable_set:NnN #1 { fp } n } + { \@@_variable_set:NnnN #1 { fp } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .fp_set:c } #1 - { \@@_variable_set:cnN {#1} { fp } n } + { \@@_variable_set:cnnN {#1} { fp } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .fp_gset:N } #1 - { \@@_variable_set:NnNN #1 { fp } g n } + { \@@_variable_set:NnnN #1 { fp } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .fp_gset:c } #1 - { \@@_variable_set:cnNN {#1} { fp } g n } + { \@@_variable_set:cnnN {#1} { fp } { g } n } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{.generate_choices:n} -% Making choices is easy. -% \begin{macrocode} -\cs_new_protected:cpn { \c_@@_props_root_tl .generate_choices:n } #1 - { \@@_choices_generate:n {#1} } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{.initial:n, .initial:V} +% \begin{macro}{.initial:n, .initial:V, .initial:o, .initial:x} % The standard hand-off approach. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .initial:n } #1 { \@@_initialise:n {#1} } \cs_new_protected:cpn { \c_@@_props_root_tl .initial:V } #1 - { \@@_initialise:V #1 } + { \exp_args:NV \@@_initialise:n #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .initial:o } #1 + { \exp_args:No \@@_initialise:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .initial:x } #1 + { \exp_args:Nx \@@_initialise:n {#1} } % \end{macrocode} % \end{macro} % @@ -1578,29 +1542,40 @@ % Setting a variable is very easy: just pass the data along. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .int_set:N } #1 - { \@@_variable_set:NnN #1 { int } n } + { \@@_variable_set:NnnN #1 { int } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .int_set:c } #1 - { \@@_variable_set:cnN {#1} { int } n } + { \@@_variable_set:cnnN {#1} { int } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .int_gset:N } #1 - { \@@_variable_set:NnNN #1 { int } g n } + { \@@_variable_set:NnnN #1 { int } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .int_gset:c } #1 - { \@@_variable_set:cnNN {#1} { int } g n } + { \@@_variable_set:cnnN {#1} { int } { g } n } % \end{macrocode} % \end{macro} % \end{macro} % -%\begin{macro}{.meta:n, .meta:x} -% Making a meta is handled internally. +% \begin{macro}{.meta:n} +% Making a meta is handled internally. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .meta:n } #1 { \@@_meta_make:n {#1} } -\cs_new_protected:cpn { \c_@@_props_root_tl .meta:x } #1 - { \@@_meta_make:x {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{.meta:nn} +% Meta with path: potentially lots of variants, but for the moment +% no so many defined. +% \begin{macrocode} +\cs_new_protected:cpn { \c_@@_props_root_tl .meta:nn } #1 + { \@@_meta_make:nn #1 } % \end{macrocode} % \end{macro} % % \begin{macro}{.multichoice:} -% \begin{macro}{.multichoices:nn} +% \begin{macro} +% { +% .multichoices:nn, .multichoices:Vn, .multichoices:on, +% .multichoices:xn, +% } % The same idea as \texttt{.choice:} and \texttt{.choices:nn}, but % where more than one choice is allowed. % \begin{macrocode} @@ -1608,6 +1583,12 @@ { \@@_multichoice_make: } \cs_new_protected:cpn { \c_@@_props_root_tl .multichoices:nn } #1 { \@@_multichoices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .multichoices:Vn } #1 + { \exp_args:NV \@@_multichoices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .multichoices:on } #1 + { \exp_args:No \@@_multichoices_make:nn #1 } +\cs_new_protected:cpn { \c_@@_props_root_tl .multichoices:xn } #1 + { \exp_args:Nx \@@_multichoices_make:nn #1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -1617,13 +1598,13 @@ % Setting a variable is very easy: just pass the data along. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .skip_set:N } #1 - { \@@_variable_set:NnN #1 { skip } n } + { \@@_variable_set:NnnN #1 { skip } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .skip_set:c } #1 - { \@@_variable_set:cnN {#1} { skip } n } + { \@@_variable_set:cnnN {#1} { skip } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .skip_gset:N } #1 - { \@@_variable_set:NnNN #1 { skip } g n } + { \@@_variable_set:NnnN #1 { skip } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .skip_gset:c } #1 - { \@@_variable_set:cnNN {#1} { skip } g n } + { \@@_variable_set:cnnN {#1} { skip } { g } n } % \end{macrocode} % \end{macro} % \end{macro} @@ -1636,21 +1617,21 @@ % Setting a variable is very easy: just pass the data along. % \begin{macrocode} \cs_new_protected:cpn { \c_@@_props_root_tl .tl_set:N } #1 - { \@@_variable_set:NnN #1 { tl } n } + { \@@_variable_set:NnnN #1 { tl } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_set:c } #1 - { \@@_variable_set:cnN {#1} { tl } n } + { \@@_variable_set:cnnN {#1} { tl } { } n } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_set_x:N } #1 - { \@@_variable_set:NnN #1 { tl } x } + { \@@_variable_set:NnnN #1 { tl } { } x } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_set_x:c } #1 - { \@@_variable_set:cnN {#1} { tl } x } + { \@@_variable_set:cnnN {#1} { tl } { } x } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset:N } #1 - { \@@_variable_set:NnNN #1 { tl } g n } + { \@@_variable_set:NnnN #1 { tl } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset:c } #1 - { \@@_variable_set:cnNN {#1} { tl } g n } + { \@@_variable_set:cnnN {#1} { tl } { g } n } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset_x:N } #1 - { \@@_variable_set:NnNN #1 { tl } g x } + { \@@_variable_set:NnnN #1 { tl } { g } x } \cs_new_protected:cpn { \c_@@_props_root_tl .tl_gset_x:c } #1 - { \@@_variable_set:cnNN {#1} { tl } g x } + { \@@_variable_set:cnnN {#1} { tl } { g } x } % \end{macrocode} % \end{macro} % \end{macro} @@ -1706,7 +1687,7 @@ \keyval_parse:NNn \@@_set_elt:n \@@_set_elt:nn {#3} \cs_set_eq:NN \@@_execute_unknown: \@@_execute_unknown_std: \tl_set:Nn \l_@@_module_tl {#1} - \clist_set_eq:NN #4 \l_@@_unknown_clist + \cs_set_eq:NN #4 \l_@@_unknown_clist } \cs_generate_variant:Nn \keys_set_known:nnN { nV , nv , no } \cs_generate_variant:Nn \@@_set_known:nnnN { o } @@ -1805,14 +1786,14 @@ % \@@_execute_unknown_std:, % \@@_execute_unknown_alt: % } -% \begin{macro}[aux]{\@@_execute:nn} +% \begin{macro}[aux, EXP]{\@@_execute:nn} % Actually executing a key is done in two parts. First, look for the % key itself, then look for the \texttt{unknown} key with the same % path. If both of these fail, complain. % \begin{macrocode} -\cs_new_nopar:Npn \@@_execute: +\cs_new_protected_nopar:Npn \@@_execute: { \@@_execute:nn { \l_keys_path_tl } { \@@_execute_unknown: } } -\cs_new_nopar:Npn \@@_execute_unknown: +\cs_new_protected_nopar:Npn \@@_execute_unknown: { \@@_execute:nn { \l_@@_module_tl / unknown } { @@ -1821,7 +1802,7 @@ } } \cs_new_eq:NN \@@_execute_unknown_std: \@@_execute_unknown: -\cs_new_nopar:Npn \@@_execute_unknown_alt: +\cs_new_protected_nopar:Npn \@@_execute_unknown_alt: { \clist_put_right:Nx \l_@@_unknown_clist { @@ -1844,7 +1825,7 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_choice_find:n} +% \begin{macro}[int, EXP]{\@@_choice_find:n} % Executing a choice has two parts. First, try the choice given, then % if that fails call the unknown key. That will exist, as it is created % when a choice is first made. So there is no need for any escape code. @@ -1886,7 +1867,7 @@ % \begin{macro}{\keys_show:nn} % Showing a key is just a question of using the correct name. % \begin{macrocode} -\cs_new:Npn \keys_show:nn #1#2 +\cs_new_protected:Npn \keys_show:nn #1#2 { \cs_show:c { \c_@@_code_root_tl #1 / \tl_to_str:n {#2} } } % \end{macrocode} % \end{macro} @@ -1904,20 +1885,18 @@ The~key~'#1'~takes~a~limited~number~of~values.\\ The~input~given,~'#2',~is~not~on~the~list~accepted. } -\__msg_kernel_new:nnnn { kernel } { generate-choices-before-code } - { No~code~available~to~generate~choices~for~key~'#1'. } +\__msg_kernel_new:nnnn { kernel } { key-choice-unknown } + { Key~'#1'~accepts~only~a~fixed~set~of~choices. } { - \c_msg_coding_error_text_tl - Before~using~.generate_choices:n~the~code~should~be~defined~ - with~'.choice_code:n'~or~'.choice_code:x'. + The~key~'#1'~only~accepts~predefined~values,~and~'#2'~is~not~one~of~these. } \__msg_kernel_new:nnnn { kernel } { key-no-property } { No~property~given~in~definition~of~key~'#1'. } { \c_msg_coding_error_text_tl - Inside~\keys_define:nn each~key~name - needs~a~property: \\ - ~ ~ #1 .<property> \\ + Inside~\keys_define:nn each~key~name~ + needs~a~property: \\ \\ + \iow_indent:n { #1 .<property> } \\ \\ LaTeX~did~not~find~a~'.'~to~indicate~the~start~of~a~property. } \__msg_kernel_new:nnnn { kernel } { key-unknown } @@ -1930,7 +1909,7 @@ { The~property~'#1'~requires~a~value. } { \c_msg_coding_error_text_tl - LaTeX~was~asked~to~set~property~'#2'~for~key~'#1'.\\ + LaTeX~was~asked~to~set~property~'#1'~for~key~'#2'.\\ No~value~was~given~for~the~property,~and~one~is~required. } \__msg_kernel_new:nnnn { kernel } { property-unknown } @@ -1955,6 +1934,86 @@ % \end{macrocode} % % \subsection{Deprecated functions} +% +% Deprecated on 2013-07-09. +% +% \begin{macro}[int]{\@@_choice_code_store:n, \@@_choice_code_store:x} +% The code for making multiple choices is stored in a token list. +% \begin{macrocode} +\cs_new_protected:Npn \@@_choice_code_store:n #1 + { + \cs_if_exist:cF + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } + { + \tl_new:c + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } + } + \tl_set:cn { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } + {#1} + } +\cs_generate_variant:Nn \@@_choice_code_store:n { x } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{.choice_code:n, .choice_code:x} +% Storing the code for choices +% \begin{macrocode} +\cs_new_protected:cpn { \c_@@_props_root_tl .choice_code:n } #1 + { \@@_choice_code_store:n {#1} } +\cs_new_protected:cpn { \c_@@_props_root_tl .choice_code:x } #1 + { \@@_choice_code_store:x {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[int]{\@@_choices_generate:n} +% \begin{macro}[aux]{\@@_choices_generate_aux:n} +% Creating multiple-choices means setting up the \enquote{indicator} +% code, then applying whatever the user wanted. +% \begin{macrocode} +\cs_new_protected:Npn \@@_choices_generate:n #1 + { + \cs_if_exist:cTF + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } + { + \@@_choice_make: + \int_zero:N \l_keys_choice_int + \clist_map_function:nN {#1} \@@_choices_generate_aux:n + } + { + \__msg_kernel_error:nnx { kernel } + { generate-choices-before-code } { \l_keys_path_tl } + } + } +\cs_new_protected:Npn \@@_choices_generate_aux:n #1 + { + \int_incr:N \l_keys_choice_int + \@@_cmd_set:nx { \l_keys_path_tl / #1 } + { + \tl_set:Nn \exp_not:N \l_keys_choice_tl {#1} + \int_set:Nn \exp_not:N \l_keys_choice_int + { \int_use:N \l_keys_choice_int } + \exp_not:v + { \c_@@_vars_root_tl \l_keys_path_tl .choice~code } + } + } +\__msg_kernel_new:nnnn { kernel } { generate-choices-before-code } + { No~code~available~to~generate~choices~for~key~'#1'. } + { + \c_msg_coding_error_text_tl + Before~using~.generate_choices:n~the~code~should~be~defined~ + with~'.choice_code:n'~or~'.choice_code:x'. + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{.generate_choices:n} +% Making choices is easy. +% \begin{macrocode} +\cs_new_protected:cpn { \c_@@_props_root_tl .generate_choices:n } #1 + { \@@_choices_generate:n {#1} } +% \end{macrocode} +% \end{macro} % % Deprecated on 2011-05-27, for removal by 2011-08-31. % @@ -1972,9 +2031,9 @@ % \end{macro} % \end{macro} % \end{macro} -% +% % Internal material for removal by 2012-12-31. -% +% % \begin{macrocode} %<*deprecated> \cs_new_eq:NN \c_keys_code_root_tl \c__keys_code_root_tl diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 79fa7961ebd..231c324274a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3prg.dtx 4459 2013-02-13 09:21:15Z will $ +\GetIdInfo$Id: l3prg.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Control structures} %</driver|package> %<*driver> @@ -639,7 +639,7 @@ % \cs{\meta{type}_map_break:} and \cs{\meta{type}_map_break:n} use % this to break out of the loop. After the loop ends, the % \meta{tokens} are inserted into the input stream. This occurs even -% if the the break functions are \emph{not} applied: +% if the break functions are \emph{not} applied: % \cs{__prg_break_point:Nn} is functionally-equivalent in these cases % to \cs{use_ii:nn}. % \end{function} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index c70b5137fa3..145a9f4e369 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3quark.dtx 4268 2012-11-04 22:19:48Z joseph $ +\GetIdInfo$Id: l3quark.dtx 4521 2013-07-09 11:45:31Z joseph $ {L3 Quarks} %</driver|package> %<*driver> @@ -198,7 +198,8 @@ % % This module provides a uniform interface to intercepting and % terminating loops as when one is doing tail recursion. The building -% blocks follow below and an example is shown in Section~\ref{sec:quark-example}. +% blocks follow below and an example is shown in +% Section~\ref{sec:l3quark:quark-example}. % % \begin{variable}{\q_recursion_tail} % This quark is appended to the data structure in question and @@ -285,7 +286,7 @@ % \end{function} % % \section{An example of recursion with quarks} -% \label{sec:quark-example} +% \label{sec:l3quark:quark-example} % % Quarks are mainly used internally in the \pkg{expl3} code to define % recursion functions such as \cs{tl_map_inline:nn} and so on. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index e917aeda4ea..82c08c35f60 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3seq.dtx 4434 2013-01-12 09:33:40Z bruno $ +\GetIdInfo$Id: l3seq.dtx 4500 2013-05-26 11:18:19Z bruno $ {L3 Sequences and stacks} %</driver|package> %<*driver> @@ -253,7 +253,7 @@ % \end{syntax} % Pops the right-most item from a \meta{sequence} into the % \meta{token list variable}, \emph{i.e.}~removes the item from the -% sequence and stores it in in the \meta{token list variable}. +% sequence and stores it in the \meta{token list variable}. % Both of the variables are assigned locally. If \meta{sequence} is % empty the \meta{token list variable} will % contain the special marker \cs{q_no_value}. @@ -536,6 +536,64 @@ % \emph{i.e.}~every item in a \meta{sequence} is unique. % \end{function} % +% \section{Using the content of sequences directly} +% +% \begin{function}[EXP, added = 2013-05-26]{\seq_use:Nnnn, \seq_use:cnnn} +% \begin{syntax} +% \cs{seq_use:Nnnn} \meta{seq~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two} +% \end{syntax} +% Places the contents of the \meta{seq~var} in the input stream, with +% the appropriate \meta{separator} between the items. Namely, if the +% sequence has more than two items, the \meta{separator between more +% than two} is placed between each pair of items except the last, +% for which the \meta{separator between final two} is used. If the +% sequence has exactly two items, then they are placed in the input stream +% separated by the \meta{separator between two}. If the sequence has +% a single item, it is placed in the input stream, and an empty sequence +% produces no output. An error will be raised if the variable does +% not exist or if it is invalid. +% +% For example, +% \begin{verbatim} +% \seq_set_split:Nnn \l_tmpa_seq { | } { a | b | c | {de} | f } +% \seq_use:Nnnn \l_tmpa_seq { ~and~ } { ,~ } { ,~and~ } +% \end{verbatim} +% will insert \enquote{\texttt{a, b, c, de, and f}} in the input +% stream. The first separator argument is not used in this case +% because the sequence has more than $2$ items. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{items} +% will not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% +% \begin{function}[EXP, added = 2013-05-26]{\seq_use:Nn, \seq_use:cn} +% \begin{syntax} +% \cs{seq_use:Nn} \meta{seq~var} \Arg{separator} +% \end{syntax} +% Places the contents of the \meta{seq~var} in the input stream, with +% the \meta{separator} between the items. If the sequence has +% a single item, it is placed in the input stream with no \meta{separator}, +% and an empty sequence produces no output. An error will be raised if +% the variable does not exist or if it is invalid. +% +% For example, +% \begin{verbatim} +% \seq_set_split:Nnn \l_tmpa_seq { | } { a | b | c | {de} | f } +% \seq_use:Nn \l_tmpa_seq { ~and~ } +% \end{verbatim} +% will insert \enquote{\texttt{a and b and c and de and f}} in the input +% stream. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{items} +% will not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% % \section{Sequences as stacks} % % Sequences can be used as stacks, where data is pushed to and popped @@ -1464,6 +1522,56 @@ % \end{macro} % \end{macro} % +% \subsection{Using sequences} +% +% \begin{macro}[EXP]{\seq_use:Nnnn, \seq_use:cnnn} +% \begin{macro}[EXP, aux] +% {\@@_use:NnNnn, \@@_use:nwwwwnwn, \@@_use:nwwn} +% \begin{macro}[EXP]{\seq_use:Nn, \seq_use:cn} +% See \cs{clist_use:Nnnn} for a general explanation. The main +% difference is that we use \cs{@@_item:n} as a delimiter rather than +% commas. We also need to add \cs{@@_item:n} at various places. +% \begin{macrocode} +\cs_new:Npn \seq_use:Nnnn #1#2#3#4 + { + \seq_if_exist:NTF #1 + { + \int_case:nnn { \seq_count:N #1 } + { + { 0 } { } + { 1 } { \exp_after:wN \@@_use:NnNnn #1 \@@_item:n { } { } } + { 2 } { \exp_after:wN \@@_use:NnNnn #1 {#2} } + } + { + \exp_after:wN \@@_use:nwwwwnwn + \exp_after:wN { \exp_after:wN } #1 \@@_item:n + \q_mark { \@@_use:nwwwwnwn {#3} } + \q_mark { \@@_use:nwwn {#4} } + \q_stop { } + } + } + { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } + } +\cs_generate_variant:Nn \seq_use:Nnnn { c } +\cs_new:Npn \@@_use:NnNnn \@@_item:n #1 \@@_item:n #2#3 + { \exp_not:n { #1 #3 #2 } } +\cs_new:Npn \@@_use:nwwwwnwn + #1 \@@_item:n #2 \@@_item:n #3 \@@_item:n #4#5 + \q_mark #6#7 \q_stop #8 + { + #6 \@@_item:n {#3} \@@_item:n {#4} #5 + \q_mark {#6} #7 \q_stop { #8 #1 #2 } + } +\cs_new:Npn \@@_use:nwwn #1 \@@_item:n #2 #3 \q_stop #4 + { \exp_not:n { #4 #1 #2 } } +\cs_new:Npn \seq_use:Nn #1#2 + { \seq_use:Nnnn #1 {#2} {#2} {#2} } +\cs_generate_variant:Nn \seq_use:Nn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Sequence stacks} % % The same functions as for sequences, but with the correct naming. @@ -1610,7 +1718,7 @@ % A simple short cut for a mapping. % \begin{macrocode} %<*deprecated> -\cs_new:Npn \seq_use:N #1 { \seq_map_function:NN #1 \use:n } +\cs_new:Npn \seq_use:N #1 { \seq_use:Nn #1 { } } \cs_generate_variant:Nn \seq_use:N { c } %</deprecated> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index dc164dc20c8..e4c1329a728 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3tl.dtx 4415 2013-01-08 12:32:51Z bruno $ +\GetIdInfo$Id: l3tl.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Token lists} %</driver|package> %<*driver> @@ -1570,7 +1570,7 @@ % \TeX{} skips spaces when reading a non-delimited arguments. Thus, % a \meta{token list} is blank if and only if \cs{use_none:n} % \meta{token list} |?| is empty. For performance reasons, we hard-code -% the emptyness test done in \cs{tl_if_empty:n(TF)}: convert to harmless +% the emptiness test done in \cs{tl_if_empty:n(TF)}: convert to harmless % characters with \cs{tl_to_str:n}, and then use % \cs{if_meaning:w} \cs{q_nil} |...| \cs{q_nil}. % Note that converting to a string is done after reading the delimited @@ -1730,7 +1730,7 @@ % of |#2|. If this does not appear in |#1|, then the final |#2| is removed, % leaving an empty token list. Otherwise some tokens remain, and the % test is \texttt{false}. See \cs{tl_if_empty:n(TF)} for details on -% the emptyness test. +% the emptiness test. % % Special care is needed to treat correctly cases like % |\tl_if_in:nnTF {a state}{states}|, where |#1#2| contains |#2| before diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 16e5510475a..34427af0d1d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3bootstrap} -\GetIdInfo$Id: l3token.dtx 4428 2013-01-10 13:23:29Z bruno $ +\GetIdInfo$Id: l3token.dtx 4482 2013-04-24 21:05:12Z joseph $ {L3 Experimental token manipulation} %</driver|package> %<*driver> @@ -1556,7 +1556,7 @@ % thinks of such tokens as hexadecimal so it stores them as % |\char"|\meta{hex~number} or |\mathchar"|\meta{hex~number}. % Grab until the first occurrence of |char"|, and compare what -% preceeds with |\| or |\math|. In fact, the escape character +% precedes with |\| or |\math|. In fact, the escape character % may not be a backslash, so we compare with the result of % converting some other control sequence to a string, namely % |\char| or |\mathchar| (the auxiliary adds the |char| back). @@ -2015,7 +2015,7 @@ % The catcode and charcode tests are very similar, and in order to use % the same auxiliaries we do something a little bit odd, firing % \cs{if_catcode:w} and \cs{if_charcode:w} before finding the operands -% for those tests, which will only be given in in the |auxii:N| and +% for those tests, which will only be given in the |auxii:N| and % |auxiii:| auxiliaries. For our purposes, three kinds of tokens may % follow the peeking function: % \begin{itemize} |