From a495fe970496337011c0698a03476ce888a26105 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 24 Sep 2018 20:23:18 +0000 Subject: l3 (24sep18) git-svn-id: svn://tug.org/texlive/trunk@48749 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/l3build/l3build.dtx | 20 +- Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 4 +- .../texmf-dist/source/latex/l3kernel/l3alloc.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3basics.dtx | 2 +- .../source/latex/l3kernel/l3bootstrap.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3box.dtx | 2 +- .../source/latex/l3kernel/l3candidates.dtx | 133 ++++++- .../texmf-dist/source/latex/l3kernel/l3clist.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3coffins.dtx | 2 +- .../source/latex/l3kernel/l3color-base.dtx | 2 +- .../source/latex/l3kernel/l3deprecation.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3doc.dtx | 57 ++- .../source/latex/l3kernel/l3docstrip.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3drivers.dtx | 443 ++++++++++++++++++++- .../texmf-dist/source/latex/l3kernel/l3expan.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3file.dtx | 42 +- .../texmf-dist/source/latex/l3kernel/l3final.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3flag.dtx | 2 +- .../source/latex/l3kernel/l3fp-assign.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fp-aux.dtx | 2 +- .../source/latex/l3kernel/l3fp-basics.dtx | 2 +- .../source/latex/l3kernel/l3fp-convert.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fp-expo.dtx | 2 +- .../source/latex/l3kernel/l3fp-extended.dtx | 2 +- .../source/latex/l3kernel/l3fp-logic.dtx | 2 +- .../source/latex/l3kernel/l3fp-parse.dtx | 2 +- .../source/latex/l3kernel/l3fp-random.dtx | 2 +- .../source/latex/l3kernel/l3fp-round.dtx | 2 +- .../source/latex/l3kernel/l3fp-traps.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fp-trig.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3fparray.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 4 +- .../source/latex/l3kernel/l3intarray.dtx | 2 +- .../source/latex/l3kernel/l3kernel-functions.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3keys.dtx | 76 ++-- .../texmf-dist/source/latex/l3kernel/l3luatex.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3names.dtx | 51 ++- .../source/latex/l3kernel/l3oldmodules.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3prop.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3quark.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3regex.dtx | 16 +- Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3sort.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3str.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3sys.dtx | 2 +- .../source/latex/l3kernel/l3tl-analysis.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3token.dtx | 2 +- .../texmf-dist/source/latex/l3kernel/l3unicode.dtx | 2 +- .../source/latex/l3packages/l3keys2e/l3keys2e.dtx | 4 +- .../texmf-dist/source/latex/l3packages/xfp/xfp.dtx | 4 +- .../source/latex/l3packages/xfrac/xfrac.dtx | 4 +- .../source/latex/l3packages/xparse/xparse.dtx | 373 +++++++++-------- .../latex/l3packages/xtemplate/xtemplate.dtx | 4 +- 58 files changed, 984 insertions(+), 337 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index f6c691d3fdf..352db17b2fc 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -152,6 +152,7 @@ \luavarseparator \luavarset{asciiengines}{\{"pdftex"\}}{Engines which should log as sure ASCII} \luavarset{checkruns} {1} {Number of runs to complete for a test before comparing the log} +\luavarset{ctanreadme}{"README.md"} {Name of the file to send to CTAN as \texttt{README.\meta{ext}}} \luavarset{ctanzip}{ctanpkg ... "-ctan"}{Name of the zip file created for upload to CTAN} \luavarset{epoch} {1463734800} {Epoch (Unix date) to set for test runs} \luavarset{flatten} {true} {Switch to flatten any source structure when sending to CTAN} @@ -222,7 +223,7 @@ % }^^A % } % -% \date{Released 2018-09-21} +% \date{Released 2018-09-23} % % \maketitle % \tableofcontents @@ -437,6 +438,11 @@ % The |source| tree is constructed from all files matched by \var{typesetfiles} and \var{sourcefiles}. % The |tex| tree from all files matched by \var{installfiles}. % +% The special case \var{ctanreadme} is used to allow renaming of a local +% |foo.xyz| file to |README.xyz|. The local |foo.xyz| should be listed in +% \var{textfiles}, and will be renamed as part of constructing the CTAN +% structure. The file extension will be unchanged by this process. +% % Files that should always be excluded from the archive are matched against the \var{excludefiles} variable; by default this is \luavar{excludefiles}, which match Emacs' autosave files. % % Binary files should be specified with the \var{binaryfiles} variable (default \luavar{binaryfiles}); these are added to the zip archive without normalising line endings (text files are automatically converted to Unix-style line endings). @@ -1054,6 +1060,18 @@ % takes either a date or raw epoch. When given, this will automatically % activate forcing of the epoch in both testing and typesetting. % +% \subsection{Settings in \texttt{texmf.cnf}} +% +% To allow application of non-standard \TeX{} trees or similar non-standard +% settings, \pkg{l3build} enables searching for a \texttt{texmf.cnf} file +% by setting the envirnmental variable \texttt{TEXMFCNF}. This might +% for example be used with a file containing +% \begin{verbatim} +% TEXMFAUXTREES = ../../texmf, +% \end{verbatim} +% for adding a local tree within the development repository (assuming the +% typical \pkg{l3build} layout). +% % \section{Alternative test formats} % % \subsection{Generating test files with \pkg{DocStrip}} diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 9d19e45ee11..6a33c69b9f0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|generic|package> -\def\ExplFileDate{2018-08-23}% +\def\ExplFileDate{2018-09-24}% % %<*driver> \documentclass[full]{l3doc} @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index f8926277432..a4f8d3facb6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 90f6d3c80ec..d6598c6ceda 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index de180429e47..fb1291e6aca 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -138,7 +138,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 552a2e93ed9..018145c609a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 43c19185279..f64f954a9f3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -1467,6 +1467,39 @@ % (as appropriate to the result of the test). % \end{function} % +% \begin{function}[added = 2018-09-23] +% { +% \peek_catcode_collect_inline:Nn, +% \peek_charcode_collect_inline:Nn, +% \peek_meaning_collect_inline:Nn +% } +% \begin{syntax} +% \cs{peek_catcode_collect_inline:Nn} \meta{test token} \Arg{inline code} +% \cs{peek_charcode_collect_inline:Nn} \meta{test token} \Arg{inline code} +% \cs{peek_meaning_collect_inline:Nn} \meta{test token} \Arg{inline code} +% \end{syntax} +% Collects and removes tokens from the input stream until finding a +% token that does not match the \meta{test token} (as defined by the +% test \cs{token_if_eq_catcode:NNTF} or \cs{token_if_eq_charcode:NNTF} +% or \cs{token_if_eq_meaning:NNTF}). The collected tokens are passed +% to the \meta{inline code} as~|#1|. When begin-group or end-group +% tokens (usually |{| or~|}|) are collected they are replaced by +% implicit \cs{c_group_begin_token} and \cs{c_group_end_token}, and +% when spaces (including \cs{c_space_token}) are collected they are +% replaced by explicit spaces. +% +% For example the following code prints ``Hello'' to the terminal and +% leave ``, world!'' in the input stream. +% \begin{verbatim} +% \peek_catcode_collect_inline:Nn A { \iow_term:n {#1} } Hello,~world! +% \end{verbatim} +% Another example is that the following code tests if the next token is |*|, ignoring intervening spaces, but putting them back using |#1| if there is no~|*|. +% \begin{verbatim} +% \peek_meaning_collect_inline:Nn \c_space_token +% { \peek_charcode:NTF * { star } { no~star #1 } } +% \end{verbatim} +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -1488,21 +1521,13 @@ % this will switch to horizontal mode and insert \tn{everypar} tokens and % nothing else. Unlike the \LaTeXe{} version, the availability of \eTeX{} % means using a mode test can be done at for example the start of an -% \tn{halign}. The \tn{quitvmode} primitive essentially wraps the same -% code up at the engine level. +% \tn{halign}. % \begin{macrocode} -\cs_new_protected:Npx \mode_leave_vertical: +\cs_new_protected:Npn \mode_leave_vertical: { - \cs_if_exist:NTF \tex_quitvmode:D - { \tex_quitvmode:D } - { - \exp_not:n - { - \if_mode_vertical: - \exp_after:wN \tex_indent:D - \fi: - } - } + \if_mode_vertical: + \exp_after:wN \tex_indent:D + \fi: } % \end{macrocode} % \end{macro} @@ -5229,6 +5254,86 @@ % \end{macro} % \end{macro} % +% \begin{variable}{\l_@@_collect_tl} +% \begin{macrocode} +\tl_new:N \l_@@_collect_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro} +% { +% \peek_catcode_collect_inline:Nn, +% \peek_charcode_collect_inline:Nn, +% \peek_meaning_collect_inline:Nn +% } +% \begin{macro} +% { +% \@@_collect:NNn, \@@_collect_true:w, +% \@@_collect_remove:nw, \@@_collect:N +% } +% Most of the work is done by \cs{@@_execute_branches_\ldots{}:}, +% which calls either \cs{@@_true:w} or \cs{@@_false:w} according to +% whether the next token \cs{l_peek_token} matches the search token +% (stored in \cs{l_@@_search_token} and \cs{l_@@_search_tl}). +% Here, in the \texttt{true} case we run \cs{@@_collect_true:w}, +% which generally calls \cs{@@_collect:N} to store the peeked token +% into \cs{l_@@_collect_tl}, except in special non-\texttt{N}-type +% cases (begin-group, end-group, or space), where a frozen token is +% stored. The \texttt{true} branch calls +% \cs{@@_execute_branches_\ldots{}:} to fetch more matching tokens. +% Once there are no more, \cs{@@_false_aux:n} closes the safe-align +% group and runs the user's inline code. +% \begin{macrocode} +\cs_new_protected:Npn \peek_catcode_collect_inline:Nn + { \@@_collect:NNn \@@_execute_branches_catcode: } +\cs_new_protected:Npn \peek_charcode_collect_inline:Nn + { \@@_collect:NNn \@@_execute_branches_charcode: } +\cs_new_protected:Npn \peek_meaning_collect_inline:Nn + { \@@_collect:NNn \@@_execute_branches_meaning: } +\cs_new_protected:Npn \@@_collect:NNn #1#2#3 + { + \group_align_safe_begin: + \cs_set_eq:NN \l_@@_search_token #2 + \tl_set:Nn \l_@@_search_tl {#2} + \tl_clear:N \l_@@_collect_tl + \cs_set:Npn \@@_false:w + { \exp_args:No \@@_false_aux:n \l_@@_collect_tl } + \cs_set:Npn \@@_false_aux:n ##1 + { + \group_align_safe_end: + #3 + } + \cs_set_eq:NN \@@_true:w \@@_collect_true:w + \cs_set:Npn \@@_true_aux:w { \peek_after:Nw #1 } + \@@_true_aux:w + } +\cs_new_protected:Npn \@@_collect_true:w + { + \if_case:w + \if_catcode:w \exp_not:N \l_peek_token { 1 \exp_stop_f: \fi: + \if_catcode:w \exp_not:N \l_peek_token } 2 \exp_stop_f: \fi: + \if_meaning:w \l_peek_token \c_space_token 3 \exp_stop_f: \fi: + 0 \exp_stop_f: + \exp_after:wN \@@_collect:N + \or: \@@_collect_remove:nw { \c_group_begin_token } + \or: \@@_collect_remove:nw { \c_group_end_token } + \or: \@@_collect_remove:nw { ~ } + \fi: + } +\cs_new_protected:Npn \@@_collect:N #1 + { + \tl_put_right:Nn \l_@@_collect_tl {#1} + \@@_true_aux:w + } +\cs_new_protected:Npn \@@_collect_remove:nw #1 + { + \tl_put_right:Nn \l_@@_collect_tl {#1} + \exp_after:wN \@@_true_remove:w + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 97ff75f1a17..fabaf99d76b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index fb396cf66e6..fcad722f870 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx b/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx index 9ac01cb070d..c448ec4fa3e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3color-base.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx index c8f6a5e5da7..60294abcc83 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index b1f0a63c060..9d3746ca2aa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -77,7 +77,7 @@ and all files in that bundle must be distributed together. % % \title{The \cls{l3doc} class} % \author{\Team} -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % \maketitle % \tableofcontents % @@ -281,6 +281,10 @@ and all files in that bundle must be distributed together. % \item |replace| is a boolean key (\texttt{true} by default) which % indicates whether to replace |@@| as \pkg{l3docstrip} does. % \end{itemize} +% These commands allow hyphenation of control sequences after (most) underscores. +% By default, a hyphen is used to mark the hyphenation, but this can be changed with +% the \texttt{cs-break-nohyphen} class option. +% To disable hyphenation of control sequencies entirely, use \texttt{cs-break-off}. % \end{function} % % @@ -687,6 +691,7 @@ and all files in that bundle must be distributed together. % \g_@@_lmodern_bool, % \g_@@_checkfunc_bool, % \g_@@_checktest_bool, +% \g_@@_cs_break_bool, % \g_@@_kernel_bool % } % Information about package options. @@ -695,6 +700,8 @@ and all files in that bundle must be distributed together. \bool_new:N \g_@@_checkfunc_bool \bool_new:N \g_@@_checktest_bool \bool_new:N \g_@@_kernel_bool +\bool_new:N \g_@@_cs_break_bool +\bool_gset_true:N \g_@@_cs_break_bool % \end{macrocode} % \end{variable} % @@ -1412,6 +1419,13 @@ and all files in that bundle must be distributed together. % \end{macrocode} % % \begin{macrocode} +\DeclareOption { cs-break-off } + { \bool_gset_false:N \g_@@_cs_break_bool } +\DeclareOption { cs-break-nohyphen } + { \PassOptionsToPackage{nohyphen}{underscore} } +% \end{macrocode} +% +% \begin{macrocode} \DeclareOption* { \PassOptionsToClass { \CurrentOption } { article } } \ExecuteOptions { full, kernel, nocheck, nochecktest, lm-default } \PassOptionsToClass { a4paper } { article } @@ -1460,9 +1474,9 @@ and all files in that bundle must be distributed together. pifont, textcomp, trace, - underscore, csquotes, fancyvrb, + underscore, verbatim } \raggedbottom @@ -1933,19 +1947,34 @@ and all files in that bundle must be distributed together. \@@_replace_at_at:N \l_@@_cmd_tl \tl_replace_all:Nno \l_@@_cmd_tl { _ } \l_@@_tmpb_tl } +% \end{macrocode} +% \paragraph{Typesetting} +% Note the replacement for the underscore is to permit linebreaks. +% The \texttt{underscore} package adds the linebreak, +% and the regex results in applying the breakable underscore only to the \emph{last} +% of a run of underscores, and not if the underscore follows a backslash. +% \begin{macrocode} \mode_if_math:T { \mbox } - { - \verbatim@font - \@@_if_almost_str:VT \l_@@_cmd_tl - { - \tl_set:Nx \l_@@_cmd_tl { \tl_to_str:N \l_@@_cmd_tl } - \tl_replace_all:Non \l_@@_cmd_tl - { \token_to_str:N _ } { \_ } - } - \tl_replace_all:Nnn \l_@@_cmd_tl { ~ } { \@xobeysp } - \l_@@_cmd_tl - \@ - } + { + \verbatim@font + \@@_if_almost_str:VT \l_@@_cmd_tl + { + \tl_set:Nx \l_@@_cmd_tl { \tl_to_str:N \l_@@_cmd_tl } + \bool_if:NT \g_@@_cs_break_bool + { + \regex_replace_all:nnN + {([^\\])_([^\_])} + {\1\c{BreakableUnderscore}\2} + \l_@@_cmd_tl + } + } + \tl_replace_all:Nnn \l_@@_cmd_tl { ~ } { \@xobeysp } + \l_@@_cmd_tl + \@ + } +% \end{macrocode} +% \paragraph{Indexing} +% \begin{macrocode} \bool_if:NF \l_@@_cmd_noindex_bool { \quark_if_no_value:NF \l_@@_cmd_index_tl diff --git a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx index 14eb116ba35..63988b271ac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3docstrip.dtx @@ -61,7 +61,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index d46578027d6..4a91ce531b4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -458,6 +458,79 @@ % given. % \end{function} % +% \section{PDF Features} +% +% A range of PDF features are exposed by \pdfTeX{} and \LuaTeX{} in direct PDF +% output mode, and the vast majority of these are also controllable using +% the \texttt{(x)dvipdfmx} driver (as DVI instructions are converted directly +% to PDF). Some of these functions are also available for cases where PDFs +% are generated by \texttt{dvips}: this depends on being able to pass +% information through correctly. +% +% \subsection{PDF Objects} +% +% Objects are used to provide a range of data structures in a PDF. At the +% driver level, different PDF object types are declared separately. Objects +% are only \emph{written} to the PDF when referenced. +% +% \begin{function}{\driver_pdf_object_new:nn} +% \begin{syntax} +% \cs{driver_pdf_object_new:n} \Arg{name} \Arg{type} +% \end{syntax} +% Declares \meta{name} as a PDF object. The \texttt{type} should be one of +% |array| or |dict|, |fstream| or |stream|. +% \end{function} +% +% \begin{function}[EXP]{\driver_pdf_object_ref:n} +% \begin{syntax} +% \cs{driver_pdf_object_ref:n} \Arg{object} +% \end{syntax} +% Inserts the appropriate information to reference the \meta{object} +% in for example page resource allocation. +% \end{function} +% +% \begin{function}{\driver_pdf_object_write:nn} +% \begin{syntax} +% \cs{driver_pdf_object_write:nn} \Arg{name} \Arg{data} +% \end{syntax} +% Writes the \meta{data} as content of the \meta{object}. Depending on the +% \meta{type} declared for the object, the format required for the +% \meta{data} will vary +% \begin{itemize} +% \item[\texttt{array}] A space-separated list of values +% \item[\texttt{dict}] Key--value pairs in the form +% \texttt{/\meta{key} \meta{value}} +% \item[\texttt{fstream}] Two brace groups: \meta{content} and +% \meta{file name} +% \item[\texttt{stream}] Two brace groups: \meta{content} and +% \meta{additional attributes} +% \end{itemize} +% \end{function} +% +% \subsection{PDF structure} +% +% \begin{function}{\driver_pdf_compresslevel:n} +% \begin{syntax} +% \cs{driver_pdf_compresslevel:n} \Arg{level} +% \end{syntax} +% Sets the degree of compression used for PDF files: the \meta{level} should +% be in the range $0$ to $9$ (higher is more compression). Typically, either +% compression is disables ($0$) or maximised ($9$). When used with +% \texttt{(x)dvipdfmx}, this setting may only be applied globally: it should +% be set only once. +% \end{function} +% +% \begin{function}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:} +% \begin{syntax} +% \cs{driver_pdf_objects_disable:} +% \end{syntax} +% Enables or disables the creation of PDF objects. These objects are used to +% reduce the size of PDFs, and typically are enabled as standard. When used +% with \texttt{(x)dvipdfmx}, object creation can be disabled but not +% re-enabled, and this setting may only be applied globally: it should +% be set only once. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -481,23 +554,23 @@ %<*package> \ProvidesExplFile %<*dvipdfmx> - {l3dvidpfmx.def}{2018-08-23}{} + {l3dvidpfmx.def}{2018-09-24}{} {L3 Experimental driver: dvipdfmx} % %<*dvips> - {l3dvips.def}{2018-08-23}{} + {l3dvips.def}{2018-09-24}{} {L3 Experimental driver: dvips} % %<*dvisvgm> - {l3dvisvgm.def}{2018-08-23}{} + {l3dvisvgm.def}{2018-09-24}{} {L3 Experimental driver: dvisvgm} % %<*pdfmode> - {l3pdfmode.def}{2018-08-23}{} + {l3pdfmode.def}{2018-09-24}{} {L3 Experimental driver: PDF mode} % %<*xdvipdfmx> - {l3xdvidpfmx.def}{2018-08-23}{} + {l3xdvidpfmx.def}{2018-09-24}{} {L3 Experimental driver: xdvipdfmx} % % @@ -605,7 +678,7 @@ { rgb~ \fp_eval:n {#1} ~ \fp_eval:n {#2} ~ \fp_eval:n {#3} } } \cs_new_protected:Npn \driver_color_spot:nn #1#2 - { \@@_color_select:n { \c_space_tl #1 } } + { \@@_color_select:n { #1 } } \cs_new_protected:Npn \@@_color_select:n #1 { \@@_literal:n { color~push~ #1 } @@ -904,7 +977,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Images} +% \subsubsection{Images} % % \begin{macro}{\@@_image_getbb_eps:n} % Simply use the generic function. @@ -922,7 +995,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Drawing} +% \subsubsection{Drawing} % % \begin{macro}{\@@_draw_literal:n, \@@_draw_literal:x} % The same as literal PostScript: same arguments about positioning apply @@ -1322,6 +1395,113 @@ % \end{macrocode} % \end{macro} % +% \subsubsection{PDF Features} +% +% \begin{variable}{\g_@@_pdf_object_int, \g_@@_pdf_object_prop} +% For tracking objects to allow finalisation. +% \begin{macrocode} +\int_new:N \g_@@_pdf_object_int +\prop_new:N \g_@@_pdf_object_prop +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\driver_pdf_object_new:nn} +% \begin{macro}[EXP]{\driver_pdf_object_ref:n} +% Tracking objects is similar to \texttt{dvipdfmx}. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_object_new:nn #1#2 + { + \int_gincr:N \g_@@_pdf_object_int + \int_const:cn + { g_@@_pdf_object_ \tl_to_str:n {#1} _int } + { \g_@@_pdf_object_int } + \prop_gput:Nnn \g_@@_pdf_object_prop {#1} {#2} + } +\cs_new:Npn \driver_pdf_object_ref:n #1 + { { l3obj \int_use:c { g_@@_pdf_object_ \tl_to_str:n {#1} _int } } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\driver_pdf_object_write:nn} +% \begin{macro} +% { +% \@@_pdf_object_write_array:nn , +% \@@_pdf_object_write_dict:nn , +% \@@_pdf_object_write_stream:nn +% } +% \begin{macro}{\@@_pdf_object_write_stream:nnn} +% This is where we choose the actual type: some work to get things +% right. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_object_write:nn #1#2 + { + \@@_literal_postscript:x + { + mark ~ /_objdef ~ \driver_pdf_object_ref:n {#1} ~ + /type + \str_case_e:nn + { \prop_item:Nn \g_@@_pdf_object_prop {#1} } + { + { array } { /array } + { dict } { /dict } + { fstream } { /stream } + { stream } { /stream } + } + /OBJ ~ pdfmark + } + \use:c + { @@_pdf_object_write_ \prop_item:Nn \g_@@_pdf_object_prop {#1} :nn } + {#1} {#2} + } +\cs_new_protected:Npn \@@_pdf_object_write_array:nn #1#2 + { + \@@_literal_postscript:x + { + mark ~ \driver_pdf_object_ref:n {#1} ~ + [ ~ \exp_not:n {#2} ~ ] ~ /PUTINTERVAL ~ pdfmark + } + } +\cs_new_protected:Npn \@@_pdf_object_write_dict:nn #1#2 + { + \@@_literal_postscript:x + { + mark ~ \driver_pdf_object_ref:n {#1} ~ + << ~ \exp_not:n {#2} ~ >> ~ /PUT ~ pdfmark + } + } +\cs_new_protected:Npn \@@_pdf_object_write_stream:nn #1#2 + { + \exp_args:Nx + \@@_pdf_object_write_stream:nnn + { \driver_pdf_object_ref:n {#1} } + #2 + } +\cs_new_protected:Npn \@@_pdf_object_write_stream:nnn #1#2#3 + { + \@@_literal_postscript:n + { + [nobreak] ~ + mark ~ #1 ~ ( #3 ) ~ /PUT ~ pdfmark ~ + mark ~ #1 ~ << #2 >> ~ /PUT ~ pdfmark + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\driver_pdf_compresslevel:n} +% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:} +% These are all no-ops. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_compresslevel:n #1 { } +\cs_new_protected:Npn \driver_pdf_objects_enable: { } +\cs_new_protected:Npn \driver_pdf_objects_disable: { } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} @@ -1483,7 +1663,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Images} +% \subsubsection{Images} % % \begin{variable}{\l_@@_image_attr_tl} % In PDF mode, additional attributes of an image (such as page number) are @@ -1594,6 +1774,117 @@ % \end{macrocode} % \end{macro} % +% \subsubsection{PDF Objects} +% +% \begin{variable}{\g_@@_pdf_object_prop} +% For tracking objects to allow finalisation. +% \begin{macrocode} +\prop_new:N \g_@@_pdf_object_prop +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\driver_pdf_object_new:nn} +% \begin{macro}[EXP]{\driver_pdf_object_ref:n} +% Declaring objects means reserving at the PDF level plus starting +% tracking. +% \begin{macrocode} +\group_begin: + \cs_set_protected:Npn \@@_tmp:w #1#2 + { + \cs_new_protected:Npx \driver_pdf_object_new:nn ##1##2 + { + #1 reserveobjnum ~ + \int_const:cn + { g_@@_pdf_object_ \exp_not:N \tl_to_str:n {##1} _int } + {#2} + \prop_gput:Nnn \exp_not:N \g_@@_pdf_object_prop {##1} {##2} + } + } + \cs_if_exist:NTF \tex_pdfextension:D + { + \@@_tmp:w + { \tex_pdfextension:D obj ~ } + { \tex_pdffeedback:D lastobj \scan_stop: } + } + { \@@_tmp:w { \tex_pdfobj:D } { \tex_pdflastobj:D } } +\group_end: +\cs_new:Npn \driver_pdf_object_ref:n #1 + { \int_use:c { g_@@_pdf_object_ \tl_to_str:n {#1} _int } ~ 0 ~ R } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\driver_pdf_object_write:nn} +% \begin{macro}[EXP]{\@@_exp_not_i:nn, \@@_exp_not_ii:nn} +% Writing the data needs a little information about the structure of the +% object. +% \begin{macrocode} +\group_begin: + \cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new_protected:Npn \driver_pdf_object_write:nn ##1##2 + { + \tex_immediate:D #1 useobjnum ~ + \int_use:c + { g_@@_pdf_object_ \tl_to_str:n {##1} _int } + \str_case_e:nn + { \prop_item:Nn \g_@@_pdf_object_prop {##1} } + { + { array } { { [ ~ \exp_not:n {##2} ~ ] } } + { dict } { { << ~ \exp_not:n {##2} ~ >> } } + { fstream } + { + stream ~ attr ~ { \@@_exp_not_i:nn ##2 } ~ + file ~ { \@@_exp_not_ii:nn ##2 } + } + { stream } + { + stream ~ attr ~ { \@@_exp_not_i:nn ##2 } ~ + { \@@_exp_not_ii:nn ##2 } + } + } + } + } + \cs_if_exist:NTF \tex_pdfextension:D + { \@@_tmp:w { \tex_pdfextension:D obj ~ } } + { \@@_tmp:w { \tex_pdfobj:D } } +\group_end: +\cs_new:Npn \@@_exp_not_i:nn #1#2 { \exp_not:n {#1} } +\cs_new:Npn \@@_exp_not_ii:nn #1#2 { \exp_not:n {#2} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{PDF Structure} +% +% \begin{macro}{\driver_pdf_compresslevel:n} +% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:} +% \begin{macro}{\@@_pdf_objectlevel:n} +% Simply pass data to the engine. +% \begin{macrocode} +\cs_new_protected:Npx \driver_pdf_compresslevel:n #1 + { + \cs_if_exist:NTF \tex_pdfcompresslevel:D + { \tex_pdfcompresslevel:D } + { \tex_pdfvariable:D compresslevel } + \exp_not:N \int_value:w \exp_not:N \int_eval:n {#1} \scan_stop: + } +\cs_new_protected:Npn \driver_pdf_objects_enable: + { \@@_pdf_objectlevel:n { 2 } } +\cs_new_protected:Npn \driver_pdf_objects_disable: + { \@@_pdf_objectlevel:n { 0 } } +\cs_new_protected:Npx \@@_pdf_objectlevel:n #1 + { + \cs_if_exist:NTF \tex_pdfobjcompresslevel:D + { \tex_pdfobjcompresslevel:D } + { \tex_pdfvariable:D objcompresslevel } + #1 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} @@ -1704,7 +1995,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Images} +% \subsubsection{Images} % % \begin{macro} % { @@ -1840,6 +2131,104 @@ % \end{macro} % \end{macro} % +% \subsubsection{PDF Objects} +% +% \begin{variable}{\g_@@_pdf_object_int, \g_@@_pdf_object_prop} +% For tracking objects to allow finalisation. +% \begin{macrocode} +\int_new:N \g_@@_pdf_object_int +\prop_new:N \g_@@_pdf_object_prop +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\driver_pdf_object_new:nn} +% \begin{macro}[EXP]{\driver_pdf_object_ref:n} +% Objects are tracked at the macro level, but we don't have to do anything +% at this stage. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_object_new:nn #1#2 + { + \int_gincr:N \g_@@_pdf_object_int + \int_const:cn + { g_@@_pdf_object_ \tl_to_str:n {#1} _int } + { \g_@@_pdf_object_int } + \prop_gput:Nnn \g_@@_pdf_object_prop {#1} {#2} + } +\cs_new:Npn \driver_pdf_object_ref:n #1 + { @l3obj \int_use:c { g_@@_pdf_object_ \tl_to_str:n {#1} _int } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\driver_pdf_object_write:nn} +% \begin{macro}{\@@_pdf_object_write:nnn} +% \begin{macro} +% { +% \@@_pdf_object_write_array:nn , +% \@@_pdf_object_write_dict:nn , +% \@@_pdf_object_write_fstream:nn , +% \@@_pdf_object_write_stream:nn +% } +% \begin{macro}{\@@_pdf_object_write_stream:nnnn} +% This is where we choose the actual type. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_object_write:nn #1#2 + { + \exp_args:Nx \@@_pdf_object_write:nnn + { \prop_item:Nn \g_@@_pdf_object_prop {#1} } {#1} {#2} + } +\cs_new_protected:Npn \@@_pdf_object_write:nnn #1#2#3 + { \use:c { @@_pdf_object_write_ #1 :nn } {#2} {#3} } +\cs_new_protected:Npn \@@_pdf_object_write_array:nn #1#2 + { + \@@_literal:x + { + pdf:obj ~ \driver_pdf_object_ref:n {#1} ~ + [ ~ \exp_not:n {#2} ~ ] + } + } +\cs_new_protected:Npn \@@_pdf_object_write_dict:nn #1#2 + { + \@@_literal:x + { + pdf:obj ~ \driver_pdf_object_ref:n {#1} ~ + << ~ \exp_not:n {#2} ~ >> + } + } +\cs_new_protected:Npn \@@_pdf_object_write_fstream:nn #1#2 + { \@@_pdf_object_write_stream:nnnn { f } {#1} #2 } +\cs_new_protected:Npn \@@_pdf_object_write_stream:nn #1#2 + { \@@_pdf_object_write_stream:nnnn { } {#1} #2 } +\cs_new_protected:Npn \@@_pdf_object_write_stream:nnnn #1#2#3#4 + { + \@@_literal:x + { + pdf: #1 stream ~ \driver_pdf_object_ref:n {#2} ~ + ( \exp_not:n {#4} ) ~ << \exp_not:n {#3} >> + + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{PDF Structure} +% +% \begin{macro}{\driver_pdf_compresslevel:n} +% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:} +% Pass data to the driver: these are a one-shot. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_compresslevel:n #1 + { \@@_literal:x { dvipdfmx:config~z~ \int_eval:n {#1} } } +\cs_new_protected:Npn \driver_pdf_objects_enable: { } +\cs_new_protected:Npn \driver_pdf_objects_disable: + { \@@_literal:n { dvipdfmx:config~C~0x40 } } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} @@ -1850,7 +2239,7 @@ %<*xdvipdfmx> % \end{macrocode} % -% \subsection{Images} +% \subsubsection{Images} % % \begin{macro} % {\@@_image_getbb_jpg:n, \@@_image_getbb_pdf:n, \@@_image_getbb_png:n} @@ -1955,7 +2344,7 @@ %<*dvipdfmx|pdfmode|xdvipdfmx> % \end{macrocode} % -% \subsection{Drawing} +% \subsubsection{Drawing} % % \begin{macro}{\@@_draw_literal:n, \@@_draw_literal:x} % Pass data through using a dedicated interface. @@ -2416,7 +2805,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Driver-specific auxiliaries} +% \subsubsection{Driver-specific auxiliaries} % % \begin{macro}{\@@_scope_begin:n, \@@_scope_begin:x} % In SVG transformations, clips and so on are attached directly to scopes so @@ -2556,7 +2945,7 @@ % \end{macrocode} % \end{macro} % -% \subsection{Images} +% \subsubsection{Images} % % \begin{macro}{\@@_image_getbb_png:n, \@@_image_getbb_jpg:n} % These can be included by extracting the bounding box data. @@ -2592,7 +2981,29 @@ % \end{macro} % \end{macro} % -% \subsection{Drawing} +% \subsubsection{PDF Features} +% +% \begin{macro}{\driver_pdf_object_new:n} +% \begin{macro}[EXP]{\driver_pdf_object_ref:n} +% \begin{macro}{\driver_pdf_ojbect_write:nn} +% \begin{macro}{\driver_pdf_compresslevel:n} +% \begin{macro}{\driver_pdf_objects_enable:, \driver_pdf_objects_disable:} +% These are all no-ops. +% \begin{macrocode} +\cs_new_protected:Npn \driver_pdf_object_new:n #1 { } +\cs_new:Npn \driver_pdf_object_ref:n #1 { } +\cs_new_protected:Npn \driver_pdf_object_write:nn #1#2 { } +\cs_new_protected:Npn \driver_pdf_compresslevel:n #1 { } +\cs_new_protected:Npn \driver_pdf_objects_enable: { } +\cs_new_protected:Npn \driver_pdf_objects_disable: { } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \subsubsection{Drawing} % % \begin{macro}{\@@_draw_literal:n, \@@_draw_literal:x} % The same as the more general literal call. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 4a4224b5936..ee757060b76 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index ecacb84a841..f623ae098d5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -667,6 +667,13 @@ % % \subsubsection{Variables and constants} % +% \begin{variable}{\l_@@_internal_tl} +% Used as a short-term scratch variable. +% \begin{macrocode} +\tl_new:N \l_@@_internal_tl +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\c_term_ior} % Reading from the terminal (with a prompt) is done using a positive % but non-existent stream number. Unlike writing, there is no concept @@ -955,7 +962,6 @@ % \begin{macro}{\@@_map_inline:NNn} % \begin{macro}{\@@_map_inline:NNNn} % \begin{macro}{\@@_map_inline_loop:NNN} -% \begin{variable}{\l_@@_internal_tl} % Mapping to an input stream can be done on either a token or a string % basis, hence the set up. Within that, there is a check to avoid reading % past the end of a file, hence the two applications of \cs{ior_if_eof:N}. @@ -988,9 +994,7 @@ \@@_map_inline_loop:NNN #1#2#3 } } -\tl_new:N \l_@@_internal_tl % \end{macrocode} -% \end{variable} % \end{macro} % \end{macro} % \end{macro} @@ -1865,6 +1869,13 @@ % % \subsection{File operations} % +% \begin{variable}{\l_@@_internal_tl} +% Used as a short-term scratch variable. +% \begin{macrocode} +\tl_new:N \l_@@_internal_tl +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\g_@@_internal_ior} % A reserved stream to test for file existence. % \begin{macrocode} @@ -1952,13 +1963,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_tmp_tl} -% Used as a short-term scratch variable. -% \begin{macrocode} -\tl_new:N \l_@@_tmp_tl -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\l_@@_base_name_str, \l_@@_full_name_str} % For storing the basename and full path whilst passing data internally. % \begin{macrocode} @@ -2007,14 +2011,14 @@ \group_begin: \seq_map_inline:Nn \l_char_active_seq { - \tl_set:Nx \l_@@_tmp_tl { \iow_char:N ##1 } - \char_set_active_eq:NN ##1 \l_@@_tmp_tl + \tl_set:Nx \l_@@_internal_tl { \iow_char:N ##1 } + \char_set_active_eq:NN ##1 \l_@@_internal_tl } - \tl_set:Nx \l_@@_tmp_tl {#1} - \tl_set:Nx \l_@@_tmp_tl - { \tl_to_str:N \l_@@_tmp_tl } + \tl_set:Nx \l_@@_internal_tl {#1} + \tl_set:Nx \l_@@_internal_tl + { \tl_to_str:N \l_@@_internal_tl } \exp_args:NNNV \group_end: - \str_set:Nn #2 \l_@@_tmp_tl + \str_set:Nn #2 \l_@@_internal_tl } \cs_new_protected:Npn \@@_name_quote:nN #1#2 { @@ -2174,8 +2178,8 @@ % \cs_new_protected:Npn \@@_input_pop: { - \seq_gpop:NN \g_@@_stack_seq \l_@@_tmp_tl - \exp_after:wN \@@_input_pop:nnn \l_@@_tmp_tl + \seq_gpop:NN \g_@@_stack_seq \l_@@_internal_tl + \exp_after:wN \@@_input_pop:nnn \l_@@_internal_tl } %<*package> \cs_new_eq:NN \__kernel_file_input_pop: \__file_input_pop: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx index bf5c5d7e3b5..1dc099c4fc8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3final.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3final.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx index 5caf1ad0be1..a2d98c2196b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index 9e98ff8f43e..0bf13a954a2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index 0e17a7ddb4d..0b1f14d14d3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index fed862dc2f2..87736c6204d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index c473ab1b110..08788057eff 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index dddaebe50e9..b38077a3b9f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 99bfe1d1ae7..e25f7126ee6 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index ffc7edf283b..120ddd88c41 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index c56d92ea761..dbffd2bd274 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index 3526519ddc4..bb7e103f25d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 9eed28891c5..67b5329003b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index c01862ddec1..2225981d426 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % \maketitle % % \begin{documentation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index 373d0b111e7..72b4443b241 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -38,7 +38,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 33ac720b455..2f467b82aa3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -47,7 +47,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx index 76b4668c239..3d5db336b31 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fparray.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 29b930a6340..cd2321eec95 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -550,7 +550,7 @@ % \end{function} % % \begin{function}[added = 2012-06-04, updated = 2018-04-22] -% {\int_step_variable:nnn, \int_step_variable:nnnn, \int_step_variable:nnnnn} +% {\int_step_variable:nNn, \int_step_variable:nnNn, \int_step_variable:nnnNn} % \begin{syntax} % \cs{int_step_variable:nNn} \Arg{final value} \meta{tl~var} \Arg{code} % \cs{int_step_variable:nnNn} \Arg{initial value} \Arg{final value} \meta{tl~var} \Arg{code} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx index 7739ddd76d3..6f56abc96c7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3intarray.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx index ef418edc446..f0b267e7249 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3kernel-functions.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index da03797c65d..7195061bfcc 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -238,9 +238,7 @@ % \end{syntax} % Stores the \meta{code} for execution when \meta{key} is used. % The \meta{code} can include one parameter (|#1|), which will be the -% \meta{value} given for the \meta{key}. The \texttt{x}-type variant -% expands \meta{code} at the point where the \meta{key} is -% created. +% \meta{value} given for the \meta{key}. % \end{function} % % \begin{function}[updated = 2013-07-09] @@ -2300,7 +2298,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_execute:, \@@_execute_unknown:} +% \begin{macro}{\@@_execute:, \@@_execute_inherit:, \@@_execute_unknown:} % \begin{macro}[EXP]{\@@_execute:nn} % \begin{macro}{\@@_store_unused:} % Actually executing a key is done in two parts. First, look for the @@ -2317,42 +2315,50 @@ \cs:w \c_@@_code_root_tl \l_keys_path_tl \exp_after:wN \cs_end: \exp_after:wN { \l_keys_value_tl } } - { \@@_execute_unknown: } - } -\cs_new_protected:Npn \@@_execute_unknown: - { - \bool_if:NTF \l_@@_only_known_bool - { \@@_store_unused: } { - \cs_if_exist:cTF - { \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl } + \bool_if:NTF \l_@@_only_known_bool + { \@@_store_unused: } { - \clist_map_inline:cn + \cs_if_exist:cTF { \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl } - { - \cs_if_exist:cT - { \c_@@_code_root_tl ##1 / \l_keys_key_tl } - { - \cs:w \c_@@_code_root_tl ##1 / \l_keys_key_tl - \exp_after:wN \cs_end: \exp_after:wN - { \l_keys_value_tl } - \clist_map_break: - } - } + { \@@_execute_inherit: } + { \@@_execute_unknown: } } + } + } +% \end{macrocode} +% To deal with the case where there is no hit, we leave +% \cs{@@_execute_unknown:} in the input stream and clean it up using the +% break function: that avoids needing a boolean. +% \begin{macrocode} +\cs_new_protected:Npn \@@_execute_inherit: + { + \clist_map_inline:cn + { \c_@@_inherit_root_tl \@@_parent:o \l_keys_path_tl } + { + \cs_if_exist:cT + { \c_@@_code_root_tl ##1 / \l_keys_key_tl } { - \cs_if_exist:cTF - { \c_@@_code_root_tl \l_@@_module_tl / unknown } - { - \cs:w \c_@@_code_root_tl \l_@@_module_tl / unknown - \exp_after:wN \cs_end: \exp_after:wN { \l_keys_value_tl } - } - { - \__kernel_msg_error:nnxx { kernel } { key-unknown } - { \l_keys_path_tl } { \l_@@_module_tl } - } + \cs:w \c_@@_code_root_tl ##1 / \l_keys_key_tl + \exp_after:wN \cs_end: \exp_after:wN + { \l_keys_value_tl } + \clist_map_break:n { \use_none:n } } - } + } + \@@_execute_unknown: + } +\cs_new_protected:Npn \@@_execute_unknown: + { + \cs_if_exist:cTF + { \c_@@_code_root_tl \l_@@_module_tl / unknown } + { + \cs:w \c_@@_code_root_tl \l_@@_module_tl / unknown + \exp_after:wN \cs_end: \exp_after:wN { \l_keys_value_tl } + } + { + \__kernel_msg_error:nnxx { kernel } { key-unknown } + { \l_keys_path_tl } { \l_@@_module_tl } + } } \cs_new:Npn \@@_execute:nn #1#2 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index ca9935e58cc..5c5e0bc3c29 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index bd180cd0af9..f4351fbf64e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 52374a5935e..8f43cdc6c62 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -774,6 +774,10 @@ \@@_primitive:NN \automatichyphenpenalty \tex_automatichyphenpenalty:D \@@_primitive:NN \begincsname \tex_begincsname:D + \@@_primitive:NN \bodydir \tex_bodydir:D + \@@_primitive:NN \bodydirection \tex_bodydirection:D + \@@_primitive:NN \boxdir \tex_boxdir:D + \@@_primitive:NN \boxdirection \tex_boxdirection:D \@@_primitive:NN \breakafterdirmode \tex_breakafterdirmode:D \@@_primitive:NN \catcodetable \tex_catcodetable:D \@@_primitive:NN \clearmarks \tex_clearmarks:D @@ -782,12 +786,14 @@ \tex_crampedscriptscriptstyle:D \@@_primitive:NN \crampedscriptstyle \tex_crampedscriptstyle:D \@@_primitive:NN \crampedtextstyle \tex_crampedtextstyle:D + \@@_primitive:NN \csstring \tex_csstring:D \@@_primitive:NN \directlua \tex_directlua:D \@@_primitive:NN \dviextension \tex_dviextension:D \@@_primitive:NN \dvifeedback \tex_dvifeedback:D \@@_primitive:NN \dvivariable \tex_dvivariable:D \@@_primitive:NN \etoksapp \tex_etoksapp:D \@@_primitive:NN \etokspre \tex_etokspre:D + \@@_primitive:NN \exceptionpenalty \tex_exceptionpenalty:D \@@_primitive:NN \explicithyphenpenalty \tex_explicithyphenpenalty:D \@@_primitive:NN \expanded \tex_expanded:D \@@_primitive:NN \explicitdiscretionary \tex_explicitdiscretionary:D @@ -800,16 +806,34 @@ \@@_primitive:NN \hyphenationmin \tex_hyphenationmin:D \@@_primitive:NN \hyphenpenaltymode \tex_hyphenpenaltymode:D \@@_primitive:NN \gleaders \tex_gleaders:D + \@@_primitive:NN \ifcondition \tex_ifcondition:D + \@@_primitive:NN \immediateassigned \tex_immediateassigned:D + \@@_primitive:NN \immediateassignment \tex_immediateassignment:D \@@_primitive:NN \initcatcodetable \tex_initcatcodetable:D \@@_primitive:NN \lastnamedcs \tex_lastnamedcs:D \@@_primitive:NN \latelua \tex_latelua:D + \@@_primitive:NN \lateluafunction \tex_lateluafunction:D + \@@_primitive:NN \leftghost \tex_leftghost:D \@@_primitive:NN \letcharcode \tex_letcharcode:D + \@@_primitive:NN \linedir \tex_linedir:D + \@@_primitive:NN \linedirection \tex_linedirection:D + \@@_primitive:NN \localbrokenpenalty \tex_localbrokenpenalty:D + \@@_primitive:NN \localinterlinepenalty \tex_localinterlinepenalty:D + \@@_primitive:NN \luabytecode \tex_luabytecode:D + \@@_primitive:NN \luabytecodecall \tex_luabytecodecall:D + \@@_primitive:NN \luacopyinputnodes \tex_luacopyinputnodes:D + \@@_primitive:NN \luadef \tex_luadef:D + \@@_primitive:NN \localleftbox \tex_localleftbox:D + \@@_primitive:NN \localrightbox \tex_localrightbox:D \@@_primitive:NN \luaescapestring \tex_luaescapestring:D \@@_primitive:NN \luafunction \tex_luafunction:D + \@@_primitive:NN \luafunctioncall \tex_luafunctioncall:D \@@_primitive:NN \luatexbanner \tex_luatexbanner:D \@@_primitive:NN \luatexrevision \tex_luatexrevision:D \@@_primitive:NN \luatexversion \tex_luatexversion:D \@@_primitive:NN \mathdelimitersmode \tex_mathdelimitersmode:D + \@@_primitive:NN \mathdir \tex_mathdir:D + \@@_primitive:NN \mathdirection \tex_mathdirection:D \@@_primitive:NN \mathdisplayskipmode \tex_mathdisplayskipmode:D \@@_primitive:NN \matheqnogapstep \tex_matheqnogapstep:D \@@_primitive:NN \mathnolimitsmode \tex_mathnolimitsmode:D @@ -818,6 +842,7 @@ \@@_primitive:NN \mathrulesfam \tex_mathrulesfam:D \@@_primitive:NN \mathscriptsmode \tex_mathscriptsmode:D \@@_primitive:NN \mathscriptboxmode \tex_mathscriptboxmode:D + \@@_primitive:NN \mathscriptcharmode \tex_mathscriptcharmode:D \@@_primitive:NN \mathstyle \tex_mathstyle:D \@@_primitive:NN \mathsurroundmode \tex_mathsurroundmode:D \@@_primitive:NN \mathsurroundskip \tex_mathsurroundskip:D @@ -828,9 +853,13 @@ \@@_primitive:NN \novrule \tex_novrule:D \@@_primitive:NN \outputbox \tex_outputbox:D \@@_primitive:NN \pagebottomoffset \tex_pagebottomoffset:D + \@@_primitive:NN \pagedir \tex_pagedir:D + \@@_primitive:NN \pagedirection \tex_pagedirection:D \@@_primitive:NN \pageleftoffset \tex_pageleftoffset:D \@@_primitive:NN \pagerightoffset \tex_pagerightoffset:D \@@_primitive:NN \pagetopoffset \tex_pagetopoffset:D + \@@_primitive:NN \pardir \tex_pardir:D + \@@_primitive:NN \pardirection \tex_pardirection:D \@@_primitive:NN \pdfextension \tex_pdfextension:D \@@_primitive:NN \pdffeedback \tex_pdffeedback:D \@@_primitive:NN \pdfvariable \tex_pdfvariable:D @@ -841,6 +870,7 @@ \@@_primitive:NN \preexhyphenchar \tex_preexhyphenchar:D \@@_primitive:NN \prehyphenchar \tex_prehyphenchar:D \@@_primitive:NN \prerelpenalty \tex_prerelpenalty:D + \@@_primitive:NN \rightghost \tex_rightghost:D \@@_primitive:NN \savecatcodetable \tex_savecatcodetable:D \@@_primitive:NN \scantextokens \tex_scantextokens:D \@@_primitive:NN \setfontid \tex_setfontid:D @@ -851,28 +881,13 @@ \@@_primitive:NN \suppressoutererror \tex_suppressoutererror:D \@@_primitive:NN \suppressprimitiveerror \tex_suppressprimitiveerror:D + \@@_primitive:NN \textdir \tex_textdir:D + \@@_primitive:NN \textdirection \tex_textdirection:D \@@_primitive:NN \toksapp \tex_toksapp:D \@@_primitive:NN \tokspre \tex_tokspre:D \@@_primitive:NN \tpack \tex_tpack:D \@@_primitive:NN \vpack \tex_vpack:D % \end{macrocode} -% These come from Omega/Aleph, but we do not support those engines and -% so list them here. -% \begin{macrocode} - \@@_primitive:NN \bodydir \tex_bodydir:D - \@@_primitive:NN \boxdir \tex_boxdir:D - \@@_primitive:NN \leftghost \tex_leftghost:D - \@@_primitive:NN \linedir \tex_linedir:D - \@@_primitive:NN \localbrokenpenalty \tex_localbrokenpenalty:D - \@@_primitive:NN \localinterlinepenalty \tex_localinterlinepenalty:D - \@@_primitive:NN \localleftbox \tex_localleftbox:D - \@@_primitive:NN \localrightbox \tex_localrightbox:D - \@@_primitive:NN \mathdir \tex_mathdir:D - \@@_primitive:NN \pagedir \tex_pagedir:D - \@@_primitive:NN \pardir \tex_pardir:D - \@@_primitive:NN \rightghost \tex_rightghost:D - \@@_primitive:NN \textdir \tex_textdir:D -% \end{macrocode} % Primitives from \pdfTeX{} that \LuaTeX{} renames. % \begin{macrocode} \@@_primitive:NN \adjustspacing \tex_adjustspacing:D diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index eb1be68f173..4f0c27f31c0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -42,7 +42,7 @@ % } % % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index e936df28377..b00c6160f26 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index 191c9e70157..4fad81c25c4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index e649702601a..cde1625bb7b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx index d4eb2c4066c..66ed9ae168d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3regex.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -114,23 +114,23 @@ % |\_.*?\_| where |.| matches arbitrary characters and the % lazy quantifier |*?| means to match as few characters as % possible, thus avoiding matching underscores. -% \item |[+-]?\d+| matches an explicit integer with at most one +% \item |[\+\-]?\d+| matches an explicit integer with at most one % sign. -% \item \verb*"[+\-\ ]*\d+\ *" matches an explicit integer with any +% \item \verb*"[\+\-\ ]*\d+\ *" matches an explicit integer with any % number of $+$ and $-$ signs, with spaces allowed except within the % mantissa, and surrounded by spaces. -% \item \verb*"[+\-\ ]*(\d+|\d*\.\d+)\ *" matches an explicit integer or +% \item \verb*"[\+\-\ ]*(\d+|\d*\.\d+)\ *" matches an explicit integer or % decimal number; using \verb*"[.,]" instead of \verb*"\." would allow % the comma as a decimal marker. % \item -% \verb*"[+\-\ ]*(\d+|\d*\.\d+)\ *((?i)pt|in|[cem]m|ex|[bs]p|[dn]d|[pcn]c)\ *" +% \verb*"[\+\-\ ]*(\d+|\d*\.\d+)\ *((?i)pt|in|[cem]m|ex|[bs]p|[dn]d|[pcn]c)\ *" % \allowbreak matches an explicit dimension with any unit that \TeX{} knows, where % \verb*"(?i)" means to treat lowercase and uppercase letters % identically. -% \item \verb*"[+\-\ ]*((?i)nan|inf|(\d+|\d*\.\d+)(\ *e[+-\ ]*\d+)?)\ *" +% \item \verb*"[\+\-\ ]*((?i)nan|inf|(\d+|\d*\.\d+)(\ *e[\+\-\ ]*\d+)?)\ *" % matches an explicit floating point number or the special values % \verb*"nan" and \verb*"inf" (with signs and spaces allowed). -% \item \verb*"[+\-\ ]*(\d+|\cC.)\ *" matches an explicit integer or +% \item \verb*"[\+\-\ ]*(\d+|\cC.)\ *" matches an explicit integer or % control sequence (without checking whether it is an integer % variable). % \item |\G.*?\K| at the beginning of a regular expression matches and @@ -141,7 +141,7 @@ % \cs{regex_extract_all:nnN}. % \end{itemize} % While it is impossible for a regular expression to match only integer -% expressions, \verb*"[+\-\(]*\d+\)*([+\-*/][+\-\(]*\d+\)*)*" matches among +% expressions, \verb*"[\+\-\(]*\d+\)*([\+\-*/][\+\-\(]*\d+\)*)*" matches among % other things all valid integer expressions (made only with explicit % integers). One should follow it with further testing. % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 5e590bd0c2d..b42a1bef8a2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 182427cb48a..5b129855e33 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index b1f2b7eabe5..a38e58b54c2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index af918d1d164..acb496f5c34 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index a1d10f187c2..69a486f90fe 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx index 2b8048e6dc2..095b7cf25f4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl-analysis.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index fcd5084c318..3288659f861 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 3188f7709d9..b5ed9de6bf9 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx index e154f1850ee..7d7b33f10aa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3unicode.dtx @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 16702af9e43..9df257daa7e 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -60,7 +60,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -131,7 +131,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{l3keys2e}{2018-08-23}{} +\ProvidesExplPackage{l3keys2e}{2018-09-24}{} {LaTeX2e option processing using LaTeX3 keys} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx index 9491f672954..32b7edaa0fd 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx @@ -62,7 +62,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -161,7 +161,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfp}{2018-08-23}{} +\ProvidesExplPackage{xfp}{2018-09-24}{} {L3 Floating point unit} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index 2a1c9de876f..578c69b07c0 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -533,7 +533,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xfrac}{2018-08-23}{} +\ProvidesExplPackage{xfrac}{2018-09-24}{} {L3 Experimental split-level fractions} % \end{macrocode} % diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index c9685d264d5..1e24d659fe7 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -67,7 +67,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -818,7 +818,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xparse}{2018-08-23}{} +\ProvidesExplPackage{xparse}{2018-09-24}{} {L3 Experimental document command parser} % \end{macrocode} % @@ -953,6 +953,13 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_obey_spaces_bool} +% For trailing optionals. +% \begin{macrocode} +\bool_new:N \l_@@_obey_spaces_bool +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_@@_last_delimiters_tl} % Holds the delimiters (first tokens) of all optional arguments since % the previous mandatory argument, to warn about cases where it would @@ -971,13 +978,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_ignore_spaces_bool} -% For trailing optionals. -% \begin{macrocode} -\bool_new:N \l_@@_ignore_spaces_bool -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\l_@@_m_args_int} % The number of \texttt{m} arguments: if this is the same as the total % number of arguments, then a short-cut can be taken in the creation of @@ -1028,15 +1028,20 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_some_long_bool, \l_@@_some_short_bool} -% Both of these flags are set while normalizing the argument -% specification. To grab arguments expandably, all short arguments -% must appear before long arguments, so as soon as the first long -% argument is seen (other than \texttt{t}-type, whose long status is -% ignored) the \texttt{some_long} flag is set. The -% \texttt{some_short} flag is used for expandable commands, to know -% whether to define a short auxiliary too. -% \begin{macrocode} +% \begin{variable} +% {\l_@@_some_obey_spaces_bool, \l_@@_some_long_bool, \l_@@_some_short_bool} +% These flags are set while normalizing the argument specification. +% The \texttt{obey_spaces} one is used to detect when |!| is used on +% an argument that is not a trailing optional argument. +% The other two are used to check whether all short arguments appear +% before long arguments: this is needed to grab arguments expandably. +% As soon as the first long argument is seen (other than +% \texttt{t}-type, whose long status is ignored) the +% \texttt{some_long} flag is set. The \texttt{some_short} flag is +% used for expandable commands, to know whether to define a short +% auxiliary too. +% \begin{macrocode} +\bool_new:N \l_@@_some_obey_spaces_bool \bool_new:N \l_@@_some_long_bool \bool_new:N \l_@@_some_short_bool % \end{macrocode} @@ -1521,50 +1526,49 @@ % specification is valid before the main parsing run. If it is not % valid the entire set up is abandoned to avoid any strange internal % errors. A function is provided for each argument type that will grab -% any extra arguments and call the loop function. -% -% The first thing that is done in the loop is to check that the various -% argument types have the correct number of data items associated with -% them. The opportunity is also taken to make sure that where a single -% character is required, one has actually been supplied. -% -% The second is that processors and the marker~|+| for long arguments -% must be followed by arguments. -% -% The third is to check for forbidden types for expandable commands, -% namely \texttt{G}/\texttt{v} always, and \texttt{l}/\texttt{u} after -% optional arguments (\pkg{xparse} may have inserted braces due to a -% failed search for an optional argument). -% -% The fourth is that an optional argument should not be followed by a -% mandatory argument with the same delimiter, as otherwise the optional -% argument could never be omitted. -% -% The fifth is to keep track in \cs{l_@@_some_long_bool} and -% \cs{l_@@_some_short_bool} of whether the command has some long/short -% arguments. -% -% The sixth is to keep track in \cs{l_@@_grab_expandably_bool} of -% whether all arguments are \texttt{m}/\texttt{l}/\texttt{u} type and -% short arguments appear before long ones, in which case they can be -% grabbed expandably just as safely as they could be grabbed expandably. -% Regardless of that, arguments of expandable commands will be grabbed -% expandably and arguments of environments will not (because the list of -% arguments built by non-expandable grabbing is used to pass them to the -% end-environment code). -% -% The last is to count mandatory arguments, used later to detect which -% optional arguments are trailing. +% any extra data items and call the loop function after performing the +% following checks and tasks. +% \begin{itemize} +% \item Check that each argument has the correct number of data items +% associated with it, and that where a single character is required, +% one has actually been supplied. +% \item Check that processors and the markers~|+| and~|!| are followed +% by an argument for which they make sense, and are not redundant. +% \item Check the absence of forbidden types for expandable commands, +% namely \texttt{G}/\texttt{v} always, and \texttt{l}/\texttt{u} +% after optional arguments (\pkg{xparse} may have inserted braces +% due to a failed search for an optional argument). +% \item Check that no optional argument is followed by a mandatory +% argument with the same delimiter, as otherwise the optional +% argument could never be omitted. +% \item Keep track in \cs{l_@@_some_long_bool} and +% \cs{l_@@_some_short_bool} of whether the command has some +% long/short arguments. +% \item Keep track in \cs{l_@@_grab_expandably_bool} of whether all +% arguments are \texttt{m}/\texttt{l}/\texttt{u} type and short +% arguments appear before long ones, in which case they can be +% grabbed expandably just as safely as they could be grabbed +% nonexpandably. Regardless of that, arguments of expandable +% commands will be grabbed expandably and arguments of environments +% will not (because the list of arguments built by non-expandable +% grabbing is used to pass them to the end-environment code). +% \item Count mandatory arguments, used later to detect which optional +% arguments are trailing. +% \end{itemize} +% Further checks happen at the end of the loop: +% \begin{itemize} +% \item that there are at most $9$ arguments; +% \item that an expandable command does not end with an optional +% argument (this case is detected by using the fact that +% \cs{l_@@_last_delimiters_tl} is cleared by every mandatory argument +% and filled by every optional argument). +% \end{itemize} % % \begin{macro}{\@@_normalize_arg_spec:n} % \begin{macro}{\@@_normalize_arg_spec_loop:n} % Loop through the argument specification, calling an auxiliary % specific to each argument type. If any argument is unknown stop the -% definition. After the loop, if there are more than -% $9$ arguments, stop. Additionally, expandable commands may not end -% with an optional argument; this case is detected by using the fact -% that \cs{l_@@_last_delimiters_tl} is cleared by every mandatory -% argument and filled by every optional argument. +% definition. % \begin{macrocode} \cs_new_protected:Npn \@@_normalize_arg_spec:n #1 { @@ -1573,10 +1577,11 @@ \tl_clear:N \l_@@_last_delimiters_tl \tl_clear:N \l_@@_arg_spec_tl \bool_set_true:N \l_@@_grab_expandably_bool + \bool_set_false:N \l_@@_obey_spaces_bool \bool_set_false:N \l_@@_long_bool + \bool_set_false:N \l_@@_some_obey_spaces_bool \bool_set_false:N \l_@@_some_long_bool \bool_set_false:N \l_@@_some_short_bool - \bool_set_false:N \l_@@_ignore_spaces_bool \@@_normalize_arg_spec_loop:n #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop \int_compare:nNnT \l_@@_current_arg_int > 9 @@ -1691,7 +1696,12 @@ \cs_new_protected:cpn { @@_normalize_type_+:w } #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } - \tl_put_right:Nn \l_@@_arg_spec_tl { + } + \bool_if:NT \l_@@_long_bool + { + \__kernel_msg_error:nnxx { xparse } { two-markers } + { \iow_char:N \\ \l_@@_function_tl } { + } + \@@_bad_def:wn + } \bool_set_true:N \l_@@_long_bool \int_decr:N \l_@@_current_arg_int \@@_normalize_arg_spec_loop:n {#1} @@ -1699,7 +1709,14 @@ \cs_new_protected:cpn { @@_normalize_type_!:w } #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } - \tl_put_right:Nn \l_@@_arg_spec_tl { ! } + \bool_if:NT \l_@@_obey_spaces_bool + { + \__kernel_msg_error:nnxx { xparse } { two-markers } + { \iow_char:N \\ \l_@@_function_tl } { ! } + \@@_bad_def:wn + } + \bool_set_true:N \l_@@_obey_spaces_bool + \bool_set_true:N \l_@@_some_obey_spaces_bool \int_decr:N \l_@@_current_arg_int \@@_normalize_arg_spec_loop:n {#1} } @@ -1770,9 +1787,14 @@ { \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn } \@@_single_char_check:n {#1} - \tl_put_right:Nn \l_@@_arg_spec_tl { t #1 } + \tl_put_right:Nx \l_@@_arg_spec_tl + { + \bool_if:NT \l_@@_obey_spaces_bool { ! } + t \exp_not:n {#1} + } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} \bool_set_false:N \l_@@_grab_expandably_bool + \bool_set_false:N \l_@@_obey_spaces_bool \bool_set_false:N \l_@@_long_bool \@@_normalize_arg_spec_loop:n } @@ -1800,17 +1822,13 @@ \cs_new_protected:Npn \@@_normalize_type_l:w { \@@_normalize_check_lu:N l - \@@_add_arg_spec:n { l } - \int_incr:N \l_@@_mandatory_args_int - \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec_mandatory:n { l } \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_m:w { \@@_delimiter_check:nnn { } { m } { \iow_char:N \{ } - \@@_add_arg_spec:n { m } - \int_incr:N \l_@@_mandatory_args_int - \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec_mandatory:n { m } \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_R:w #1#2#3 @@ -1819,27 +1837,21 @@ \@@_single_char_check:n {#1} \@@_single_char_check:n {#2} \@@_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } - \@@_add_arg_spec:n { R #1 #2 {#3} } - \int_incr:N \l_@@_mandatory_args_int - \tl_clear:N \l_@@_last_delimiters_tl \bool_set_false:N \l_@@_grab_expandably_bool + \@@_add_arg_spec_mandatory:n { R #1 #2 {#3} } \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_u:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } \@@_normalize_check_lu:N u - \@@_add_arg_spec:n { u {#1} } - \int_incr:N \l_@@_mandatory_args_int - \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec_mandatory:n { u {#1} } \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_v:w { \@@_normalize_check_gv:N v - \@@_add_arg_spec:n { v } - \int_incr:N \l_@@_mandatory_args_int - \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec_mandatory:n { v } \@@_normalize_arg_spec_loop:n } % \end{macrocode} @@ -1936,13 +1948,16 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_add_arg_spec:n} +% \begin{macro}{\@@_add_arg_spec:n, \@@_add_arg_spec_mandatory:n} % When adding an argument to the argument specification, set the % \texttt{some_long} or \texttt{some_short} booleans as appropriate -% and clear the boolean keeping track of whether the argument is long. +% and clear the booleans keeping track of |+| and |!| markers. % Before that, test for a short argument following some long % arguments: this is forbidden for expandable commands and prevents % grabbing arguments expandably. +% +% For mandatory arguments do some more work, in particular complain if +% they were preceeded by~|!|. % \begin{macrocode} \cs_new_protected:Npn \@@_add_arg_spec:n #1 { @@ -1961,8 +1976,26 @@ \bool_if:NTF \l_@@_long_bool { \bool_set_true:N \l_@@_some_long_bool } { \bool_set_true:N \l_@@_some_short_bool } + \tl_put_right:Nx \l_@@_arg_spec_tl + { + \bool_if:NT \l_@@_long_bool { + } + \bool_if:NT \l_@@_obey_spaces_bool { ! } + \exp_not:n {#1} + } \bool_set_false:N \l_@@_long_bool - \tl_put_right:Nn \l_@@_arg_spec_tl {#1} + \bool_set_false:N \l_@@_obey_spaces_bool + } +\cs_new_protected:Npn \@@_add_arg_spec_mandatory:n #1 + { + \bool_if:NT \l_@@_some_obey_spaces_bool + { + \__kernel_msg_error:nnxx { xparse } { non-trailing-obey-spaces } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + \int_incr:N \l_@@_mandatory_args_int + \tl_clear:N \l_@@_last_delimiters_tl + \@@_add_arg_spec:n {#1} } % \end{macrocode} % \end{macro} @@ -1972,8 +2005,8 @@ % \begin{macro}{\@@_prepare_signature:n} % \begin{macro}{\@@_prepare_signature:N} % \begin{macro}{\@@_prepare_signature_bypass:N} -% Actually creating the signature uses the same loop approach as counting -% up mandatory arguments. There are first a number of variables which need +% Actually creating the signature uses the same loop approach as +% normalizing the signature. There are first a number of variables which need % to be set to track what is going on. Many of these variables are unused % when defining expandable commands. % \begin{macrocode} @@ -1981,7 +2014,7 @@ { \int_zero:N \l_@@_current_arg_int \bool_set_false:N \l_@@_long_bool - \bool_set_false:N \l_@@_ignore_spaces_bool + \bool_set_false:N \l_@@_obey_spaces_bool \int_zero:N \l_@@_m_args_int \bool_set_false:N \l_@@_defaults_bool \tl_clear:N \l_@@_defaults_tl @@ -2056,7 +2089,7 @@ \cs_new_protected:cpn { @@_add_type_!:w } { \@@_flush_m_args: - \bool_set_true:N \l_@@_ignore_spaces_bool + \bool_set_true:N \l_@@_obey_spaces_bool \bool_set_true:N \l_@@_prefixed_bool \@@_prepare_signature_bypass:N } @@ -2239,24 +2272,16 @@ % % \begin{macro}{\@@_add_grabber_mandatory:N} % \begin{macro}{\@@_add_grabber_optional:N} -% To keep the various checks needed in one place, adding the grabber to -% the signature is done here. For mandatory arguments, the only question -% is whether to add a long grabber. For optional arguments, there is -% also a check to see if any mandatory arguments are still to be added. -% This is used to determine whether to skip spaces or not when -% searching for the argument. +% To keep the various checks needed in one place, adding the grabber +% to the signature is done here. The only questions are whether the +% grabber should be long or not, and whether to obey spaces. The +% \cs{l_@@_obey_spaces_bool} boolean can only be \texttt{true} for +% trailing optional arguments. In that case spaces will not be +% ignored when looking for that optional argument. % \begin{macrocode} \cs_new_protected:Npn \@@_add_grabber_mandatory:N #1 { - \tl_put_right:Nx \l_@@_signature_tl - { - \exp_not:c - { @@_grab_ #1 \bool_if:NT \l_@@_long_bool { _long } :w } - } - \bool_set_false:N \l_@@_long_bool - \tl_put_right:Nx \l_@@_process_all_tl - { { \exp_not:o \l_@@_process_one_tl } } - \tl_clear:N \l_@@_process_one_tl + \@@_add_grabber_optional:N #1 \int_decr:N \l_@@_mandatory_args_int } \cs_new_protected:Npn \@@_add_grabber_optional:N #1 @@ -2267,15 +2292,12 @@ { @@_grab_ #1 \bool_if:NT \l_@@_long_bool { _long } - \bool_lazy_and:nnT - { \l_@@_ignore_spaces_bool } - { \int_compare_p:nNn \l_@@_mandatory_args_int = 0 } - { _ignore_spaces } + \bool_if:NT \l_@@_obey_spaces_bool { _obey_spaces } :w } } \bool_set_false:N \l_@@_long_bool - \bool_set_false:N \l_@@_ignore_spaces_bool + \bool_set_false:N \l_@@_obey_spaces_bool \tl_put_right:Nx \l_@@_process_all_tl { { \exp_not:o \l_@@_process_one_tl } } \tl_clear:N \l_@@_process_one_tl @@ -2573,28 +2595,34 @@ % % \begin{macro}{\@@_grab_D:w} % \begin{macro}{\@@_grab_D_long:w} -% \begin{macro}{\@@_grab_D_ignore_spaces:w} -% \begin{macro}{\@@_grab_D_long_ignore_spaces:w} +% \begin{macro}{\@@_grab_D_obey_spaces:w} +% \begin{macro}{\@@_grab_D_long_obey_spaces:w} % The generic delimited argument grabber. The auxiliary function does % a peek test before calling \cs{@@_grab_D_call:Nw}, so that the % optional nature of the argument works as expected. % \begin{macrocode} \cs_new_protected:Npn \@@_grab_D:w #1#2#3 \@@_run_code: { - \@@_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected_nopar:Npn - { _ignore_spaces } + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected_nopar:Npn + \@@_peek_nonspace_remove:NTF } \cs_new_protected:Npn \@@_grab_D_long:w #1#2#3 \@@_run_code: { - \@@_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected:Npn - { _ignore_spaces } + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected:Npn + \@@_peek_nonspace_remove:NTF + } +\cs_new_protected:Npn \@@_grab_D_obey_spaces:w #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected_nopar:Npn + \peek_meaning_remove:NTF + } +\cs_new_protected:Npn \@@_grab_D_long_obey_spaces:w #1#2#3 \@@_run_code: + { + \@@_grab_D_aux:NNnNN #1 #2 {#3} \cs_set_protected:Npn + \peek_meaning_remove:NTF } -\cs_new_protected:Npn \@@_grab_D_ignore_spaces:w #1#2#3 \@@_run_code: - { \@@_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected_nopar:Npn { } } -\cs_new_protected:Npn \@@_grab_D_long_ignore_spaces:w #1#2#3 \@@_run_code: - { \@@_grab_D_aux:NNnNn #1 #2 {#3} \cs_set_protected:Npn { } } % \end{macrocode} -% \begin{macro}{\@@_grab_D_aux:NNnNn} +% \begin{macro}{\@@_grab_D_aux:NNnNN} % \begin{macro}{\@@_grab_D_aux:NNnN} % This is a bit complicated. The idea is that, in order to check for % nested optional argument tokens (\texttt{[[...]]} and so on) the @@ -2604,10 +2632,10 @@ % prevents loss of braces, and there is then a test to see if there are % nested delimiters to handle. % \begin{macrocode} -\cs_new_protected:Npn \@@_grab_D_aux:NNnNn #1#2#3#4#5 +\cs_new_protected:Npn \@@_grab_D_aux:NNnNN #1#2#3#4#5 { \@@_grab_D_aux:NNnN #1#2 {#3} #4 - \use:c { peek_meaning_remove #5 :NTF } #1 + #5 #1 { \@@_grab_D_call:Nw #1 } { \@@_add_arg:o \c_novalue_tl } } @@ -2743,36 +2771,36 @@ % \begin{macro} % { % \@@_grab_E:w, \@@_grab_E_long:w, -% \@@_grab_E_ignore_spaces:w, \@@_grab_E_long_ignore_spaces:w +% \@@_grab_E_obey_spaces:w, \@@_grab_E_long_obey_spaces:w % } -% \begin{macro}{\@@_grab_E:nnNn} -% \begin{macro}{\@@_grab_E_loop:nnN} +% \begin{macro}{\@@_grab_E:nnNN} +% \begin{macro}{\@@_grab_E_loop:NnN} % \begin{macro}{\@@_grab_E_finalise:} % Everything here needs to point to a loop. % \begin{macrocode} \cs_new_protected:Npn \@@_grab_E:w #1#2 \@@_run_code: { - \@@_grab_E:nnNn {#1} {#2} + \@@_grab_E:nnNN {#1} {#2} \cs_set_protected_nopar:Npn - { _ignore_spaces } + \@@_peek_nonspace_remove:NTF } \cs_new_protected:Npn \@@_grab_E_long:w #1#2 \@@_run_code: { - \@@_grab_E:nnNn {#1} {#2} + \@@_grab_E:nnNN {#1} {#2} \cs_set_protected:Npn - { _ignore_spaces } + \@@_peek_nonspace_remove:NTF } -\cs_new_protected:Npn \@@_grab_E_ignore_spaces:w #1#2 \@@_run_code: +\cs_new_protected:Npn \@@_grab_E_obey_spaces:w #1#2 \@@_run_code: { - \@@_grab_E:nnNn {#1} {#2} + \@@_grab_E:nnNN {#1} {#2} \cs_set_protected_nopar:Npn - { } + \peek_meaning_remove:NTF } -\cs_new_protected:Npn \@@_grab_E_long_ignore_spaces:w #1#2 \@@_run_code: +\cs_new_protected:Npn \@@_grab_E_long_obey_spaces:w #1#2 \@@_run_code: { - \@@_grab_E:nnNn {#1} {#2} + \@@_grab_E:nnNN {#1} {#2} \cs_set_protected:Npn - { } + \peek_meaning_remove:NTF } % \end{macrocode} % A loop is needed here to allow a random ordering of keys. These are @@ -2780,12 +2808,12 @@ % they can appear later. The grabbed values are held in a property list % which is then turned into an ordered list to be passed back to the user. % \begin{macrocode} -\cs_new_protected:Npn \@@_grab_E:nnNn #1#2#3#4 +\cs_new_protected:Npn \@@_grab_E:nnNN #1#2#3#4 { \exp_after:wN #3 \l_@@_fn_tl ##1##2##3 { \prop_put:Nnn \l_@@_tmp_prop {##1} {##3} - \@@_grab_E_loop:nnN {#4} { } ##2 \q_recursion_stop + \@@_grab_E_loop:NnN #4 { } ##2 \q_recursion_stop } \prop_clear:N \l_@@_tmp_prop \tl_set:Nn \l_@@_signature_tl {#2} @@ -2800,16 +2828,16 @@ } \l_@@_signature_tl \@@_run_code: } - \@@_grab_E_loop:nnN {#4} { } #1 \q_recursion_tail \q_recursion_stop + \@@_grab_E_loop:NnN #4 { } #1 \q_recursion_tail \q_recursion_stop } -\cs_new_protected:Npn \@@_grab_E_loop:nnN #1#2#3#4 \q_recursion_stop +\cs_new_protected:Npn \@@_grab_E_loop:NnN #1#2#3#4 \q_recursion_stop { \cs_if_eq:NNTF #3 \q_recursion_tail { \@@_grab_E_finalise: } { - \use:c { peek_meaning_remove #1 :NTF } #3 + #1 #3 { \l_@@_fn_tl #3 {#2#4} } - { \@@_grab_E_loop:nnN {#1} {#2#3} #4 \q_recursion_stop } + { \@@_grab_E_loop:NnN #1 {#2#3} #4 \q_recursion_stop } } } \cs_new_protected:Npn \@@_grab_E_finalise: { } @@ -2821,31 +2849,38 @@ % % \begin{macro}{\@@_grab_G:w} % \begin{macro}{\@@_grab_G_long:w} -% \begin{macro}{\@@_grab_G_ignore_spaces:w} -% \begin{macro}{\@@_grab_G_long_ignore_spaces:w} -% \begin{macro}{\@@_grab_G_aux:nNn} +% \begin{macro}{\@@_grab_G_obey_spaces:w} +% \begin{macro}{\@@_grab_G_long_obey_spaces:w} +% \begin{macro}{\@@_grab_G_aux:nNN} % Optional groups are checked by meaning, so that the same code will % work with, for example, \ConTeXt{}-like input. % \begin{macrocode} \cs_new_protected:Npn \@@_grab_G:w #1 \@@_run_code: { - \@@_grab_G_aux:nNn {#1} \cs_set_protected_nopar:Npn - { _ignore_spaces } + \@@_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn + \@@_peek_nonspace:NTF } \cs_new_protected:Npn \@@_grab_G_long:w #1 \@@_run_code: { - \@@_grab_G_aux:nNn {#1} \cs_set_protected:Npn { _ignore_spaces } + \@@_grab_G_aux:nNN {#1} \cs_set_protected:Npn + \@@_peek_nonspace:NTF + } +\cs_new_protected:Npn \@@_grab_G_obey_spaces:w #1 \@@_run_code: + { + \@@_grab_G_aux:nNN {#1} \cs_set_protected_nopar:Npn + \peek_meaning:NTF } -\cs_new_protected:Npn \@@_grab_G_ignore_spaces:w #1 \@@_run_code: - { \@@_grab_G_aux:nNn {#1} \cs_set_protected_nopar:Npn { } } -\cs_new_protected:Npn \@@_grab_G_long_ignore_spaces:w #1 \@@_run_code: - { \@@_grab_G_aux:nNn {#1} \cs_set_protected:Npn { } } -\cs_new_protected:Npn \@@_grab_G_aux:nNn #1#2#3 +\cs_new_protected:Npn \@@_grab_G_long_obey_spaces:w #1 \@@_run_code: + { + \@@_grab_G_aux:nNN {#1} \cs_set_protected:Npn + \peek_meaning:NTF + } +\cs_new_protected:Npn \@@_grab_G_aux:nNN #1#2#3 { \tl_set:Nn \l_@@_signature_tl {#1} \exp_after:wN #2 \l_@@_fn_tl ##1 { \@@_add_arg:n {##1} } - \use:c { peek_meaning #3 :NTF } \c_group_begin_token + #3 \c_group_begin_token { \l_@@_fn_tl } { \@@_add_arg:o \c_novalue_tl } } @@ -2998,7 +3033,7 @@ \cs_new_protected:Npn \@@_grab_R_aux:NNnN #1#2#3#4 { \@@_grab_D_aux:NNnN #1 #2 {#3} #4 - \peek_meaning_remove_ignore_spaces:NTF #1 + \@@_peek_nonspace_remove:NTF #1 { \@@_grab_D_call:Nw #1 } { \__kernel_msg_error:nnxx { xparse } { missing-required } @@ -3012,19 +3047,15 @@ % \end{macro} % % \begin{macro}{\@@_grab_t:w} -% \begin{macro}{\@@_grab_t_long:w} -% \begin{macro}{\@@_grab_t_ignore_spaces:w} -% \begin{macro}{\@@_grab_t_long_ignore_spaces:w} +% \begin{macro}{\@@_grab_t_obey_spaces:w} % \begin{macro}{\@@_grab_t_aux:NNw} % Dealing with a token is quite easy. Check the match, remove the % token if needed and add a flag to the output. % \begin{macrocode} \cs_new_protected:Npn \@@_grab_t:w - { \@@_grab_t_aux:NNw \peek_meaning_remove_ignore_spaces:NTF } -\cs_new_eq:NN \@@_grab_t_long:w \@@_grab_t:w -\cs_new_protected:Npn \@@_grab_t_ignore_spaces:w + { \@@_grab_t_aux:NNw \@@_peek_nonspace_remove:NTF } +\cs_new_protected:Npn \@@_grab_t_obey_spaces:w { \@@_grab_t_aux:NNw \peek_meaning_remove:NTF } -\cs_new_eq:NN \@@_grab_t_long_ignore_spaces:w \@@_grab_t_ignore_spaces:w \cs_new_protected:Npn \@@_grab_t_aux:NNw #1#2#3 \@@_run_code: { \tl_set:Nn \l_@@_signature_tl {#3} @@ -3040,8 +3071,6 @@ % \end{macro} % \end{macro} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro}{\@@_grab_u:w} % \begin{macro}{\@@_grab_u_long:w} @@ -4066,6 +4095,23 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@_peek_nonspace:NTF, \@@_peek_nonspace_remove:NTF, \@@_peek_nonspace_aux:nNNTF} +% Collect spaces in a loop, and put the collected spaces back in the +% false branch of a call to \cs{peek_meaning:NTF} or +% \cs{peek_meaning_remove:NTF}. +% \begin{macrocode} +\cs_new_protected:Npn \@@_peek_nonspace:NTF + { \@@_peek_nonspace_aux:nNNTF { } \peek_meaning:NTF } +\cs_new_protected:Npn \@@_peek_nonspace_remove:NTF + { \@@_peek_nonspace_aux:nNNTF { } \peek_meaning_remove:NTF } +\cs_new_protected:Npn \@@_peek_nonspace_aux:nNNTF #1#2#3#4#5 + { + \peek_meaning_remove:NTF \c_space_token + { \@@_peek_nonspace_aux:nNNTF { #1 ~ } #2 #3 {#4} {#5} } + { #2 #3 { #4 } { #5 #1 } } + } +% \end{macro} +% % \subsection{Messages} % % Some messages intended as errors. @@ -4158,6 +4204,13 @@ The~current~command~'#1'~expects~an~argument~starting~with~'#2'.~ LaTeX~did~not~find~it,~and~will~insert~a~default~value~to~be~processed. } +\__kernel_msg_new:nnnn { xparse } { non-trailing-obey-spaces } + { Prefix~'!'~used~before~mandatory~argument~'#2'~of~command~'#1'. } + { + The~prefix~'!'~can~only~apply~to~trailing~optional~arguments. + \\ \\ + LaTeX~will~ignore~this~entire~definition. + } \__kernel_msg_new:nnnn { xparse } { non-xparse-command } { Command~'#1'~not~defined~using~xparse. } { @@ -4219,6 +4272,12 @@ This~cannot~be~implemented. \\ \\ LaTeX~will~ignore~this~entire~definition. } +\__kernel_msg_new:nnnn { xparse } { two-markers } + { Two~'#2'~apply~to~the~same~argument~in~argument~specification~of~command~'#1'. } + { + The~argument~specification~provided~has~two~markers~'#2'~applying~ + to~the~same~argument;~these~are~redundant. + } \__kernel_msg_new:nnnn { xparse } { unknown-argument-type } { Unknown~argument~type~'#2'~for~the~command~'#1'. } { diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 182e8be40f8..d0f69f40172 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2018-08-23} +% \date{Released 2018-09-24} % % \maketitle % @@ -682,7 +682,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xtemplate}{2018-08-23}{} +\ProvidesExplPackage{xtemplate}{2018-09-24}{} {L3 Experimental prototype document functions} % \end{macrocode} % -- cgit v1.2.3