summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx4
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/expl3.dtx4
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3.ins92
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3format.ins92
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx60
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx8
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx103
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx8
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx6
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx22
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx54
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx12
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3prop.dtx6
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3tl.dtx432
-rw-r--r--Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx6
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx6
-rw-r--r--Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx6
17 files changed, 617 insertions, 304 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx
index e6560eb79e1..984739d1efd 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3dt/l3dt.dtx
@@ -36,7 +36,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3dt.dtx 4153 2012-08-29 07:18:26Z joseph $
+\GetIdInfo$Id: l3dt.dtx 4190 2012-09-03 00:23:31Z bruno $
{L3 Experimental data tables}
%</driver|package>
%<*driver>
@@ -332,7 +332,7 @@
% \end{verbatim}
% The \texttt{:n} variant will insert the \meta{tokens} into the input stream
% after the mapping terminates. Use outside of a \cs{dt_map_\ldots} scenario
-% will lead low level \TeX{} errors.
+% will lead to low level \TeX{} errors.
% \end{function}
%
% \section{Data table conditionals}
diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx
index 24dd30934c9..527411ab125 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{2012/08/29}
-\def\ExplFileVersion{4160}
+\def\ExplFileDate{2012/09/05}
+\def\ExplFileVersion{4205}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
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..0df5abf9424
--- /dev/null
+++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins
@@ -0,0 +1,92 @@
+\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{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/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-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx
index 74bacd5d9d8..53a6456c5ac 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx
@@ -36,7 +36,7 @@
%
%<*driver>
\RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3fp-aux.dtx 4151 2012-08-28 11:51:52Z bruno $
+\GetIdInfo$Id: l3fp-aux.dtx 4181 2012-08-31 17:33:08Z bruno $
{L3 Floating-point support functions}
\documentclass[full]{l3doc}
\begin{document}
@@ -162,7 +162,7 @@
\cs_new_protected:Npn \@@_chk:w #1 ;
{
\__msg_kernel_error:nnx { kernel } { misused-fp }
- { \@@_to_tl:w \s_@@ \@@_chk:w #1 ; }
+ { \fp_to_tl:n { \s_@@ \@@_chk:w #1 ; } }
}
% \end{macrocode}
% \end{macro}
@@ -404,6 +404,27 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[int, EXP]{\@@_exp_after_array_f:w}
+% \begin{macro}[aux, EXP]{\@@_exp_after_stop_f:nw}
+% \begin{syntax}
+% \cs{@@_exp_after_array_f:w}
+% \meta{fp_1} |;|
+% \ldots{}
+% \meta{fp_n} |;|
+% \cs{s_@@_stop}
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_exp_after_array_f:w #1
+ {
+ \cs:w @@_exp_after \@@_type_from_scan:N #1 _f:nw \cs_end:
+ { \@@_exp_after_array_f:w }
+ #1
+ }
+\cs_new_eq:NN \@@_exp_after_stop_f:nw \use_none:nn
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Packing digits}
%
% When a positive integer |#1| is known to be less than $10^8$, the
@@ -879,14 +900,14 @@
%
% \subsection{Length of a floating point array}
%
-% \begin{macro}[int, EXP]{\@@_array_count:w}
+% \begin{macro}[int, EXP]{\@@_array_count:n}
% \begin{macro}[aux, EXP]{\@@_array_count_loop:Nw}
% Count the number of items in an array of floating points. The
% technique is very similar to \cs{tl_count:n}, but with the loop
% built-in. Checking for the end of the loop is done with the
% |\use_none:n #1| construction.
% \begin{macrocode}
-\cs_new:Npn \@@_array_count:w #1 @
+\cs_new:Npn \@@_array_count:n #1
{
\int_use:N \__int_eval:w \c_zero
\@@_array_count_loop:Nw #1 { ? \__prg_break: } ;
@@ -899,6 +920,37 @@
% \end{macro}
% \end{macro}
%
+% \subsection{\texttt{x}-like expansion expandably}
+%
+% \begin{macro}[int, EXP]{\@@_expand:n}
+% \begin{macro}[aux, EXP]{\@@_expand_loop:nwnN}
+% This expandable function behaves in a way somewhat similar to
+% \cs{use:x}, but much less robust. The argument is
+% \texttt{f}-expanded, then the leading item (often a single character
+% token) is moved to a storage area after \cs{s_@@_mark}, and
+% \texttt{f}-expansion is applied again, repeating until the argument
+% is empty. The result built one piece at a time is then inserted in
+% the input stream. Note that spaces are ignored by this procedure,
+% unless surrounded with braces. Multiple tokens which do not need
+% expansion can be inserted within braces.
+% \begin{macrocode}
+\cs_new:Npn \@@_expand:n #1
+ {
+ \@@_expand_loop:nwnN { }
+ #1 \prg_do_nothing:
+ \s_@@_mark { } \@@_expand_loop:nwnN
+ \s_@@_mark { } \@@_use_i_until_s:nw ;
+ }
+\cs_new:Npn \@@_expand_loop:nwnN #1#2 \s_@@_mark #3 #4
+ {
+ \exp_after:wN #4 \tex_romannumeral:D -`0
+ #2
+ \s_@@_mark { #3 #1 } #4
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \subsection{Messages}
%
% Using a floating point directly is an error.
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx
index 22c72c7b482..6dee0ef45bc 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 4151 2012-08-28 11:51:52Z bruno $
+\GetIdInfo$Id: l3fp-basics.dtx 4163 2012-08-30 16:33:11Z bruno $
{L3 Floating-point arithmetic}
\documentclass[full]{l3doc}
\begin{document}
@@ -1601,13 +1601,13 @@
%
% \subsection{Unary operations}
%
-% \begin{macro}[int, EXP]{\@@_neg_o:w}
+% \begin{macro}[int, EXP]{\@@_-_o:w}
% This function flips the sign of the \meta{floating point} and
% expands after it in the input stream, just like \cs{@@_+_o:ww}
% \emph{etc.} We add a hook used by \pkg{l3fp-expo}: anything before
% \cs{s_@@} is ignored.
% \begin{macrocode}
-\cs_new:Npn \@@_neg_o:w #1 \s_@@ \@@_chk:w #2 #3
+\cs_new:cpn { @@_-_o:w } #1 \s_@@ \@@_chk:w #2 #3
{
\exp_after:wN \@@_exp_after_o:w
\exp_after:wN \s_@@
@@ -1621,7 +1621,7 @@
% \begin{macro}[int, EXP]{\@@_abs_o:w}
% This function sets the sign of the \meta{floating point} to be
% positive, and expands after itself in the input stream, just like
-% \cs{@@_neg_o:w}. We must leave the sign of \texttt{nan} invariant.
+% \cs{@@_-_o:w}. We must leave the sign of \texttt{nan} invariant.
% \begin{macrocode}
\cs_new:Npn \@@_abs_o:w \s_@@ \@@_chk:w #1 #2
{
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx
index 0135da6304b..52fda439459 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx
@@ -36,7 +36,7 @@
%
%<*driver>
\RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3fp-convert.dtx 4129 2012-08-20 20:38:28Z mittelba $
+\GetIdInfo$Id: l3fp-convert.dtx 4180 2012-08-31 16:44:34Z bruno $
{L3 Floating-point conversion}
\documentclass[full]{l3doc}
\begin{document}
@@ -82,7 +82,7 @@
%
% \subsection{Trimming trailing zeros}
%
-% \begin{macro}[int, EXP]{\@@_trim_zeros:w}
+% \begin{macro}[aux, EXP]{\@@_trim_zeros:w}
% \begin{macro}[aux, EXP]
% {\@@_trim_zeros_loop:w, \@@_trim_zeros_dot:w, \@@_trim_zeros_end:w}
% If |#1| ends with a $0$, the \texttt{loop} auxiliary takes that zero
@@ -109,13 +109,14 @@
% \begin{macro}[EXP]
% {\fp_to_scientific:N, \fp_to_scientific:c, \fp_to_scientific:n}
% The three public functions evaluate their argument, then pass it to
-% \cs{@@_to_scientific:w}.
+% \cs{@@_to_scientific_dispatch:w}.
% \begin{macrocode}
-\cs_new:Npn \fp_to_scientific:N #1 { \exp_after:wN \@@_to_scientific:w #1 }
+\cs_new:Npn \fp_to_scientific:N #1
+ { \exp_after:wN \@@_to_scientific_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_scientific:N { c }
\cs_new_nopar:Npn \fp_to_scientific:n
{
- \exp_after:wN \@@_to_scientific:w
+ \exp_after:wN \@@_to_scientific_dispatch:w
\tex_romannumeral:D -`0 \@@_parse:n
}
% \end{macrocode}
@@ -123,7 +124,7 @@
%
% \begin{macro}[aux, EXP]
% {
-% \@@_to_scientific:w,
+% \@@_to_scientific_dispatch:w,
% \@@_to_scientific_normal:wnnnnn,
% \@@_to_scientific_normal:wNw
% }
@@ -147,7 +148,7 @@
\tl_to_lowercase:n
{
\group_end:
- \cs_new:Npn \@@_to_scientific:w \s_@@ \@@_chk:w #1#2
+ \cs_new:Npn \@@_to_scientific_dispatch:w \s_@@ \@@_chk:w #1#2
{
\if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi:
\if_case:w #1 \exp_stop_f:
@@ -196,14 +197,16 @@
%
% \begin{macro}[EXP]
% {\fp_to_decimal:N, \fp_to_decimal:c, \fp_to_decimal:n}
-% All three public variants are based on the same \cs{@@_to_decimal:w}
+% All three public variants are based on the same
+% \cs{@@_to_decimal_dispatch:w}
% after evaluating their argument to an internal floating point.
% \begin{macrocode}
-\cs_new:Npn \fp_to_decimal:N #1 { \exp_after:wN \@@_to_decimal:w #1 }
+\cs_new:Npn \fp_to_decimal:N #1
+ { \exp_after:wN \@@_to_decimal_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_decimal:N { c }
\cs_new_nopar:Npn \fp_to_decimal:n
{
- \exp_after:wN \@@_to_decimal:w
+ \exp_after:wN \@@_to_decimal_dispatch:w
\tex_romannumeral:D -`0 \@@_parse:n
}
% \end{macrocode}
@@ -211,12 +214,13 @@
%
% \begin{macro}[aux, EXP]
% {
-% \@@_to_decimal:w,
+% \@@_to_decimal_dispatch:w,
% \@@_to_decimal_normal:wnnnnn,
% \@@_to_decimal_large:Nnnw,
% \@@_to_decimal_huge:wnnnn,
% }
-% The structure is similar to \cs{@@_to_scientific:w}. Insert |-| for
+% The structure is similar to \cs{@@_to_scientific_dispatch:w}.
+% Insert |-| for
% negative numbers. Zero gives $0$, $\pm\infty$ and \nan{} yield an
% \enquote{invalid operation} exception; note that $\pm\infty$
% produces a very large output, which we don't expand now since it
@@ -229,7 +233,7 @@
% non-positive, the result should be $0.\meta{zeros}\meta{digits}$,
% trimmed.
% \begin{macrocode}
-\cs_new:Npn \@@_to_decimal:w \s_@@ \@@_chk:w #1#2
+\cs_new:Npn \@@_to_decimal_dispatch:w \s_@@ \@@_chk:w #1#2
{
\if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi:
\if_case:w #1 \exp_stop_f:
@@ -297,26 +301,26 @@
%
% \begin{macro}[EXP]{\fp_to_tl:N, \fp_to_tl:c, \fp_to_tl:n}
% These three public functions evaluate their argument, then pass it
-% to \cs{@@_to_tl:w}.
+% to \cs{@@_to_tl_dispatch:w}.
% \begin{macrocode}
-\cs_new:Npn \fp_to_tl:N #1 { \exp_after:wN \@@_to_tl:w #1 }
+\cs_new:Npn \fp_to_tl:N #1 { \exp_after:wN \@@_to_tl_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_tl:N { c }
\cs_new_nopar:Npn \fp_to_tl:n
{
- \exp_after:wN \@@_to_tl:w
+ \exp_after:wN \@@_to_tl_dispatch:w
\tex_romannumeral:D -`0 \@@_parse:n
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, EXP]{\@@_to_tl:w, \@@_to_tl_normal:nnnnn}
-% A structure similar to \cs{@@_to_scientific:w} and
-% \cs{@@_to_decimal:w}, but without the \enquote{invalid operation}
+% \begin{macro}[aux, EXP]{\@@_to_tl_dispatch:w, \@@_to_tl_normal:nnnnn}
+% A structure similar to \cs{@@_to_scientific_dispatch:w} and
+% \cs{@@_to_decimal_dispatch:w}, but without the \enquote{invalid operation}
% exception. First filter special cases. We express normal numbers
% in decimal notation if the exponent is in the range $[-2,16]$, and
% otherwise use scientific notation.
% \begin{macrocode}
-\cs_new:Npn \@@_to_tl:w \s_@@ \@@_chk:w #1#2
+\cs_new:Npn \@@_to_tl_dispatch:w \s_@@ \@@_chk:w #1#2
{
\if_meaning:w 2 #2 \exp_after:wN - \tex_romannumeral:D -`0 \fi:
\if_case:w #1 \exp_stop_f:
@@ -367,27 +371,27 @@
%
% \begin{macro}[EXP]{\fp_to_int:N, \fp_to_int:c, \fp_to_int:n}
% These three public functions evaluate their argument, then pass it
-% to \cs{fp_to_int:w}.
+% to \cs{fp_to_int_dispatch:w}.
% \begin{macrocode}
-\cs_new:Npn \fp_to_int:N #1 { \exp_after:wN \@@_to_int:w #1 }
+\cs_new:Npn \fp_to_int:N #1 { \exp_after:wN \@@_to_int_dispatch:w #1 }
\cs_generate_variant:Nn \fp_to_int:N { c }
\cs_new_nopar:Npn \fp_to_int:n
{
- \exp_after:wN \@@_to_int:w
+ \exp_after:wN \@@_to_int_dispatch:w
\tex_romannumeral:D -`0 \@@_parse:n
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[aux, EXP]{\@@_to_int:w}
+% \begin{macro}[aux, EXP]{\@@_to_int_dispatch:w}
% To convert to an integer, first round to $0$ places (to the nearest
% integer), then express the result as a decimal number: the
-% definition of \cs{@@_to_decimal:w} is such that there will be no
+% definition of \cs{@@_to_decimal_dispatch:w} is such that there will be no
% trailing dot nor zero.
% \begin{macrocode}
-\cs_new:Npn \@@_to_int:w #1;
+\cs_new:Npn \@@_to_int_dispatch:w #1;
{
- \exp_after:wN \@@_to_decimal:w \tex_romannumeral:D -`0
+ \exp_after:wN \@@_to_decimal_dispatch:w \tex_romannumeral:D -`0
\@@_round:Nwn \@@_round_to_nearest:NNN #1; { 0 }
}
% \end{macrocode}
@@ -472,24 +476,45 @@
% \subsection{Convert an array of floating points to a comma list}
%
% \begin{macro}[int, EXP]{\@@_array_to_clist:n}
-% \begin{macro}[aux, EXP]{\@@_array_to_clist_i:wwww, \@@_array_to_clist_ii:ww}
-% Converts an array of floating point numbers to a comma-list.
+% \begin{macro}[aux, EXP]{\@@_array_to_clist_loop:Nw}
+% Converts an array of floating point numbers to a comma-list. If
+% speed here ends up irrelevant, we can simplify the code for the
+% auxiliary to become
+% \begin{verbatim}
+% \cs_new:Npn \__fp_array_to_clist_loop:Nw #1#2;
+% {
+% \use_none:n #1
+% { , ~ } \fp_to_tl:n { #1 #2 ; }
+% \__fp_array_to_clist_loop:Nw
+% }
+% \end{verbatim}
+% The \cs{use_ii:nn} function is expanded after \cs{@@_expand:n} is
+% done, and it removes |,~| from the start of the representation.
% \begin{macrocode}
\cs_new:Npn \@@_array_to_clist:n #1
{
- \@@_array_to_clist_i:wwww ;
- #1
- \@@_array_to_clist_ii:ww \s_@@ ; @
- ; , ~ , ~ @ \s_stop
+ \tl_if_empty:nF {#1}
+ {
+ \@@_expand:n
+ {
+ { \use_ii:nn }
+ \@@_array_to_clist_loop:Nw #1 { ? \__prg_break: } ;
+ \__prg_break_point:
+ }
+ }
}
-\cs_new:Npn \@@_array_to_clist_i:wwww #1; #2 \s_@@ #3; #4 @
+\cs_new:Npx \@@_array_to_clist_loop:Nw #1#2;
{
- #2
- \exp_after:wN \@@_array_to_clist_i:wwww
- \tex_romannumeral:D -`0 \@@_to_tl:w \s_@@ #3 ; ;
- #4 , ~ #1 @
+ \exp_not:N \use_none:n #1
+ \exp_not:N \exp_after:wN
+ {
+ \exp_not:N \exp_after:wN ,
+ \exp_not:N \exp_after:wN \c_space_tl
+ \exp_not:N \tex_romannumeral:D -`0
+ \exp_not:N \@@_to_tl_dispatch:w #1 #2 ;
+ }
+ \exp_not:N \@@_array_to_clist_loop:Nw
}
-\cs_new:Npn \@@_array_to_clist_ii:ww #1 ; , ~ , ~ #2 @ #3 \s_stop {#2}
% \end{macrocode}
% \end{macro}
% \end{macro}
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx
index f228794e7a4..d6f76c3b0c1 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 4151 2012-08-28 11:51:52Z bruno $
+\GetIdInfo$Id: l3fp-expo.dtx 4163 2012-08-30 16:33:11Z bruno $
{L3 Floating-point exponential-related functions}
\documentclass[full]{l3doc}
\begin{document}
@@ -1150,7 +1150,7 @@
% This function is followed by three floating point numbers: $|a|^b$,
% $a\in[-\infty,-0]$, and $b$. If $b$ is an even integer (case $-1$),
% $a^b=|a|^b$. If $b$ is an odd integer (case $0$), $a^b=-|a|^b$,
-% obtained by a call to \cs{@@_neg_o:w}. Otherwise, the sign is
+% obtained by a call to \cs{@@_-_o:w}. Otherwise, the sign is
% undefined. This is invalid, unless $|a|^b$ turns out to be $+0$ or
% \texttt{nan}, in which case we return that as $a^b$. In particular,
% since the underflow detection occurs before \cs{@@_pow_neg:www} is
@@ -1160,7 +1160,7 @@
\cs_new:Npn \@@_pow_neg:www \s_@@ \@@_chk:w #1#2; #3; #4;
{
\if_case:w \@@_pow_neg_case:w #4 ;
- \exp_after:wN \@@_neg_o:w
+ \cs:w @@_-_o:w \exp_after:wN \cs_end:
\or:
\if_int_compare:w \__int_eval:w #1 / \c_two = \c_one
\@@_invalid_operation_o:Nww ^ #3; #4;
@@ -1173,6 +1173,8 @@
\s_@@ \@@_chk:w #1#2;
}
% \end{macrocode}
+% ^^A todo: is this \@@_exp_after_o:w necessary? Appropriate?
+% ^^A todo: improve upon the run-time \cs:w ... \cs_end: construction.
% \end{macro}
%
% \begin{macro}[aux, rEXP]
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx
index 20f94e2abe4..f32746b30e1 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx
@@ -84,7 +84,7 @@
% \Arg{expo_2} \meta{body_2} |;|
% \item \cs{@@_max_o:w} \meta{floating point array}
% \item \cs{@@_min_o:w} \meta{floating point array}
-% \item \cs{@@_not_o:w} \meta{floating point}
+% \item \cs{@@_!_o:w} \meta{floating point}
% \item \cs{@@_\string&_o:ww} \meta{floating point} \meta{floating point}
% \item \cs{@@_\string|_o:ww} \meta{floating point} \meta{floating point}
% \item \cs{@@_ternary:NwwN}, \cs{@@_ternary_i:NwwN},
@@ -413,11 +413,11 @@
%
% \subsection{Boolean operations}
%
-% \begin{macro}[int, EXP]{\@@_not_o:w}
+% \begin{macro}[int, EXP]{\@@_!_o:w}
% Return \texttt{true} or \texttt{false}, with two expansions, one to
% exit the conditional, and one to please \pkg{l3fp-parse}.
% \begin{macrocode}
-\cs_new:Npn \@@_not_o:w \s_@@ \@@_chk:w #1#2;
+\cs_new:cpn { @@_!_o:w } \s_@@ \@@_chk:w #1#2;
{
\if_meaning:w 0 #1
\exp_after:wN \exp_after:wN \exp_after:wN \c_one_fp
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx
index 63895efcaae..b336d346ffe 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-old.dtx
@@ -36,7 +36,7 @@
%
%<*driver>
\RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3fp-old.dtx 4082 2012-08-12 12:14:17Z bruno $
+\GetIdInfo$Id: l3fp-old.dtx 4163 2012-08-30 16:33:11Z bruno $
{L3 Experimental floating-points (old)}
\documentclass[full]{l3doc}
\begin{document}
@@ -122,15 +122,25 @@
% }
% \begin{macro}[aux]{\@@_abs:NNN}
% Simply expand the floating point variable to feed it to
-% \cs{@@_abs_o:w} or \cs{@@_neg_o:w}, expanded within an expanding
+% \cs{@@_abs_o:w} or \cs{@@_-_o:w}, expanded within an expanding
% token list assignment. The \cs{prg_do_nothing:} is not necessary,
-% but it reminds us moe clearly that \cs{@@_abs_o:w} and
-% \cs{@@_neg_o:w} expand after their result.
+% but it reminds us more clearly that \cs{@@_abs_o:w} and
+% \cs{@@_-_o:w} expand after their result.
% \begin{macrocode}
\cs_new_protected_nopar:Npn \fp_abs:N { \@@_abs:NNN \tl_set:Nx \@@_abs_o:w }
\cs_new_protected_nopar:Npn \fp_gabs:N { \@@_abs:NNN \tl_gset:Nx \@@_abs_o:w }
-\cs_new_protected_nopar:Npn \fp_neg:N { \@@_abs:NNN \tl_set:Nx \@@_neg_o:w }
-\cs_new_protected_nopar:Npn \fp_gneg:N { \@@_abs:NNN \tl_gset:Nx \@@_neg_o:w }
+\cs_new_protected_nopar:Npx \fp_neg:N
+ {
+ \exp_not:N \@@_abs:NNN
+ \exp_not:N \tl_set:Nx
+ \exp_not:c { @@_-_o:w }
+ }
+\cs_new_protected_nopar:Npx \fp_gneg:N
+ {
+ \exp_not:N \@@_abs:NNN
+ \exp_not:N \tl_gset:Nx
+ \exp_not:c { @@_-_o:w }
+ }
\cs_new_protected:Npn \@@_abs:NNN #1#2#3
{ #1 #3 { \exp_after:wN #2 #3 \prg_do_nothing: } }
\cs_generate_variant:Nn \fp_abs:N { c }
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx
index bb9c792adff..c49e3248edd 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 4159 2012-08-29 13:21:59Z bruno $
+\GetIdInfo$Id: l3fp-parse.dtx 4187 2012-09-02 15:57:09Z bruno $
{L3 Floating-point expression parsing}
\documentclass[full]{l3doc}
\begin{document}
@@ -956,42 +956,45 @@
% \begin{macro}[aux, EXP]
% {
% \@@_parse_operand_relax:NN,
-% \@@_exp_after_mark_f:nw,
-% \@@_exp_after_?_f:nw
+% \@@_parse_exp_after_f:nw,
+% \@@_parse_exp_after_mark_f:nw,
+% \@@_parse_exp_after_?_f:nw
% }
% The second argument is a control sequence equal to \cs{tex_relax:D}.
% There are three cases, dispatched using \cs{@@_type_from_scan:N}.
% \begin{itemize}
% \item \cs{s_@@} starts a floating point number, and we call
-% \cs{@@_exp_after_f:nw}.
+% \cs{@@_parse_exp_after_f:nw}, which |f|-expands after the
+% floating point.
% \item \cs{s_@@_mark} is a premature end, we call
-% \cs{@@_exp_after_mark_f:nw}, which triggers the appropriate
-% error.
+% \cs{@@_parse_exp_after_mark_f:nw}, which triggers the
+% appropriate error.
% \item For a control sequence not containing |\s__fp|, we call
-% \cs{@@_exp_after_?_f:nw}, causing a |bad-variable| error.
+% \cs{@@_parse_exp_after_?_f:nw}, causing a |bad-variable| error.
% \end{itemize}
% This scheme is extensible: additional types can be added by starting
% the variables with a scan mark of the form |\s__fp_|\meta{type} and
-% defining |\__fp_exp_after_|\meta{type}|_f:nw|. In all cases, we
+% defining |\__fp_parse_exp_after_|\meta{type}|_f:nw|. In all cases, we
% make sure that the last argument of \cs{@@_parse_infix:NN} is
% correctly expanded.
% \begin{macrocode}
\cs_new:Npn \@@_parse_operand_relax:NN #1#2
{
- \cs:w @@_exp_after \@@_type_from_scan:N #2 _f:nw \cs_end:
+ \cs:w @@_parse_exp_after \@@_type_from_scan:N #2 _f:nw \cs_end:
{
\exp_after:wN \@@_parse_infix:NN
\exp_after:wN #1 \tex_romannumeral:D \@@_parse_expand:w
}
#2
}
-\cs_new:Npn \@@_exp_after_mark_f:nw #1
+\cs_new_eq:NN \@@_parse_exp_after_f:nw \@@_exp_after_f:nw
+\cs_new:Npn \@@_parse_exp_after_mark_f:nw #1
{
\__msg_kernel_expandable_error:nn { kernel } { fp-early-end }
\exp_after:wN \c_nan_fp
\tex_romannumeral:D -`0 #1
}
-\cs_new:cpn { @@_exp_after_?_f:nw } #1#2
+\cs_new:cpn { @@_parse_exp_after_?_f:nw } #1#2
{
\__msg_kernel_expandable_error:nnn
{ kernel } { bad-variable } {#2}
@@ -1692,8 +1695,6 @@
% \end{macro}
%
% ^^A begin[todo]
-% ^^A todo: \@@_sin:Nn should first _set, then \@@_sin_o:w,
-% ^^A both for speed, and error reporting.
% ^^A todo: word 'e' == 'invalid syntax', word 'E' == "use 'e' instead"
%
% \subsubsection{Beyond 16 digits: rounding}
@@ -1897,7 +1898,7 @@
\tex_romannumeral:D
}
\cs_new:Npn \@@_parse_until_test:NwN #1 #2 @ #3 { #3 #1 #2 @ }
-\cs_new:Npn \@@_parse_stop_until:N #1 { }
+\cs_new_eq:NN \@@_parse_stop_until:N \use_none:n
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1990,7 +1991,10 @@
% \end{macro}
%
% \begin{macro}[int, EXP]{\@@_parse_apply_binary:NwNwN}
-%
+% Receives \meta{precedence} \meta{operand_1} |@| \meta{operation}
+% \meta{operand_2} |@| \meta{infix command}. Builds the appropriate
+% call to the \meta{operation} |#4|, given the types of the two
+% \meta{operands}.
% \begin{macrocode}
\cs_new:Npn \@@_parse_apply_binary:NwNwN #1 #2#3@ #4 #5#6@ #7
{
@@ -2012,7 +2016,7 @@
%
% \begin{macro}[int, EXP]
% {\@@_parse_apply_unary_array:NNwN, \@@_parse_apply_unary:NNwN}
-% Here, |#2| is \emph{e.g.}, \cs{@@_neg_o:w}, and expands once after the
+% Here, |#2| is \emph{e.g.}, \cs{@@_sin_o:w}, and expands once after the
% calculation.\footnote{Bruno: explain.} The argument |#3| may be an
% array, so either we map through all its items, or we feed all items
% at once to the custom function.
@@ -2171,7 +2175,7 @@
{ #2 #1 #3 \@@_parse_expand:w }
\cs_new:Npn \@@_parse_apply_round:NNwN #1#2#3@#4
{
- \if_case:w \__int_eval:w \@@_array_count:w #3@ - \c_one \__int_eval_end:
+ \if_case:w \__int_eval:w \@@_array_count:n {#3} - \c_one \__int_eval_end:
\@@_round:Nwn #2 #3 {0} \tex_romannumeral:D
\or: \@@_round:Nww #2 #3 \tex_romannumeral:D
\else:
@@ -2213,8 +2217,8 @@
\@@_parse_expand:w
}
}
-\@@_tmp:w - { neg }
-\@@_tmp:w ! { not }
+\@@_tmp:w - { - }
+\@@_tmp:w ! { ! }
% \end{macrocode}
% \end{macro}
%
@@ -2254,18 +2258,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}[int, EXP]{\@@_exp_after_array_f:w}
-% \begin{macrocode}
-\cs_new:Npn \@@_exp_after_array_f:w #1
- {
- \cs:w @@_exp_after \@@_type_from_scan:N #1 _f:nw \cs_end:
- { \@@_exp_after_array_f:w }
- #1
- }
-\cs_new:Npn \@@_exp_after_stop_f:nw #1#2 { }
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}[int]{\@@_parse_prefix_.:Nw}
% This function is called when a number starts with a dot.
% \begin{macrocode}
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
index 107b94ac0ca..ceb2840a810 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx
@@ -36,7 +36,7 @@
%
%<*driver>
\RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3fp-traps.dtx 4129 2012-08-20 20:38:28Z mittelba $
+\GetIdInfo$Id: l3fp-traps.dtx 4179 2012-08-31 15:54:18Z bruno $
{L3 Floating-point exception trapping}
\documentclass[full]{l3doc}
\begin{document}
@@ -210,7 +210,7 @@
{ \cs_set:Npn \@@_invalid_operation:nnw ##1##2##3; }
{
#1
- \@@_error:nnfn { invalid } {##2} { \@@_to_tl:w ##3; } { }
+ \@@_error:nnfn { invalid } {##2} { \fp_to_tl:n { ##3; } } { }
\fp_flag_on:n { invalid_operation }
##1
}
@@ -219,7 +219,7 @@
{
#1
\@@_error:nffn { invalid-ii }
- { \@@_to_tl:w ##2; } { \@@_to_tl:w ##3; } {##1}
+ { \fp_to_tl:n { ##2; } } { \fp_to_tl:n { ##3; } } {##1}
\fp_flag_on:n { invalid_operation }
\exp_after:wN \c_nan_fp
}
@@ -260,7 +260,7 @@
{ \cs_set:Npn \@@_division_by_zero_o:Nnw ##1##2##3; }
{
#1
- \@@_error:nnfn { zero-div } {##2} { \@@_to_tl:w ##3; } { }
+ \@@_error:nnfn { zero-div } {##2} { \fp_to_tl:n { ##3; } } { }
\fp_flag_on:n { division_by_zero }
\exp_after:wN ##1
}
@@ -269,7 +269,7 @@
{
#1
\@@_error:nffn { zero-div-ii }
- { \@@_to_tl:w ##3; } { \@@_to_tl:w ##4; } {##2}
+ { \fp_to_tl:n { ##3; } } { \fp_to_tl:n { ##4; } } {##2}
\fp_flag_on:n { division_by_zero }
\exp_after:wN ##1
}
@@ -330,7 +330,7 @@
#1
\@@_error:nffn
{ flow \if_meaning:w 1 ##1 -to \fi: }
- { \@@_to_tl:w \s_@@ \@@_chk:w ##1##2##3; }
+ { \fp_to_tl:n { \s_@@ \@@_chk:w ##1##2##3; } }
{ \token_if_eq_meaning:NNF 0 ##2 { - } #4 }
{#2}
\fp_flag_on:n {#2}
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx
index cda5912494a..81db3df7b8b 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx
@@ -35,7 +35,7 @@
%
%<*driver|package>
\RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3prop.dtx 4092 2012-08-14 14:04:41Z bruno $
+\GetIdInfo$Id: l3prop.dtx 4190 2012-09-03 00:23:31Z bruno $
{L3 Property lists}
%</driver|package>
%<*driver>
@@ -373,7 +373,7 @@
% }
% }
% \end{verbatim}
-% Use outside of a \cs{prop_map_\ldots} scenario will lead low
+% Use outside of a \cs{prop_map_\ldots} scenario will lead to low
% level \TeX{} errors.
% \end{function}
%
@@ -395,7 +395,7 @@
% }
% }
% \end{verbatim}
-% Use outside of a \cs{prop_map_\ldots} scenario will lead low
+% Use outside of a \cs{prop_map_\ldots} scenario will lead to low
% level \TeX{} errors.
% \end{function}
%
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx
index c639989d793..b4ae4118b33 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 3991 2012-07-16 19:00:35Z joseph $
+\GetIdInfo$Id: l3tl.dtx 4201 2012-09-05 08:00:54Z joseph $
{L3 Token lists}
%</driver|package>
%<*driver>
@@ -68,14 +68,14 @@
% \begin{documentation}
%
% \TeX{} works with tokens, and \LaTeX3 therefore provides a number of
-% functions to deal with token lists. Token lists may be present directly in
-% the argument to a function:
+% functions to deal with lists of tokens. Token lists may be present
+% directly in the argument to a function:
% \begin{verbatim}
% \foo:n { a collection of \tokens }
% \end{verbatim}
-% or may be stored for processing in a so-called \enquote{token list
-% variable}, which have the suffix \texttt{tl}:
-% the argument to a function:
+% or may be stored in a so-called \enquote{token list variable}, which
+% have the suffix \texttt{tl}: a token list variable can also be used as
+% the argument to a function, for example
% \begin{verbatim}
% \foo:N \l_some_tl
% \end{verbatim}
@@ -86,12 +86,13 @@
% of tokens: the two \enquote{views} of a token list are therefore collected
% together here.
%
-% A token list can be seen either as a list of \enquote{items},
-% or a list of \enquote{tokens}. An item is whatever \cs{use_none:n}
-% grabs as its argument: either a single token or a brace group,
+% A token list (explicit, or stored in a variable) can be seen either
+% as a list of \enquote{items},
+% or a list of \enquote{tokens}. An item is whatever \cs{use:n} would
+% grab as its argument: a single non-space token or a brace group,
% with optional leading explicit space characters (each item is thus
% itself a token list). A token is either a normal \texttt{N} argument,
-% or | |, |{|, or |}| (assuming normal \TeX{} category codes).
+% or \verb*| |, |{|, or |}| (assuming normal \TeX{} category codes).
% Thus for example
% \begin{verbatim}
% { Hello } ~ world
@@ -103,6 +104,30 @@
% Functions which act on items are often faster than their analogue acting
% directly on tokens.
%
+% ^^A todo: perhaps move to another module, l3token or l3basics?
+% \begin{texnote}
+% When \TeX{} fetches an undelimited argument from the input stream,
+% explicit character tokens with character code $32$ (space) and
+% category code $10$ (space), which we here call \enquote{explicit
+% space characters}, are ignored. If the following token is an
+% explicit character token with category code $1$ (begin-group) and an
+% arbitrary character code, then \TeX{} scans ahead to obtain an equal
+% number of explicit character tokens with category code $1$
+% (begin-group) and $2$ (end-group), and the resulting list of tokens
+% (with outer braces removed) becomes the argument. Otherwise, a
+% single token is taken as the argument for the macro: we call such
+% single tokens \enquote{N-type}, as they are suitable to be used as
+% an argument for a function with the signature~\texttt{:N}.
+%
+% When \TeX{} reads a character of category code $10$ for the first
+% time, it is converted to an explicit space character, with character
+% code $32$, regardless of the initial character code.
+% \enquote{Funny} spaces with a different category code, can be
+% produced using \cs{tl_to_lowercase:n} or \cs{tl_to_uppercase:n}.
+% Explicit space characters are also produced as a result of
+% \cs{token_to_str:N}, \cs{tl_to_str:n}, etc.
+% \end{texnote}
+%
% \section{Creating and initialising token list variables}
%
% \begin{function}{\tl_new:N, \tl_new:c}
@@ -181,7 +206,7 @@
% \begin{function}
% {
% \tl_set:Nn, \tl_set:NV, \tl_set:Nv, \tl_set:No, \tl_set:Nf, \tl_set:Nx,
-% \tl_set:cn, \tl_set:NV, \tl_set:Nv, \tl_set:co, \tl_set:cf, \tl_set:cx,
+% \tl_set:cn, \tl_set:cV, \tl_set:cv, \tl_set:co, \tl_set:cf, \tl_set:cx,
% \tl_gset:Nn, \tl_gset:NV, \tl_gset:Nv,
% \tl_gset:No, \tl_gset:Nf, \tl_gset:Nx,
% \tl_gset:cn, \tl_gset:cV, \tl_gset:cv,
@@ -237,7 +262,8 @@
% Replaces the first (leftmost) occurrence of \meta{old tokens} in the
% \meta{tl~var} with \meta{new tokens}. \meta{Old tokens}
% cannot contain |{|, |}| or |#|
-% (assuming normal \TeX{} category codes).
+% (more precisely, explicit character tokens with category code $1$
+% (begin-group) or $2$ (end-group), and tokens with category code $6$).
% \end{function}
%
% \begin{function}[updated = 2011-08-11]
@@ -251,11 +277,12 @@
% Replaces all occurrences of \meta{old tokens} in the
% \meta{tl~var} with \meta{new tokens}. \meta{Old tokens}
% cannot contain |{|, |}| or |#|
-% (assuming normal \TeX{} category codes). As this function
+% (more precisely, explicit character tokens with category code $1$
+% (begin-group) or $2$ (end-group), and tokens with category code $6$).
+% As this function
% operates from left to right, the pattern \meta{old tokens}
% may remain after the replacement (see \cs{tl_remove_all:Nn}
-% for an example). The assignment is
-% restricted to the current \TeX{} group.
+% for an example).
% \end{function}
%
% \begin{function}[updated = 2011-08-11]
@@ -267,8 +294,9 @@
% \cs{tl_remove_once:Nn} \meta{tl~var} \Arg{tokens}
% \end{syntax}
% Removes the first (leftmost) occurrence of \meta{tokens} from the
-% \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or
-% |#| (assuming normal \TeX{} category codes).
+% \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or |#|
+% (more precisely, explicit character tokens with category code $1$
+% (begin-group) or $2$ (end-group), and tokens with category code $6$).
% \end{function}
%
% \begin{function}[updated = 2011-08-11]
@@ -280,8 +308,10 @@
% \cs{tl_remove_all:Nn} \meta{tl~var} \Arg{tokens}
% \end{syntax}
% Removes all occurrences of \meta{tokens} from the
-% \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or
-% |#| (assuming normal \TeX{} category codes). As this function
+% \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or |#|
+% (more precisely, explicit character tokens with category code $1$
+% (begin-group) or $2$ (end-group), and tokens with category code $6$).
+% As this function
% operates from left to right, the pattern \meta{tokens}
% may remain after the removal, for instance,
% \begin{quote}
@@ -332,9 +362,9 @@
% unchanged. This process does not alter the category code assigned
% to the \meta{tokens}.
% \begin{texnote}
-% This is the \TeX{} primitive \tn{lowercase} renamed.
-% As a result, this function takes place on execution and
-% not on expansion.
+% This is the \TeX{} primitive \tn{lowercase} renamed. As a result,
+% its argument \emph{must} be given within braces, and this function
+% takes place on execution and not on expansion.
% \end{texnote}
% \end{function}
%
@@ -348,9 +378,9 @@
% unchanged. This process does not alter the category code assigned
% to the \meta{tokens}.
% \begin{texnote}
-% This is the \TeX{} primitive \tn{uppercase} renamed.
-% As a result, this function takes place on execution and
-% not on expansion.
+% This is the \TeX{} primitive \tn{uppercase} renamed. As a result,
+% its argument \emph{must} be given within braces, and this function
+% takes place on execution and not on expansion.
% \end{texnote}
% \end{function}
%
@@ -363,14 +393,15 @@
% \end{syntax}
% Tests if the \meta{token list} consists only of blank spaces
% (\emph{i.e.}~contains no item). The test is \texttt{true} if
-% \meta{token list} is zero or more explicit tokens of character code~$32$
-% and category code~$10$, and is \texttt{false} otherwise.
+% \meta{token list} is zero or more explicit space characters
+% (explicit tokens with character code~$32$ and category code~$10$),
+% and is \texttt{false} otherwise.
% \end{function}
%
% \begin{function}[EXP,pTF]{\tl_if_empty:N, \tl_if_empty:c}
% \begin{syntax}
-% \cs{tl_if_empty_p:N} \meta{tl var}
-% \cs{tl_if_empty:NTF} \meta{tl var} \Arg{true code} \Arg{false code}
+% \cs{tl_if_empty_p:N} \meta{tl~var}
+% \cs{tl_if_empty:NTF} \meta{tl~var} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the \meta{token list variable} is entirely empty
% (\emph{i.e.}~contains no tokens at all).
@@ -389,8 +420,8 @@
% \begin{function}[EXP,pTF]
% {\tl_if_eq:NN, \tl_if_eq:Nc, \tl_if_eq:cN, \tl_if_eq:cc}
% \begin{syntax}
-% \cs{tl_if_eq_p:NN} \Arg{tl var_1} \Arg{tl var_2}
-% \cs{tl_if_eq:NNTF} \Arg{tl var_1} \Arg{tl var_2} \Arg{true code} \Arg{false code}
+% \cs{tl_if_eq_p:NN} \Arg{tl~var_1} \Arg{tl~var_2}
+% \cs{tl_if_eq:NNTF} \Arg{tl~var_1} \Arg{tl~var_2} \Arg{true code} \Arg{false code}
% \end{syntax}
% Compares the content of two \meta{token list variables} and
% is logically \texttt{true} if the two contain the same list of
@@ -399,17 +430,18 @@
% \begin{verbatim}
% \tl_set:Nn \l_tmpa_tl { abc }
% \tl_set:Nx \l_tmpb_tl { \tl_to_str:n { abc } }
-% \tl_if_eq_p:NN \l_tmpa_tl \l_tmpb_tl
+% \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl { true } { false }
% \end{verbatim}
-% is logically \texttt{false}.
+% yields \texttt{false}.
% \end{function}
%
% \begin{function}[TF]{\tl_if_eq:nn}
% \begin{syntax}
% \cs{tl_if_eq:nnTF} \meta{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code}
% \end{syntax}
-% Tests if \meta{token list_1} and \meta{token list_2} are equal, both in
-% respect of character codes and category codes.
+% Tests if \meta{token list_1} and \meta{token list_2} contain the
+% same list of tokens, both in respect of character codes and category
+% codes.
% \end{function}
%
% \begin{function}[TF]{\tl_if_in:Nn, \tl_if_in:cn}
@@ -417,9 +449,10 @@
% \cs{tl_if_in:NnTF} \meta{tl~var} \Arg{token list} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the \meta{token list} is found in the content of the
-% \meta{token list variable}. The \meta{token list} cannot contain
-% the tokens |{|, |}| or |#| (assuming the usual \TeX{} category
-% codes apply).
+% \meta{tl~var}. The \meta{token list} cannot contain
+% the tokens |{|, |}| or |#|
+% (more precisely, explicit character tokens with category code $1$
+% (begin-group) or $2$ (end-group), and tokens with category code $6$).
% \end{function}
%
% \begin{function}[TF]
@@ -427,9 +460,10 @@
% \begin{syntax}
% \cs{tl_if_in:nnTF} \Arg{token list_1} \Arg{token list_2} \Arg{true code} \Arg{false code}
% \end{syntax}
-% Tests if <token list_2> is found inside <token list_1>.
-% The \meta{token list} cannot contain the tokens |{|, |}| or |#|
-% (assuming the usual \TeX{} category codes apply).
+% Tests if \meta{token list_2} is found inside \meta{token list_1}.
+% The \meta{token list_2} cannot contain the tokens |{|, |}| or |#|
+% (more precisely, explicit character tokens with category code $1$
+% (begin-group) or $2$ (end-group), and tokens with category code $6$).
% \end{function}
%
% \begin{function}[updated = 2011-08-13, EXP,pTF]
@@ -439,10 +473,10 @@
% \cs{tl_if_single:NTF} \Arg{tl~var} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the content of the \meta{tl~var} consists of a single item,
-% \emph{i.e.}~is either a single normal token (excluding spaces,
-% and brace tokens) or a single brace group, surrounded by optional
-% spaces on both sides. In other words, such a token list has token count
-% $1$ according to \cs{tl_count:N}.
+% \emph{i.e.}~is a single normal token (neither an explicit space
+% character nor a begin-group character) or a single brace group,
+% surrounded by optional spaces on both sides. In other words, such a
+% token list has token count $1$ according to \cs{tl_count:N}.
% \end{function}
%
% \begin{function}[updated = 2011-08-13, EXP,pTF]{\tl_if_single:n}
@@ -450,10 +484,11 @@
% \cs{tl_if_single_p:n} \Arg{token list}
% \cs{tl_if_single:nTF} \Arg{token list} \Arg{true code} \Arg{false code}
% \end{syntax}
-% Tests if the token list has exactly one item, \emph{i.e.}~is either
-% a single normal token or a single brace group, surrounded by
-% optional spaces on both sides. In other words, such a token list
-% has token count $1$ according to \cs{tl_count:n}.
+% Tests if the \meta{token list} has exactly one item, \emph{i.e.}~is
+% a single normal token (neither an explicit space character nor a
+% begin-group character) or a single brace group, surrounded by
+% optional spaces on both sides. In other words, such a token list has
+% token count $1$ according to \cs{tl_count:n}.
% \end{function}
%
% \begin{function}[added = 2012-06-03, EXP]{\tl_case:Nnn, \tl_case:cnn}
@@ -469,8 +504,7 @@
% \end{syntax}
% This function compares the \meta{test token list variable} in turn
% with each of the \meta{token list variable cases}. If the two
-% are equal (as described for
-% \cs{tl_if_eq:nnTF}
+% are equal (as described for \cs{tl_if_eq:NNTF})
% then the associated \meta{code} is left in the input
% stream. If none of the tests are \texttt{true} then the
% \texttt{else code} will be left in the input stream.
@@ -509,7 +543,7 @@
% Applies the \meta{inline function} to every \meta{item} stored within the
% \meta{tl~var}. The \meta{inline function} should consist of code which
% will receive the \meta{item} as |#1|. One in line mapping can be nested
-% inside another. See also \cs{tl_map_function:Nn}.
+% inside another. See also \cs{tl_map_function:NN}.
% \end{function}
%
% \begin{function}[updated = 2012-06-29]{\tl_map_inline:nn}
@@ -519,7 +553,7 @@
% Applies the \meta{inline function} to every \meta{item} stored within the
% \meta{token list}. The \meta{inline function} should consist of code which
% will receive the \meta{item} as |#1|. One in line mapping can be nested
-% inside another. See also \cs{tl_map_function:nn}.
+% inside another. See also \cs{tl_map_function:nN}.
% \end{function}
%
% \begin{function}[updated = 2012-06-29]
@@ -555,14 +589,12 @@
% \begin{verbatim}
% \tl_map_inline:Nn \l_my_tl
% {
-% \str_if_eq:nnTF { #1 } { bingo }
-% { \tl_map_break: }
-% {
-% % Do something useful
-% }
+% \str_if_eq:nnT { #1 } { bingo } { \tl_map_break: }
+% % Do something useful
% }
% \end{verbatim}
-% Use outside of a \cs{tl_map_\ldots} scenario will lead low
+% See also \cs{tl_map_break:n}.
+% Use outside of a \cs{tl_map_\ldots} scenario will lead to low
% level \TeX{} errors.
% \begin{texnote}
% When the mapping is broken, additional tokens may be inserted by the
@@ -583,11 +615,9 @@
% \begin{verbatim}
% \tl_map_inline:Nn \l_my_tl
% {
-% \str_if_eq:nnTF { #1 } { bingo }
+% \str_if_eq:nnT { #1 } { bingo }
% { \tl_map_break:n { <tokens> } }
-% {
-% % Do something useful
-% }
+% % Do something useful
% }
% \end{verbatim}
% Use outside of a \cs{tl_map_\ldots} scenario will lead to low
@@ -659,7 +689,7 @@
% Counts the number of token groups in the \meta{tl~var}
% and leaves this information in the input stream. Unbraced tokens
% count as one element as do each token group (|{|\ldots|}|). This
-% process will ignore any unprotected spaces within \meta{tokens}.
+% process will ignore any unprotected spaces within the \meta{tl~var}.
% See also \cs{tl_count:n}. This function requires three expansions,
% giving an \meta{integer denotation}.
% \end{function}
@@ -679,9 +709,8 @@
% consider \cs{tl_reverse_items:n}.
% See also \cs{tl_reverse:N}.
% \begin{texnote}
-% The result is returned within the \tn{unexpanded}
-% primitive (\cs{exp_not:n}), which means that the token
-% list will not expand further when appearing in an x-type
+% The result is returned within \tn{exp_not:n}, which means that the token
+% list will not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
@@ -697,7 +726,8 @@
% This process will preserve unprotected spaces within the
% \meta{token list variable}. Braced token groups are copied without
% reversing the order of tokens, but keep the outer set of braces.
-% See also \cs{tl_reverse:n}.
+% See also \cs{tl_reverse:n}, and, for improved performance,
+% \cs{tl_reverse_items:n}.
% \end{function}
%
% \begin{function}[added = 2012-01-08, EXP]{\tl_reverse_items:n}
@@ -712,11 +742,10 @@
% reversing the order of tokens, and keep the outer set of braces.
% Items which are initially not braced are copied with braces in
% the result. In cases where preserving spaces is important,
-% consider \cs{tl_reverse:n} or \cs{tl_reverse_tokens:n}.
+% consider the slower function \cs{tl_reverse:n}.
% \begin{texnote}
-% The result is returned within the \tn{unexpanded}
-% primitive (\cs{exp_not:n}), which means that the token
-% list will not expand further when appearing in an x-type
+% The result is returned within \tn{exp_not:n}, which means that the token
+% list will not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
@@ -724,15 +753,15 @@
% \begin{function}[added = 2011-07-09, updated = 2012-06-25, EXP]
% {\tl_trim_spaces:n}
% \begin{syntax}
-% \cs{tl_trim_spaces:n} \meta{token list}
+% \cs{tl_trim_spaces:n} \Arg{token list}
% \end{syntax}
% Removes any leading and trailing explicit space characters
+% (explicit tokens with character code~$32$ and category code~$10$)
% from the \meta{token list} and leaves the result in the input
% stream.
% \begin{texnote}
-% The result is returned within the \tn{unexpanded}
-% primitive (\cs{exp_not:n}), which means that the token
-% list will not expand further when appearing in an x-type
+% The result is returned within \tn{exp_not:n}, which means that the token
+% list will not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
@@ -746,22 +775,25 @@
% \cs{tl_trim_spaces:N} \meta{tl~var}
% \end{syntax}
% Removes any leading and trailing explicit space characters
+% (explicit tokens with character code~$32$ and category code~$10$)
% from the content of the \meta{tl~var}.
% \end{function}
%
% \section{The first token from a token list}
%
-% Functions which deal with either only the very first token of a
-% token list or everything except the first token.
+% Functions which deal with either only the very first item (balanced
+% text or single normal token) in a token list, or the remaining tokens.
%
% \begin{function}[updated = 2012-02-08, EXP]
% {\tl_head:N, \tl_head:n, \tl_head:V, \tl_head:v, \tl_head:f}
% \begin{syntax}
-% \cs{tl_head:n} \Arg{tokens}
+% \cs{tl_head:n} \Arg{token list}
% \end{syntax}
-% Leaves in the input stream the first non-space token from the
-% \meta{tokens}. Any leading space tokens will be discarded, and thus for
-% example
+% Leaves in the input stream the first \meta{item} in the
+% \meta{token list}, discarding the rest of the \meta{token list}.
+% All leading explicit space characters
+% (explicit tokens with character code~$32$ and category code~$10$)
+% are discarded; for example
% \begin{verbatim}
% \tl_head:n { abc }
% \end{verbatim}
@@ -769,86 +801,79 @@
% \begin{verbatim}
% \tl_head:n { ~ abc }
% \end{verbatim}
-% will both leave |a| in the input stream.
-% An empty list of \meta{tokens} or one which consists
-% only of space (category code $10$) tokens will result in \cs{tl_head:n}
-% leaving nothing in the input stream.
+% will both leave |a| in the input stream. If the \enquote{head} is a
+% brace group, rather than a single token, the braces will be removed, and
+% so
+% \begin{verbatim}
+% \tl_head:n { ~ { ~ ab } c }
+% \end{verbatim}
+% yields \verb*| ab|.
+% A blank \meta{token list} (see \cs{tl_if_blank:nTF}) will result in
+% \cs{tl_head:n} leaving nothing in the input stream. The \meta{token list}
+% should not contain the marker \cs{q_stop}.
% \begin{texnote}
-% The result is returned within the \tn{unexpanded}
-% primitive (\cs{exp_not:n}), which means that the token
-% list will not expand further when appearing in an x-type
+% The result is returned within \cs{exp_not:n}, which means that the token
+% list will not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
%
% \begin{function}[EXP]{\tl_head:w}
% \begin{syntax}
-% \cs{tl_head:w} \meta{tokens} \cs{q_stop}
+% \cs{tl_head:w} \meta{token list} | { } | \cs{q_stop}
% \end{syntax}
-% Leaves in the input stream the first non-space token from the
-% \meta{tokens}. An empty list of \meta{tokens} or one which consists
-% only of space (category code $10$) tokens will result in an error, and
-% thus \meta{tokens} must \emph{not} be \enquote{blank} as determined by
-% \cs{tl_if_blank:n(TF)}. This function requires only a single expansion,
-% and thus is suitable for use within an \texttt{o}-type expansion. In
-% general, \cs{tl_head:n} should be preferred if the number of expansions
-% is not critical.
+% Leaves in the input stream the first \meta{item} in the
+% \meta{token list}, discarding the rest of the \meta{token list}.
+% All leading explicit space characters
+% (explicit tokens with character code~$32$ and category code~$10$)
+% are discarded.
+% A blank \meta{token list} (which consists only of space characters)
+% will result in a low-level \TeX{} error, which may be avoided by the
+% inclusion of an empty group in the input (as shown), without the need
+% for an explicit test. Alternatively, \cs{tl_if_blank:nF} may be used to
+% avoid using the function with a \enquote{blank} argument.
+% This function requires only a single expansion, and thus is suitable for
+% use within an \texttt{o}-type expansion. In general, \cs{tl_head:n} should
+% be preferred if the number of expansions is not critical.
% \end{function}
%
-% \begin{function}[updated = 2012-02-08, EXP]
+% \begin{function}[updated = 2012-09-01, EXP]
% {\tl_tail:N, \tl_tail:n, \tl_tail:V, \tl_tail:v, \tl_tail:f}
% \begin{syntax}
-% \cs{tl_tail:n} \Arg{tokens}
+% \cs{tl_tail:n} \Arg{token list}
% \end{syntax}
-% Discards the all leading space tokens and the first non-space token
-% in the \meta{tokens}, and leaves the remaining tokens in the
-% input stream. Thus for example
+% Discards all leading explicit space characters
+% (explicit tokens with character code~$32$ and category code~$10$)
+% and the first \meta{item} in the \meta{token list}, and leaves the
+% remaining tokens in the input stream. Thus for example
% \begin{verbatim}
-% \tl_tail:n { abc }
+% \tl_tail:n { a ~ {bc} d }
% \end{verbatim}
% and
% \begin{verbatim}
-% \tl_tail:n { ~ abc }
+% \tl_tail:n { ~ a ~ {bc} d }
% \end{verbatim}
-% will both leave |bc| in the input stream.
-% An empty list of \meta{tokens} or one which consists
-% only of space (category code $10$) tokens will result in \cs{tl_tail:n}
-% leaving nothing in the input stream.
+% will both leave \verb*| {bc}d| in the input stream. A blank
+% \meta{token list} (see \cs{tl_if_blank:nTF}) will result
+% in \cs{tl_tail:n} leaving nothing in the input stream.
% \begin{texnote}
-% The result is returned within the \tn{unexpanded}
-% primitive (\cs{exp_not:n}), which means that the token
-% list will not expand further when appearing in an x-type
+% The result is returned within \cs{exp_not:n}, which means that the
+% token list will not expand further when appearing in an \texttt{x}-type
% argument expansion.
% \end{texnote}
% \end{function}
%
-% \begin{function}[EXP]{\tl_tail:w}
-% \begin{syntax}
-% \cs{tl_tail:w} \Arg{tokens} \cs{q_stop}
-% \end{syntax}
-% Discards the all leading space tokens and the first non-space token
-% in the \meta{tokens}, and leaves the remaining tokens in the
-% input stream.
-% An empty list of \meta{tokens} or one which consists
-% only of space (category code $10$) tokens will result in an error, and
-% thus \meta{tokens} must \emph{not} be \enquote{blank} as determined by
-% \cs{tl_if_blank:n(TF)}. This function requires only a single expansion,
-% and thus is suitable for use within an \texttt{o}-type expansion. In
-% general, \cs{tl_tail:n} should be preferred if the number of expansions
-% is not critical.
-% \end{function}
-%
% \begin{function}[added = 2011-08-10, EXP]{\str_head:n,\str_tail:n}
% \begin{syntax}
-% \cs{str_head:n} \Arg{tokens}
-% \cs{str_tail:n} \Arg{tokens}
+% \cs{str_head:n} \Arg{token list}
+% \cs{str_tail:n} \Arg{token list}
% \end{syntax}
-% Converts the \meta{tokens} into a string, as described for
+% Converts the \meta{token list} into a string, as described for
% \cs{tl_to_str:n}. The \cs{str_head:n} function then leaves
% the first character of this string in the input stream.
% The \cs{str_tail:n} function leaves all characters except
% the first in the input stream. The first character may be
-% a space. If the \meta{tokens} argument is entirely empty,
+% a space. If the \meta{token list} argument is entirely empty,
% nothing is left in the input stream.
% \end{function}
%
@@ -892,11 +917,11 @@
% \cs{tl_if_head_is_group:nTF} \Arg{token list} \Arg{true code} \Arg{false code}
% \end{syntax}
% Tests if the first \meta{token} in the \meta{token list}
-% is an explicit begin-group character (with category code~1
+% is an explicit begin-group character (with category code~$1$
% and any character code), in other words, if the \meta{token list}
% starts with a brace group. In particular, the test is \texttt{false}
% if the \meta{token list} starts with an implicit token such as
-% \cs{c_group_begin_token}, or if it empty.
+% \cs{c_group_begin_token}, or if it is empty.
% This function is useful to implement actions on token lists on
% a token by token basis.
% \end{function}
@@ -908,8 +933,9 @@
% \end{syntax}
% Tests if the first \meta{token} in the \meta{token list}
% is a normal \texttt{N}-type argument. In other words,
-% it is neither an explicit space character (with category code~10
-% and character code~32) nor an explicit begin-group character
+% it is neither an explicit space character
+% (explicit token with character code~$32$ and category code~$10$)
+% nor an explicit begin-group character
% (with category code~1 and any character code). An empty
% argument yields \texttt{false}, as it does not have a \enquote{normal}
% first token.
@@ -922,23 +948,14 @@
% \cs{tl_if_head_is_space_p:n} \Arg{token list}
% \cs{tl_if_head_is_space:nTF} \Arg{token list} \Arg{true code} \Arg{false code}
% \end{syntax}
-%^^A We need to add a discussion of
-%^^A explicit vs implicit tokens somewhere in the doc.
% Tests if the first \meta{token} in the \meta{token list}
-% is an explicit space character (with category code~$10$
-% and character code~$32$). If \meta{token list} starts with
-% an implicit token such as \cs{c_space_token}, the test
-% will yield \texttt{false}, as well as if the argument is empty.
+% is an explicit space character
+% (explicit token with character code~$12$ and category code~$10$).
+% In particular, the test is \texttt{false} if the \meta{token list}
+% starts with an implicit token such as \cs{c_space_token}, or if it
+% is empty.
% This function is useful to implement actions on token lists on
% a token by token basis.
-% \begin{texnote}
-% When \TeX{} reads a character of category code $10$ for the
-% first time, it is converted to an explicit space token, with
-% character code $32$, regardless of the initial character code.
-% \enquote{Funny} spaces with a different category code, can be produced
-% using \tn{lowercase}. Explicit spaces are also produced
-% as a result of \cs{token_to_str:N}, \cs{tl_to_str:n}, etc.
-% \end{texnote}
% \end{function}
%
% \section{Viewing token lists}
@@ -960,25 +977,26 @@
% Displays the \meta{token list} on the terminal.
% \begin{texnote}
% \cs{tl_show:n} is the \eTeX{} primitive \tn{showtokens}.
+% Hence its argument \emph{must} be given within braces.
% \end{texnote}
% \end{function}
%
% \section{Constant token lists}
%
+% \begin{variable}{\c_empty_tl}
+% Constant that is always empty.
+% \end{variable}
+%
% \begin{variable}[updated = 2011-08-18]{\c_job_name_tl}
% Constant that gets the \enquote{job name} assigned when \TeX{} starts.
% \begin{texnote}
-% This is the new name for the primitive \tn{jobname}. It is a constant
+% This copies the contents of the primitive \tn{jobname}. It is a constant
% that is set by \TeX{} and should not be overwritten by the package.
% \end{texnote}
% \end{variable}
%
-% \begin{variable}{\c_empty_tl}
-% Constant that is always empty.
-% \end{variable}
-%
% \begin{variable}{\c_space_tl}
-% A space token contained in a token list (compare this with
+% An explicit space character contained in a token list (compare this with
% \cs{c_space_token}). For use where an explicit space is required.
% \end{variable}
%
@@ -1011,7 +1029,7 @@
% instance, \cs{tl_trim_spaces:n} is implemented by taking the
% \meta{continuation} to be \cs{exp_not:o}, and the \texttt{o}-type
% expansion removes the \cs{q_mark}. This function is also used in
-% \pkg{l3clist}.
+% \pkg{l3clist} and \pkg{l3candidates}.
% \end{function}
%
% \end{documentation}
@@ -1044,7 +1062,7 @@
%
% \begin{macro}{\tl_new:N, \tl_new:c}
% Creating new token list variables is a case of checking for an
-% existing definition and if free doing the definition.
+% existing definition and doing the definition.
% \begin{macrocode}
\cs_new_protected:Npn \tl_new:N #1
{
@@ -1073,14 +1091,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{variable}{\c_empty_tl}
-% Never full. We need to define that constant early
-% for \cs{tl_new:N} to work properly.
-% \begin{macrocode}
-\tl_const:Nn \c_empty_tl { }
-% \end{macrocode}
-% \end{variable}
-%
% \begin{macro}{\tl_clear:N, \tl_clear:c}
% \begin{macro}{\tl_gclear:N, \tl_gclear:c}
% Clearing a token list variable means setting it to an empty value.
@@ -1157,6 +1167,13 @@
%
% \subsection{Constant token lists}
%
+% \begin{variable}{\c_empty_tl}
+% Never full. We need to define that constant before using \cs{tl_new:N}.
+% \begin{macrocode}
+\tl_const:Nn \c_empty_tl { }
+% \end{macrocode}
+% \end{variable}
+%
% \begin{variable}{\c_job_name_tl}
% Inherited from the \LaTeX3 name for the primitive: this needs to
% actually contain the text of the job name rather than the name of
@@ -1165,17 +1182,24 @@
% make in the \LuaTeX{} case.
% \begin{macrocode}
%<*initex>
-\tex_everyjob:D \exp_after:wN
+\luatex_if_engine:T
{
- \tex_the:D \tex_everyjob:D
- \luatex_if_engine:T
+ \tex_everyjob:D \exp_after:wN
{
- \lua_now:x
+ \tex_the:D \tex_everyjob:D
+ \lua_now_x:n
{ dofile ( assert ( kpse.find_file ("lualatexquotejobname.lua" ) ) ) }
}
}
+\tex_everyjob:D \exp_after:wN
+ {
+ \tex_the:D \tex_everyjob:D
+ \tl_const:Nx \c_job_name_tl { \tex_jobname:D }
+ }
%</initex>
+%<*package>
\tl_const:Nx \c_job_name_tl { \tex_jobname:D }
+%</package>
% \end{macrocode}
% \end{variable}
%
@@ -1191,13 +1215,13 @@
% \begin{macro}
% {
% \tl_set:Nn, \tl_set:NV, \tl_set:Nv, \tl_set:No, \tl_set:Nf, \tl_set:Nx,
-% \tl_set:cn, \tl_set:NV, \tl_set:Nv, \tl_set:co, \tl_set:cf, \tl_set:cx
+% \tl_set:cn, \tl_set:cV, \tl_set:cv, \tl_set:co, \tl_set:cf, \tl_set:cx
% }
% \begin{macro}
% {
% \tl_gset:Nn, \tl_gset:NV, \tl_gset:Nv,
% \tl_gset:No, \tl_gset:Nf, \tl_gset:Nx,
-% \tl_gset:cn, \tl_gset:NV, \tl_gset:Nv,
+% \tl_gset:cn, \tl_gset:cV, \tl_gset:cv,
% \tl_gset:co, \tl_gset:cf, \tl_gset:cx
% }
% By using \cs{exp_not:n} token list variables can contain |#| tokens,
@@ -1745,9 +1769,9 @@
% \end{macro}
%
% \begin{macro}[EXP,pTF]{\tl_if_single:n}
-% A token list has exactly one item if it is either a single
-% token surrounded by optional explicit spaces, or a single brace
-% group surrounded by optional explicit spaces. The naive
+% A token list has exactly one item if it is a single token or a
+% single brace group, surrounded by optional explicit spaces.
+% The naive
% version of this test would do \cs{use_none:n} |#1|, and
% test if the result is empty. However, this will fail when
% the token list is empty. Furthermore, it does not allow optional
@@ -2200,33 +2224,48 @@
%
% \subsection{The first token from a token list}
%
-% \begin{macro}{\tl_head:N, \tl_head:n, \tl_head:V, \tl_head:v, \tl_head:f}
% \begin{macro}{\tl_head:w}
+% \begin{macro}{\tl_head:N, \tl_head:n, \tl_head:V, \tl_head:v, \tl_head:f}
% \begin{macro}{\tl_tail:N, \tl_tail:n, \tl_tail:V, \tl_tail:v, \tl_tail:f}
-% \begin{macro}{\tl_tail:w}
-% \begin{macro}[aux]{\@@_tail:w}
-% These functions pick up either the head or the tail of a list. The
-% empty brace groups in \cs{tl_head:n} and \cs{tl_tail:n} ensure that
-% a blank argument gives an empty result. The result is returned within
-% the \tn{unexpanded} primitive.
+% Finding the head of a token list expandably will always strip braces, which
+% is fine as this is consistent with for example mapping to a list. The
+% empty brace groups in \cs{tl_head:n} ensure that a blank argument gives an
+% empty result. The result is returned within the \tn{unexpanded} primitive.
% \begin{macrocode}
\cs_new:Npn \tl_head:w #1#2 \q_stop {#1}
-\cs_new:Npn \tl_tail:w #1#2 \q_stop {#2}
\cs_new:Npn \tl_head:n #1
{ \etex_unexpanded:D \exp_after:wN { \tl_head:w #1 { } \q_stop } }
-\cs_new:Npn \tl_tail:n #1
- { \etex_unexpanded:D \@@_tail:w #1 \q_mark { } \q_mark \q_stop }
-\cs_new:Npn \@@_tail:w #1 #2 \q_mark #3 \q_stop { {#2} }
-\cs_new_nopar:Npn \tl_head:N { \exp_args:No \tl_head:n }
\cs_generate_variant:Nn \tl_head:n { V , v , f }
-\cs_new_nopar:Npn \tl_tail:N { \exp_args:No \tl_tail:n }
+\cs_new_nopar:Npn \tl_head:N { \exp_args:No \tl_head:n }
+% \end{macrocode}
+% To corrected leave the tail of a token list, it's important \emph{not} to
+% absorb any of the tail part as an argument. For example, the simple
+% definition
+% \begin{verbatim}
+% \cs_new:Npn \tl_tail:n #1 { \tl_tail:w #1 \q_stop }
+% \cs_new:Npn \tl_tail:w #1#2 \q_stop
+% \end{verbatim}
+% will give the wrong result for |\tl_tail:n { a { bc } }| (the braces will
+% be stripped). Thus the only safe way to proceed is to first check that
+% there is an item to grab (\emph{i.e.}~that the argument is not blank) and
+% assuming there is to dispose of the first item. As with \cs{tl_head:n},
+% the result is protected from further expansion by \tn{etex_unexpanded:D}.
+% While we could optimise the test here, this would leave some tokens
+% \enquote{banned} in the input, which we do not have with this definition.
+% \begin{macrocode}
+\cs_new:Npn \tl_tail:n #1
+ {
+ \etex_unexpanded:D
+ \tl_if_blank:nTF {#1}
+ { { } }
+ { \exp_after:wN { \use_none:n #1 } }
+ }
\cs_generate_variant:Nn \tl_tail:n { V , v , f }
+\cs_new_nopar:Npn \tl_tail:N { \exp_args:No \tl_tail:n }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
%
% \begin{macro}{\str_head:n, \str_tail:n}
% \begin{macro}[aux]{\__str_head:w}
@@ -2404,7 +2443,7 @@
% \begin{macro}[pTF]{\tl_if_head_is_N_type:n}
% The first token of a token list can be either an N-type argument,
% a begin-group token (catcode 1), or an explicit space token
-% (catcode 10 and charcode 32). These two cases are characterized
+% (catcode 10 and charcode 32). The latter two cases are characterized
% by the fact that \cs{use:n} removes some tokens from |#1|, hence
% changing its string representation (no token can have an empty
% string representation). The extra brace group covers the case of
@@ -2658,7 +2697,7 @@
{ \__str_if_eq_x_return:nn { } {#1} }
% \end{macrocode}
% \end{macro}
-%
+%
% Deprecated 2012-07-08 for removal after 2012-10-31.
%
% \begin{macro}[EXP, pTF]{\tl_if_head_group:n}
@@ -2676,6 +2715,15 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}{\tl_tail:w}
+% Deprecated 2012-09-01 for removal after 2012-12-31. This is broken as
+% it will strip braces from a case such as |a{bc}|.
+% \begin{macrocode}
+\cs_new:Npn \tl_tail:w #1#2 \q_stop {#2}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macrocode}
%</initex|package>
% \end{macrocode}
diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
index cea474599f5..d7a7864af21 100644
--- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
@@ -37,8 +37,8 @@
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2012/08/29]
-%<package>\@ifpackagelater{expl3}{2012/08/29}
+\RequirePackage{expl3}[2012/09/05]
+%<package>\@ifpackagelater{expl3}{2012/09/05}
%<package> {}
%<package> {%
%<package> \PackageError{l3keys2e}{Support package l3kernel too old.}
@@ -50,7 +50,7 @@
%<package> \endinput
%<package> }
\RequirePackage{xparse}
-\GetIdInfo$Id: l3keys2e.dtx 4160 2012-08-29 18:57:05Z joseph $
+\GetIdInfo$Id: l3keys2e.dtx 4205 2012-09-05 10:30:28Z joseph $
{LaTeX2e option processing using LaTeX3 keys}
%</driver|package>
%<*driver>
diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
index 23ead12a04b..e0733c02e94 100644
--- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx
@@ -41,8 +41,8 @@
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2012/08/29]
-%<package>\@ifpackagelater{expl3}{2012/08/29}
+\RequirePackage{expl3}[2012/09/05]
+%<package>\@ifpackagelater{expl3}{2012/09/05}
%<package> {}
%<package> {%
%<package> \PackageError{xparse}{Support package l3kernel too old.}
@@ -53,7 +53,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: xparse.dtx 4160 2012-08-29 18:57:05Z joseph $
+\GetIdInfo$Id: xparse.dtx 4205 2012-09-05 10:30:28Z joseph $
{L3 Experimental document command parser}
%</driver|package>
%<*driver>
diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
index be2389c6dde..ca77b8910e8 100644
--- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx
@@ -41,8 +41,8 @@
%<*driver|package>
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
-\RequirePackage{expl3}[2012/08/29]
-%<package>\@ifpackagelater{expl3}{2012/08/29}
+\RequirePackage{expl3}[2012/09/05]
+%<package>\@ifpackagelater{expl3}{2012/09/05}
%<package> {}
%<package> {%
%<package> \PackageError{xtemplate}{Support package l3kernel too old.}
@@ -53,7 +53,7 @@
%<package> }%
%<package> \endinput
%<package> }
-\GetIdInfo$Id: xtemplate.dtx 4160 2012-08-29 18:57:05Z joseph $
+\GetIdInfo$Id: xtemplate.dtx 4205 2012-09-05 10:30:28Z joseph $
{L3 Experimental prototype document functions}
%</driver|package>
%<*driver>