diff options
author | Norbert Preining <norbert@preining.info> | 2023-05-06 03:01:13 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-05-06 03:01:13 +0000 |
commit | 507fa9c669d7e4bc2c808f269113c6ced0b18827 (patch) | |
tree | 92d0ad38dc9549526803851fa62b4399f03006ac /macros | |
parent | 3cf2e76fc502cb474081c80838c95ecaba2f386d (diff) |
CTAN sync 202305060301
Diffstat (limited to 'macros')
89 files changed, 967 insertions, 1488 deletions
diff --git a/macros/latex/contrib/annotate-equations/annotate-equations.pdf b/macros/latex/contrib/annotate-equations/annotate-equations.pdf Binary files differindex b29c607771..e7b9b340f2 100644 --- a/macros/latex/contrib/annotate-equations/annotate-equations.pdf +++ b/macros/latex/contrib/annotate-equations/annotate-equations.pdf diff --git a/macros/latex/contrib/annotate-equations/annotate-equations.sty b/macros/latex/contrib/annotate-equations/annotate-equations.sty index dbdd5f59f5..0c471b13c3 100644 --- a/macros/latex/contrib/annotate-equations/annotate-equations.sty +++ b/macros/latex/contrib/annotate-equations/annotate-equations.sty @@ -5,7 +5,7 @@ % \NeedsTeXFormat{LaTeX2e}[1994/06/01] \ProvidesPackage{annotate-equations} - [2023/02/15 v0.2.0 easily annotate equations using TikZ] + [2023/03/05 v0.2.1 easily annotate equations using TikZ] %%% lualatex compatibility, from https://tex.stackexchange.com/a/351520/171664 \RequirePackage{ifluatex} @@ -55,6 +55,9 @@ label below/.code = {\renewcommand\EAlabelanchor{north}}, } +\tikzset{annotate equations/arrow/.style={}} +\tikzset{annotate equations/text/.style={font=\eqnannotationfont}} + %%%%% %%%%%%%% %%%%% @@ -128,13 +131,13 @@ \begin{tikzpicture}[overlay,remember picture,>=stealth,nodes={align=left,inner ysep=1pt},<-] % default anchor is at center \node[anchor=\swapNorthSouth{\EAmarkanchor},color=\myEAcolor!85, - font=\eqnannotationfont,#1 + annotate equations/text,#1 ] % color blended with white to 85%, any (optional) extra args #1 (\eqnannotateCurrentNode) % use counter-based "local node" at ($(\myEAmarkOne.\EAmarkanchor)!0.5!(\myEAmarkTwo.\EAmarkanchor)$) % centered between the two nodes {\myEAtext\eqnannotationstrut}; % double arrow to two uses within the equation: - \draw [<->,color=\myEAcolor] (\myEAmarkOne.\EAmarkanchor) |- ([yshift=0.1ex] \eqnannotateCurrentNode.\EAlabelanchor) -| (\myEAmarkTwo.\EAmarkanchor); % from node 1 via annotation to node 2, with anchor #6 each + \draw [<->,color=\myEAcolor, annotate equations/arrow] (\myEAmarkOne.\EAmarkanchor) |- ([yshift=0.1ex] \eqnannotateCurrentNode.\EAlabelanchor) -| (\myEAmarkTwo.\EAmarkanchor); % from node 1 via annotation to node 2, with anchor #6 each \end{tikzpicture}% \endgroup% %%% close group again } @@ -171,13 +174,13 @@ \def\myEAxshift{\EAxshift{\EAwesteast}}% \begin{tikzpicture}[overlay,remember picture,>=stealth,nodes={align=left,inner ysep=1pt},<-] \node[anchor=\swapNorthSouth{\EAmarkanchor} \swapWestEast{\EAwesteast}, - color=\myEAcolor!85,font=\eqnannotationfont,#1] % TODO for some reason, passing #1 through command doesn't work... + color=\myEAcolor!85,annotate equations/text,#1] % TODO for some reason, passing #1 through command doesn't work... % anchor=west: align left edge of text on top of tikzmark in equation % should be north west for below and south west for above ... (\eqnannotateCurrentNode) at (\myEAmark.\EAmarkanchor) % \EAmarkanchor north: above the equation, south: below {\myEAtext\eqnannotationstrut}; \foreach \EAmark in \myEAmarks - \draw [color=\myEAcolor] (\EAmark.\EAmarkanchor) % arrow from the equation + \draw [color=\myEAcolor, annotate equations/arrow] (\EAmark.\EAmarkanchor) % arrow from the equation % \EAmarkanchor north: above the equation, south: below |- ([xshift=\myEAxshift,yshift=0.1ex] \eqnannotateCurrentNode.south \EAwesteast); % - south east: we want line to end at bottom right of annotation text; diff --git a/macros/latex/contrib/annotate-equations/annotate-equations.tex b/macros/latex/contrib/annotate-equations/annotate-equations.tex index 26396e679e..5fc0aa6017 100644 --- a/macros/latex/contrib/annotate-equations/annotate-equations.tex +++ b/macros/latex/contrib/annotate-equations/annotate-equations.tex @@ -26,15 +26,18 @@ text above listing, #1} -\title{\texttt{annotate-equations.sty}} +\title{\texttt{annotate-equations.sty}, v.0.2.1} \author{ST John} \date{\url{https://github.com/st--/annotate-equations}} + \begin{document} \maketitle -\section{Introduction} + + +%\section{Introduction} This package is there to make it easier to make annotated equations in \LaTeX, such as in this example: \begin{LTXexample}[] @@ -52,6 +55,10 @@ There is still a bit of manual tweaking required (such as adding vertical space Note that this package relies on TikZ's \texttt{remember picture} option and therefore you have to compile your \LaTeX{} document at least twice to get everything in the right place (or just use \texttt{latexmk}!). + +\tableofcontents + + \section{Marking annotation targets within your equation} \newcommand{\cmdoption}[1]{$\langle$\textit{#1}$\rangle$} @@ -74,6 +81,7 @@ but this is likely to end up with the arrow tip too close to the target, so you \end{LTXexample} \noindent + \section{Simple annotations} \label{sec:annotate} @@ -128,6 +136,7 @@ One annotation can point to multiple targets, and multiple annotations can point \noindent % + \section{Double annotations} \label{sec:annotatetwo} @@ -146,6 +155,7 @@ One annotation can point to multiple targets, and multiple annotations can point % Color is picked from the first of the two nodes. + \section{Package options} \subsection{Size of highlight: shrink to content or always full height} @@ -222,6 +232,7 @@ By redefining this command, you can change the ``alpha'' value of the highlight: \noindent \subsection{Default formatting of annotation labels} +\label{sec:eqnannotationfont} \verb|\eqnannotationfont| sets the \texttt{font} field of the TikZ annotation label and can be re-set to change its formatting: \begin{LTXexample}[text outside listing,lefthand width=0.5in] @@ -245,6 +256,18 @@ By redefining this command, you can change the ``alpha'' value of the highlight: \vspace{1em} \end{LTXexample} \noindent +% +Alternatively, you can also change the style of \verb|annotate equations/text|: +\begin{LTXexample}[text outside listing,lefthand width=0.5in] +\tikzset{annotate equations/text/.style={font=\bfseries\small}} + +\begin{equation*} + \eqnmarkbox[blue]{v}{v} +\end{equation*} +\annotate[yshift=-0.5em]{below}{v}{velocity} +\vspace{1em} +\end{LTXexample} +\noindent \verb|\eqnannotationstrut| is defined to be a strut (zero-width height) to provide minimum distance between the text and the corresponding arrow line. By @@ -273,6 +296,32 @@ default it is \verb|\strut|, which has a similar effect to \end{LTXexample} +\subsection{Customize style} + +You can change the style of the annotation arrow line by setting the style of \verb|annotate equations/arrow|: +\begin{LTXexample}[text outside listing,lefthand width=0.5in] +\tikzset{annotate equations/arrow/.style={color=ForestGreen, >=latex', very thick, dashed}} + +\begin{equation*} + \eqnmarkbox[blue]{size}{s} = \eqnmarkbox[red]{other}{x} +\end{equation*} +\annotate[yshift=-0.5em]{below}{size}{The size} +\annotatetwo[yshift=1em]{above}{size}{other}{the same} +\end{LTXexample} +\noindent +Note that it applies to all \verb|\annotate| and \verb|\annotatetwo| arrows within the scope. + +You can also use this to change the arrow direction: +\begin{LTXexample}[text outside listing,lefthand width=0.5in] +\begin{equation*} + \eqnmarkbox[blue]{size}{s} = \eqnmarkbox[red]{other}{x} +\end{equation*} +\tikzset{annotate equations/arrow/.style={->}} +\annotatetwo[yshift=1em]{above}{size}{other}{one and} +\tikzset{annotate equations/arrow/.style={<-}} +\annotatetwo[yshift=-1em]{below, label below}{size}{other}{the same} % note that the "direction" of the arrow is from first to second mark +\end{LTXexample} + \section{Recommendations, tips \& tricks} \subsection{Use \texttt{\textbackslash{}colorlet} for consistent, easily changeable colors} @@ -319,4 +368,23 @@ a \mathrel{\tikzmarknode[outer ysep=5pt]{node1}{=}} b \end{itemize} + +\section{Backwards-incompatible changes} + +\subsection*{v0.2.0} + +\subsubsection*{\texttt{\textbackslash{}eqnannotationtext} removed} + +To make it easier to format multiline annotations, version 0.2.0 introduced the \verb|\eqnannotationfont| and \verb|\eqnannotationstrut| (zero-argument) commands (see \cref{sec:eqnannotationfont}). + +In exchange, the \verb|\eqnannotationtext| (one-argument) command was removed. To upgrade, replace for example +\begin{tcblisting}{listing only} + \renewcommand{\eqnannotationtext}[1]{\sffamily\tiny#1\strut} +\end{tcblisting} +with +\begin{tcblisting}{listing only} + \renewcommand{\eqnannotationfont}{\sffamily\tiny} + \renewcommand{\eqnannotationstrut}{\strut} +\end{tcblisting} + \end{document} diff --git a/macros/latex/contrib/l3kernel/CHANGELOG.md b/macros/latex/contrib/l3kernel/CHANGELOG.md index 72a2211244..0960f6ff86 100644 --- a/macros/latex/contrib/l3kernel/CHANGELOG.md +++ b/macros/latex/contrib/l3kernel/CHANGELOG.md @@ -7,6 +7,44 @@ this project uses date-based 'snapshot' version identifiers. ## [Unreleased] +## [2023-05-05] + +### Added +- `\bool_case:n(TF)` (renamed from `\bool_case_true:n(TF)`) +- `\flag_ensure_raised:n` (renamed from `\flag_raise_if_clear:n`) +- `\iow_wrap_allow_break:` (renamed from `\iow_allow_break:`) + +### Changed +- Moved to stable status: + - `\bool_(g)set_inverse:N` + - `\c_catcode_active_space_tl` + - `\c_sys_engine_version_str` + - `\exp_args_generate:n` + - `\fp_if_nan:n(TF)` + - `\ior_get_term:nN` and `\ior_str_get_term:nN` + - `\ior_shell_open:Nn` + - `\msg_show_item:n`, `\msg_show_item_unbraced:n`, + `\msg_show_item:nn`, `\msg_show_item_unbraced:nn` +- Require random number support from engine + +### Removed +- Experimental functions from `l3candidates`: + - `\bool_case_false:n(TF)` + - `\intarray_gset_rand:Nn(n)` + - `\intarray_to_clist:N` + - `\peek_catcode_collect_inline:Nn`, `\peek_charcode_collect_inline:Nn` and + `\peek_meaning_collect_inline:Nn` + - `\prop_rand_key_value:N` + - `\seq_set_from_function:Nnn` and `\seq_set_from_inline_x:Nnn` + - `\sys_if_rand_exist:(TF)` + - `\tl_range_braced:Nnn` and `\tl_range_unbraced:Nnn` +- Experimental functions now renamed + - `\bool_case_true:n(TF)` (now `\bool_case:n(TF)`) + - `\flag_raise_if_clear:n` (now `\flag_raise_if_clear:n`) + - `\iow_allow_break:` (now `\iow_wrap_allow_break:`) +- Experimental functions moved to kernel-internal: + - `\msg_log_eval:Nn` and `\msg_show_eval:Nn` + ## [2023-04-20] ### Changed @@ -1345,7 +1383,8 @@ this project uses date-based 'snapshot' version identifiers. - Step functions have been added for dim variables, e.g. `\dim_step_inline:nnnn` -[Unreleased]: https://github.com/latex3/latex3/compare/2023-04-20...HEAD +[Unreleased]: https://github.com/latex3/latex3/compare/2023-05-05...HEAD +[2023-05-05]: https://github.com/latex3/latex3/compare/2023-04-20...2023-05-05 [2023-04-20]: https://github.com/latex3/latex3/compare/2023-04-19...2023-04-20 [2023-04-19]: https://github.com/latex3/latex3/compare/2023-03-30...2023-04-19 [2023-03-30]: https://github.com/latex3/latex3/compare/2023-02-22...2023-03-30 diff --git a/macros/latex/contrib/l3kernel/README.md b/macros/latex/contrib/l3kernel/README.md index e3f91afbe5..881c2bbcdc 100644 --- a/macros/latex/contrib/l3kernel/README.md +++ b/macros/latex/contrib/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2023-04-20 +Release 2023-05-05 Overview -------- @@ -21,9 +21,6 @@ team as stable. There may still be changes to some functions, but these will be very minor when compared to the scope of `l3kernel`. In particular, no functions will be removed, although some may be deprecated. -Programmers making use of `l3kernel` are *strongly* encouraged to subscribe to -the LaTeX-L mailing list (see below): announcements concerning the deprecation -or modification of functions are made on the list. Requirements ------------ @@ -77,30 +74,12 @@ LuaTeX manual The existence of the primitive `\Umathcode` is used as the marker for Unicode support. -Discussion ----------- - -Discussion concerning the approach, suggestions for improvements, -changes, additions, _etc._ should be addressed to the list -[LaTeX-L](https://listserv.uni-heidelberg.de/cgi-bin/wa?A0=LATEX-L). - -You can subscribe to this list by sending mail to - - listserv@urz.uni-heidelberg.de - -with the body containing - - subscribe LATEX-L <Your-First-Name> <Your-Second-Name> - Issues ------ The issue tracker for LaTeX3 is currently located [on GitHub](https://github.com/latex3/latex3/issues). -Please report specific issues with LaTeX3 code there; more general -discussion should be directed to the [LaTeX-L list](#Discussion). - The LaTeX Project ------------------ @@ -108,8 +87,7 @@ Development of LaTeX3 is carried out by [The LaTeX Project](https://www.latex-project.org/latex3/). The development team can be contacted -by e-mail: <latex-team@latex-project.org>; for general LaTeX3 discussion -the [LaTeX-L list](#Discussion) should be used. +by e-mail: <latex-team@latex-project.org>. ----- diff --git a/macros/latex/contrib/l3kernel/expl3.dtx b/macros/latex/contrib/l3kernel/expl3.dtx index e8010de640..dcdb6a23fb 100644 --- a/macros/latex/contrib/l3kernel/expl3.dtx +++ b/macros/latex/contrib/l3kernel/expl3.dtx @@ -24,7 +24,7 @@ % %<*driver|generic|package|2ekernel> %</driver|generic|package|2ekernel> -\def\ExplFileDate{2023-04-20}% +\def\ExplFileDate{2023-05-05}% %<*driver> \documentclass[full]{l3doc} \usepackage{graphicx} @@ -51,7 +51,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/expl3.pdf b/macros/latex/contrib/l3kernel/expl3.pdf Binary files differindex 3bf17da30a..2204ca816f 100644 --- a/macros/latex/contrib/l3kernel/expl3.pdf +++ b/macros/latex/contrib/l3kernel/expl3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.pdf b/macros/latex/contrib/l3kernel/interface3.pdf Binary files differindex 6beef4813b..22387e6da0 100644 --- a/macros/latex/contrib/l3kernel/interface3.pdf +++ b/macros/latex/contrib/l3kernel/interface3.pdf diff --git a/macros/latex/contrib/l3kernel/interface3.tex b/macros/latex/contrib/l3kernel/interface3.tex index 194f771015..400116b4f8 100644 --- a/macros/latex/contrib/l3kernel/interface3.tex +++ b/macros/latex/contrib/l3kernel/interface3.tex @@ -62,7 +62,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2023-04-20} +\date{Released 2023-05-05} \pagenumbering{roman} \maketitle diff --git a/macros/latex/contrib/l3kernel/l3basics.dtx b/macros/latex/contrib/l3kernel/l3basics.dtx index 7398c447c8..7febaf4653 100644 --- a/macros/latex/contrib/l3kernel/l3basics.dtx +++ b/macros/latex/contrib/l3kernel/l3basics.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3bootstrap.dtx b/macros/latex/contrib/l3kernel/l3bootstrap.dtx index d62c3aa360..e0846c06ec 100644 --- a/macros/latex/contrib/l3kernel/l3bootstrap.dtx +++ b/macros/latex/contrib/l3kernel/l3bootstrap.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3box.dtx b/macros/latex/contrib/l3kernel/l3box.dtx index b529756bdd..379f42e910 100644 --- a/macros/latex/contrib/l3kernel/l3box.dtx +++ b/macros/latex/contrib/l3kernel/l3box.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3candidates.dtx b/macros/latex/contrib/l3kernel/l3candidates.dtx index 478db99daa..4c08d8e422 100644 --- a/macros/latex/contrib/l3kernel/l3candidates.dtx +++ b/macros/latex/contrib/l3kernel/l3candidates.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -84,221 +84,6 @@ % into the kernel. However, real use sometimes leads to better ideas, so functions from this module are % \textbf{not necessarily stable} and we may have to adjust them! % -% \section{Additions to \pkg{l3expan}} -% -% \begin{function}[added = 2018-04-04, updated = 2019-02-08] -% {\exp_args_generate:n} -% \begin{syntax} -% \cs{exp_args_generate:n} \Arg{variant argument specifiers} -% \end{syntax} -% Defines \cs[no-index]{exp_args:N\meta{variant}} functions for each -% \meta{variant} given in the comma list \Arg{variant argument -% specifiers}. Each \meta{variant} should consist of the letters |N|, -% |c|, |n|, |V|, |v|, |o|, |f|, |e|, |x|, |p| and the resulting function is -% protected if the letter |x| appears in the \meta{variant}. This is -% only useful for cases where \cs{cs_generate_variant:Nn} is not -% applicable. -% \end{function} -% -% \section{Additions to \pkg{l3fp}} -% -% \begin{function}[pTF, added = 2019-08-25]{\fp_if_nan:n} -% \begin{syntax} -% \cs{fp_if_nan:n} \Arg{fp expr} -% \end{syntax} -% Evaluates the \meta{fp expr} and tests whether the result is exactly -% \nan{}. The test returns \texttt{false} for any other result, even -% a tuple containing \nan{}. -% \end{function} -% -% \section{Additions to \pkg{l3file}} -% -% \begin{function}[added = 2018-12-29]{\iow_allow_break:} -% \begin{syntax} -% \cs{iow_allow_break:} -% \end{syntax} -% In the first argument of \cs{iow_wrap:nnnN} (for instance in -% messages), inserts a break-point that allows a line break. -% In other words this is a zero-width breaking space. -% \end{function} -% -% \begin{function}[added = 2019-03-23]{\ior_get_term:nN, \ior_str_get_term:nN} -% \begin{syntax} -% \cs{ior_get_term:nN} \meta{prompt} \meta{token list variable} -% \end{syntax} -% Function that reads one or more lines (until an equal number of left -% and right braces are found) from the terminal and stores -% the result locally in the \meta{token list} variable. Tokenization -% occurs as described for \cs{ior_get:NN} or \cs{ior_str_get:NN}, respectively. -% When the \meta{prompt} -% is empty, \TeX{} will wait for input without any other indication: -% typically the programmer will have provided a suitable text using -% e.g.~\cs{iow_term:n}. Where the \meta{prompt} is given, it will appear -% in the terminal followed by an |=|, e.g. -% \begin{verbatim} -% prompt= -% \end{verbatim} -% \end{function} -% -% \begin{function}[added = 2019-05-08]{\ior_shell_open:Nn} -% \begin{syntax} -% \cs{ior_shell_open:Nn} \meta{stream} \Arg{shell~command} -% \end{syntax} -% Opens the \emph{pseudo}-file created by the output of the -% \meta{shell command} for reading using \meta{stream} as the -% control sequence for access. If the \meta{stream} was already -% open it is closed before the new operation begins. The -% \meta{stream} is available for access immediately and will remain -% allocated to \meta{shell command} until a \cs{ior_close:N} instruction -% is given or the \TeX{} run ends. -% If piped system calls are disabled an error is raised. -% -% For details of handling of the \meta{shell command}, see -% \cs{sys_get_shell:nnNTF}. -% \end{function} -% -% \section{Additions to \pkg{l3flag}} -% -% \begin{function}[EXP, added = 2018-04-02]{\flag_raise_if_clear:n} -% \begin{syntax} -% \cs{flag_raise_if_clear:n} \Arg{flag name} -% \end{syntax} -% Ensures the \meta{flag} is raised by making its height at least~$1$, -% locally. -% \end{function} -% -% \section{Additions to \pkg{l3intarray}} -% -% \begin{function}[added = 2018-05-05] -% { -% \intarray_gset_rand:Nnn, \intarray_gset_rand:cnn, -% \intarray_gset_rand:Nn, \intarray_gset_rand:cn -% } -% \begin{syntax} -% \cs{intarray_gset_rand:Nnn} \meta{intarray~var} \Arg{minimum} \Arg{maximum} -% \cs{intarray_gset_rand:Nn} \meta{intarray~var} \Arg{maximum} -% \end{syntax} -% Evaluates the integer expressions \meta{minimum} and \meta{maximum} -% then sets each entry (independently) of the \meta{integer array -% variable} to a pseudo-random number between the two (with bounds -% included). If the absolute value of either bound is bigger than -% $2^{30}-1$, an error occurs. Entries are generated in the same way -% as repeated calls to \cs{int_rand:nn} or \cs{int_rand:n} -% respectively, in particular for the second function the -% \meta{minimum} is $1$. -% Assignments are always global. -% This is not available in older versions of \XeTeX{}. -% \end{function} -% -% \begin{function}[added = 2018-05-04, rEXP]{\intarray_to_clist:N} -% \begin{syntax} -% \cs{intarray_to_clist:N} \meta{intarray~var} -% \end{syntax} -% Converts the \meta{intarray} to integer denotations separated by -% commas. All tokens have category code other. If the -% \meta{intarray} has no entry the result is empty; otherwise the -% result has one fewer comma than the number of items. -% \end{function} -% -% \section{Additions to \pkg{l3msg}} -% -% \begin{function}[added = 2017-12-04]{\msg_show_eval:Nn, \msg_log_eval:Nn} -% \begin{syntax} -% \cs{msg_show_eval:Nn} \meta{function} \Arg{expression} -% \end{syntax} -% Shows or logs the \meta{expression} (turned into a string), an equal -% sign, and the result of applying the \meta{function} to the -% \Arg{expression} (with \texttt{f}-expansion). For instance, if the -% \meta{function} is \cs{int_eval:n} and the \meta{expression} is -% |1+2| then this logs |> 1+2=3.| -% \end{function} -% -% \begin{function}[EXP, added = 2017-12-04] -% {\msg_show_item:n, \msg_show_item_unbraced:n, \msg_show_item:nn, \msg_show_item_unbraced:nn} -% \begin{syntax} -% \cs{seq_map_function:NN} \meta{seq} \cs{msg_show_item:n} -% \cs{prop_map_function:NN} \meta{prop} \cs{msg_show_item:nn} -% \end{syntax} -% Used in the text of messages for \cs{msg_show:nnxxxx} to show or log -% a list of items or key--value pairs. The one-argument functions are -% used for sequences, clist or token lists and the others for property -% lists. These functions turn their arguments to strings. -% \end{function} -% -% \section{Additions to \pkg{l3prg}} -% -% \begin{function}[added = 2018-05-10] -% { -% \bool_set_inverse:N , \bool_set_inverse:c , -% \bool_gset_inverse:N, \bool_gset_inverse:c -% } -% \begin{syntax} -% \cs{bool_set_inverse:N} \meta{boolean} -% \end{syntax} -% Toggles the \meta{boolean} from \texttt{true} to \texttt{false} and -% conversely: sets it to the inverse of its current value. -% \end{function} -% -% \begin{function}[added = 2019-02-10, EXP, noTF] -% {\bool_case_true:n, \bool_case_false:n} -% \begin{syntax} -% \cs{bool_case_true:nTF} \\ -% ~~|{| \\ -% ~~~~\Arg{boolexpr case_1} \Arg{code case_1} \\ -% ~~~~\Arg{boolexpr case_2} \Arg{code case_2} \\ -% ~~~~\ldots \\ -% ~~~~\Arg{boolexpr case_n} \Arg{code case_n} \\ -% ~~|}| \\ -% ~~\Arg{true code} -% ~~\Arg{false code} -% \end{syntax} -% Evaluates in turn each of the \meta{boolean expression cases} until -% the first one that evaluates to \texttt{true} or to \texttt{false}, -% for \cs{bool_case_true:n} and \cs{bool_case_false:n}, respectively. -% The \meta{code} associated to this first case is left in the input -% stream, followed by the \meta{true code}, and other cases are -% discarded. If none of the cases match then only the \meta{false -% code} is inserted. The functions \cs{bool_case_true:n} and -% \cs{bool_case_false:n}, which do nothing if there is no match, are -% also available. For example -% \begin{verbatim} -% \bool_case_true:nF -% { -% { \dim_compare_p:n { \l__mypkg_wd_dim <= 10pt } } -% { Fits } -% { \int_compare_p:n { \l__mypkg_total_int >= 10 } } -% { Many } -% { \l__mypkg_special_bool } -% { Special } -% } -% { No idea! } -% \end{verbatim} -% leaves \enquote{\texttt{Fits}} or \enquote{\texttt{Many}} or -% \enquote{\texttt{Special}} or \enquote{\texttt{No idea!}} in the -% input stream, in a way similar to some other language's -% \enquote{\texttt{if} \ldots\ \texttt{elseif} \ldots\ \texttt{elseif} \ldots\ -% \texttt{else} \ldots}. -% \end{function} -% -% \section{Additions to \pkg{l3prop}} -% -% \begin{function}[EXP, added = 2016-12-06] -% {\prop_rand_key_value:N, \prop_rand_key_value:c} -% \begin{syntax} -% \cs{prop_rand_key_value:N} \meta{property list} -% \end{syntax} -% Selects a pseudo-random key--value pair from the \meta{property list} -% and returns \Arg{key} and \Arg{value}. If the \meta{property list} is -% empty the result is empty. -% This is not available in older versions of \XeTeX{}. -% \begin{texnote} -% The result is returned within the \tn{unexpanded} -% primitive (\cs{exp_not:n}), which means that the \meta{value} -% does not expand further when appearing in an \texttt{x}-type -% or \texttt{e}-type argument expansion. -% \end{texnote} -% \end{function} -% % \section{Additions to \pkg{l3seq}} % % \begin{function}[rEXP] @@ -334,44 +119,6 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2018-04-06] -% {\seq_set_from_function:NnN, \seq_gset_from_function:NnN} -% \begin{syntax} -% \cs{seq_set_from_function:NnN} \meta{seq~var} \Arg{loop~code} \meta{function} -% \end{syntax} -% Sets the \meta{seq~var} equal to a sequence whose items are obtained -% by \texttt{x}-expanding \meta{loop~code} \meta{function}. This -% expansion must result in successive calls to the \meta{function} -% with no nonexpandable tokens in between. More precisely the -% \meta{function} is replaced by a wrapper function that inserts the -% appropriate separators between items in the sequence. The -% \meta{loop~code} must be expandable; it can be for example -% \cs{tl_map_function:NN} \meta{tl~var} or \cs{clist_map_function:nN} -% \Arg{clist} or \cs{int_step_function:nnnN} \Arg{initial value} -% \Arg{step} \Arg{final value}. -% \end{function} -% -% \begin{function}[added = 2018-04-06] -% {\seq_set_from_inline_x:Nnn, \seq_gset_from_inline_x:Nnn} -% \begin{syntax} -% \cs{seq_set_from_inline_x:Nnn} \meta{seq~var} \Arg{loop~code} \Arg{inline~code} -% \end{syntax} -% Sets the \meta{seq~var} equal to a sequence whose items are obtained -% by \texttt{x}-expanding \meta{loop~code} applied to a -% \meta{function} derived from the \meta{inline~code}. A -% \meta{function} is defined, that takes one argument, -% \texttt{x}-expands the \meta{inline~code} with that argument -% as~|#1|, then adds appropriate separators to turn the result into an -% item of the sequence. The \texttt{x}-expansion of \meta{loop~code} -% \meta{function} must result in successive calls to the -% \meta{function} with no nonexpandable tokens in between. The -% \meta{loop~code} must be expandable; it can be for example -% \cs{tl_map_function:NN} \meta{tl~var} or \cs{clist_map_function:nN} -% \Arg{clist} or \cs{int_step_function:nnnN} \Arg{initial value} -% \Arg{step} \Arg{final value}, but not the analogous \enquote{inline} -% mappings. -% \end{function} -% % \begin{function}[added = 2021-04-29, noTF] % {\seq_set_item:Nnn, \seq_set_item:cnn, \seq_gset_item:Nnn, \seq_gset_item:cnn} % \begin{syntax} @@ -408,87 +155,8 @@ % assigned locally for |pop| or globally for |gpop| functions. % \end{function} % -% \section{Additions to \pkg{l3sys}} -% -% \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str} -% The version string of the current engine, in the same form as -% given in the banner issued when running a job. For \pdfTeX{} -% and \LuaTeX{} this is of the form -% \begin{quote} -% \meta{major}.\meta{minor}.\meta{revision} -% \end{quote} -% For \XeTeX{}, the form is -% \begin{quote} -% \meta{major}.\meta{minor} -% \end{quote} -% For \pTeX{} and \upTeX{}, only releases since \TeX{} Live 2018 -% make the data available, and the form is more complex, as it comprises -% the \pTeX{} version, the \upTeX{} version and the e-\pTeX{} version. -% \begin{quote} -% p\meta{major}.\meta{minor}.\meta{revision}-u\meta{major}.\meta{minor}^^A -% -\meta{epTeX} -% \end{quote} -% where the |u| part is only present for \upTeX{}. -% \end{variable} -% -% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_rand_exist:} -% \begin{syntax} -% \cs{sys_if_rand_exist_p:} -% \cs{sys_if_rand_exist:TF} \Arg{true code} \Arg{false code} -% \end{syntax} -% Tests if the engine has a pseudo-random number generator. Currently -% this is the case in \pdfTeX{}, \LuaTeX{}, \pTeX{}, \upTeX{} and recent -% releases of \XeTeX{}. -% \end{function} -% % \section{Additions to \pkg{l3tl}} % -% \begin{function}[EXP, added = 2017-07-15] -% { -% \tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn, -% \tl_range_unbraced:Nnn, \tl_range_unbraced:cnn, \tl_range_unbraced:nnn -% } -% \begin{syntax} -% \cs{tl_range_braced:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} -% \cs{tl_range_braced:nnn} \Arg{token list} \Arg{start index} \Arg{end index} -% \cs{tl_range_unbraced:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} -% \cs{tl_range_unbraced:nnn} \Arg{token list} \Arg{start index} \Arg{end index} -% \end{syntax} -% Leaves in the input stream the items from the \meta{start index} to -% the \meta{end index} inclusive, using the same indexing as -% \cs{tl_range:nnn}. Spaces are ignored. Regardless of whether items -% appear with or without braces in the \meta{token list}, the -% \cs{tl_range_braced:nnn} function wraps each item in braces, while -% \cs{tl_range_unbraced:nnn} does not (overall it removes an outer set -% of braces). For instance, -% \begin{verbatim} -% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { 2 } { 5 } } -% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { -4 } { -1 } } -% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { -2 } { -1 } } -% \iow_term:x { \tl_range_braced:nnn { abcd~{e{}}f } { 0 } { -1 } } -% \end{verbatim} -% prints \verb*|{b}{c}{d}{e{}}|, \verb*|{c}{d}{e{}}{f}|, \verb*|{e{}}{f}|, and an empty -% line to the terminal, while -% \begin{verbatim} -% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { 2 } { 5 } } -% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { -4 } { -1 } } -% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { -2 } { -1 } } -% \iow_term:x { \tl_range_unbraced:nnn { abcd~{e{}}f } { 0 } { -1 } } -% \end{verbatim} -% prints \verb*|bcde{}|, \verb*|cde{}f|, \verb*|e{}f|, and an empty -% line to the terminal. Because braces are removed, the result of -% \cs{tl_range_unbraced:nnn} may have a different number of items as -% for \cs{tl_range:nnn} or \cs{tl_range_braced:nnn}. In cases where -% preserving spaces is important, consider the slower function -% \cs{tl_range:nnn}. -% \begin{texnote} -% The result is returned within the \tn{unexpanded} -% primitive (\cs{exp_not:n}), which means that the \meta{item} -% does not expand further when appearing in an \texttt{x}-type -% or \texttt{e}-type argument expansion. -% \end{texnote} -% \end{function} -% % \begin{function}[added = 2018-04-01]{\tl_build_begin:N, \tl_build_gbegin:N} % \begin{syntax} % \cs{tl_build_begin:N} \meta{tl~var} @@ -557,46 +225,6 @@ % \cs[no-index]{tl_build_\ldots{}} functions. % \end{function} % -% \section{Additions to \pkg{l3token}} -% -% \begin{variable}[added = 2017-08-07]{\c_catcode_active_space_tl} -% Token list containing one character with category code $13$, -% (\enquote{active}), and character code $32$ (space). -% \end{variable} -% -% \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} @@ -607,202 +235,6 @@ %<*package> % \end{macrocode} % -% \subsection{Additions to \pkg{l3flag}} -% -% \begin{macrocode} -%<@@=flag> -% \end{macrocode} -% -% \begin{macro}[EXP]{\flag_raise_if_clear:n} -% It might be faster to just call the \enquote{trap} function in all -% cases but conceptually the function name suggests we should only run -% it if the flag is zero in case the \enquote{trap} made customizable -% in the future. -% \begin{macrocode} -\cs_new:Npn \flag_raise_if_clear:n #1 - { - \if_cs_exist:w flag~#1~0 \cs_end: - \else: - \cs:w flag~#1 \cs_end: 0 ; - \fi: - } -% \end{macrocode} -% \end{macro} -% -% \subsection{Additions to \pkg{l3msg}} -% -% \begin{macrocode} -%<@@=msg> -% \end{macrocode} -% -% \begin{macro}{\msg_show_eval:Nn, \msg_log_eval:Nn, \@@_show_eval:nnN} -% A short-hand used for \cs{int_show:n} and similar functions that -% passes to \cs{tl_show:n} the result of applying |#1| (a -% function such as \cs{int_eval:n}) to the expression |#2|. The use of -% \texttt{f}-expansion ensures that |#1| is expanded in the scope in which the -% show command is called, rather than in the group created by -% \cs{iow_wrap:nnnN}. This is only important for expressions -% involving the \tn{currentgrouplevel} or \tn{currentgrouptype}. -% On the other hand we want the expression to be converted to a string -% with the usual escape character, hence within the wrapping code. -% \begin{macrocode} -\cs_new_protected:Npn \msg_show_eval:Nn #1#2 - { \exp_args:Nf \@@_show_eval:nnN { #1 {#2} } {#2} \tl_show:n } -\cs_new_protected:Npn \msg_log_eval:Nn #1#2 - { \exp_args:Nf \@@_show_eval:nnN { #1 {#2} } {#2} \tl_log:n } -\cs_new_protected:Npn \@@_show_eval:nnN #1#2#3 { #3 { #2 = #1 } } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP]{\msg_show_item:n} -% \begin{macro}[EXP]{\msg_show_item_unbraced:n} -% \begin{macro}[EXP]{\msg_show_item:nn} -% \begin{macro}[EXP]{\msg_show_item_unbraced:nn} -% Each item in the variable is formatted using one of the following -% functions. We cannot use |\\| and so on because these short-hands -% cannot be used inside the arguments of messages, only when defining -% the messages. -% \begin{macrocode} -\cs_new:Npx \msg_show_item:n #1 - { \iow_newline: > ~ \c_space_tl \exp_not:N \tl_to_str:n { {#1} } } -\cs_new:Npx \msg_show_item_unbraced:n #1 - { \iow_newline: > ~ \c_space_tl \exp_not:N \tl_to_str:n {#1} } -\cs_new:Npx \msg_show_item:nn #1#2 - { - \iow_newline: > \use:nn { ~ } { ~ } - \exp_not:N \tl_to_str:n { {#1} } - \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ } - \exp_not:N \tl_to_str:n { {#2} } - } -\cs_new:Npx \msg_show_item_unbraced:nn #1#2 - { - \iow_newline: > \use:nn { ~ } { ~ } - \exp_not:N \tl_to_str:n {#1} - \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ } - \exp_not:N \tl_to_str:n {#2} - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Additions to \pkg{l3prg}} -% -% \begin{macrocode} -%<@@=bool> -% \end{macrocode} -% -% \begin{macro}[added = 2018-05-10] -% {\bool_set_inverse:N, \bool_set_inverse:c, \bool_gset_inverse:N, \bool_gset_inverse:c} -% Set to \texttt{false} or \texttt{true} locally or globally. -% \begin{macrocode} -\cs_new_protected:Npn \bool_set_inverse:N #1 - { \bool_if:NTF #1 { \bool_set_false:N } { \bool_set_true:N } #1 } -\cs_generate_variant:Nn \bool_set_inverse:N { c } -\cs_new_protected:Npn \bool_gset_inverse:N #1 - { \bool_if:NTF #1 { \bool_gset_false:N } { \bool_gset_true:N } #1 } -\cs_generate_variant:Nn \bool_gset_inverse:N { c } -% \end{macrocode} -% \end{macro} -% -% \begin{variable}{\s_@@_mark,\s_@@_stop} -% Internal scan marks. -% \begin{macrocode} -\scan_new:N \s_@@_mark -\scan_new:N \s_@@_stop -% \end{macrocode} -% \end{variable} -% -% \begin{macro}[EXP, noTF]{\bool_case_true:n, \bool_case_false:n} -% \begin{macro}{\@@_case:NnTF} -% \begin{macro}{\@@_case_true:w, \@@_case_false:w, \@@_case_end:nw} -% For boolean cases the overall idea is the same as for -% \cs{tl_case:nnTF} as described in \pkg{l3tl}. -% \begin{macrocode} -\cs_new:Npn \bool_case_true:nTF - { \exp:w \@@_case:NnTF \c_true_bool } -\cs_new:Npn \bool_case_true:nT #1#2 - { \exp:w \@@_case:NnTF \c_true_bool {#1} {#2} { } } -\cs_new:Npn \bool_case_true:nF #1 - { \exp:w \@@_case:NnTF \c_true_bool {#1} { } } -\cs_new:Npn \bool_case_true:n #1 - { \exp:w \@@_case:NnTF \c_true_bool {#1} { } { } } -\cs_new:Npn \bool_case_false:nTF - { \exp:w \@@_case:NnTF \c_false_bool } -\cs_new:Npn \bool_case_false:nT #1#2 - { \exp:w \@@_case:NnTF \c_false_bool {#1} {#2} { } } -\cs_new:Npn \bool_case_false:nF #1 - { \exp:w \@@_case:NnTF \c_false_bool {#1} { } } -\cs_new:Npn \bool_case_false:n #1 - { \exp:w \@@_case:NnTF \c_false_bool {#1} { } { } } -\cs_new:Npn \@@_case:NnTF #1#2#3#4 - { - \bool_if:NTF #1 \@@_case_true:w \@@_case_false:w - #2 #1 { } \s_@@_mark {#3} \s_@@_mark {#4} \s_@@_stop - } -\cs_new:Npn \@@_case_true:w #1#2 - { - \bool_if:nTF {#1} - { \@@_case_end:nw {#2} } - { \@@_case_true:w } - } -\cs_new:Npn \@@_case_false:w #1#2 - { - \bool_if:nTF {#1} - { \@@_case_false:w } - { \@@_case_end:nw {#2} } - } -\cs_new:Npn \@@_case_end:nw #1#2#3 \s_@@_mark #4#5 \s_@@_stop - { \exp_end: #1 #4 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Additions to \pkg{l3prop}} -% -% \begin{macrocode} -%<@@=prop> -% \end{macrocode} -% -% \begin{macro}[EXP]{\@@_use_i_delimit_by_s_stop:nw} -% Functions to gobble up to a scan mark. -% \begin{macrocode} -\cs_new:Npn \@@_use_i_delimit_by_s_stop:nw #1 #2 \s_@@_stop {#1} -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP] -% {\prop_rand_key_value:N, \prop_rand_key_value:c} -% \begin{macro}[EXP]{\@@_rand_item:w} -% Contrarily to |clist|, |seq| and |tl|, there is no function to get -% an item of a |prop| given an integer between $1$ and the number of -% items, so we write the appropriate code. There is no bounds -% checking because \cs{int_rand:nn} is always within bounds. The -% initial \cs{int_value:w} is stopped by the first \cs{s_@@} in~|#1|. -% \begin{macrocode} -\cs_new:Npn \prop_rand_key_value:N #1 - { - \prop_if_empty:NF #1 - { - \exp_after:wN \@@_rand_item:w - \int_value:w \int_rand:nn { 1 } { \prop_count:N #1 } - #1 \s_@@_stop - } - } -\cs_generate_variant:Nn \prop_rand_key_value:N { c } -\cs_new:Npn \@@_rand_item:w #1 \s_@@ \@@_pair:wn #2 \s_@@ #3 - { - \int_compare:nNnF {#1} > 1 - { \@@_use_i_delimit_by_s_stop:nw { \exp_not:n { {#2} {#3} } } } - \exp_after:wN \@@_rand_item:w - \int_value:w \int_eval:n { #1 - 1 } \s_@@ - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Additions to \pkg{l3seq}} % % \begin{macrocode} @@ -880,35 +312,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\seq_set_from_inline_x:Nnn, \seq_gset_from_inline_x:Nnn} -% \begin{macro}{\@@_set_from_inline_x:NNnn} -% Set \cs{@@_item:n} then map it using the loop code. -% \begin{macrocode} -\cs_new_protected:Npn \seq_set_from_inline_x:Nnn - { \@@_set_from_inline_x:NNnn \__kernel_tl_set:Nx } -\cs_new_protected:Npn \seq_gset_from_inline_x:Nnn - { \@@_set_from_inline_x:NNnn \__kernel_tl_gset:Nx } -\cs_new_protected:Npn \@@_set_from_inline_x:NNnn #1#2#3#4 - { - \@@_push_item_def:n { \exp_not:N \@@_item:n {#4} } - #1 #2 { \s_@@ #3 \@@_item:n } - \@@_pop_item_def: - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\seq_set_from_function:NnN, \seq_gset_from_function:NnN} -% Reuse \cs{seq_set_from_inline_x:Nnn}. -% \begin{macrocode} -\cs_new_protected:Npn \seq_set_from_function:NnN #1#2#3 - { \seq_set_from_inline_x:Nnn #1 {#2} { #3 {##1} } } -\cs_new_protected:Npn \seq_gset_from_function:NnN #1#2#3 - { \seq_gset_from_inline_x:Nnn #1 {#2} { #3 {##1} } } -% \end{macrocode} -% \end{macro} -% -% % \begin{macro}{\@@_int_eval:w} % Useful to more quickly go through items. % \begin{macrocode} @@ -1079,114 +482,6 @@ % \end{macro} % \end{macro} % -% \subsection{Additions to \pkg{l3sys}} -% -% \begin{macrocode} -%<@@=sys> -% \end{macrocode} -% -% \begin{variable}{\c_sys_engine_version_str} -% Various different engines, various different ways to extract the -% data! -% \begin{macrocode} -\str_const:Nx \c_sys_engine_version_str - { - \str_case:on \c_sys_engine_str - { - { pdftex } - { - \int_div_truncate:nn { \tex_pdftexversion:D } { 100 } - . - \int_mod:nn { \tex_pdftexversion:D } { 100 } - . - \tex_pdftexrevision:D - } - { ptex } - { - \cs_if_exist:NT \tex_ptexversion:D - { - p - \int_use:N \tex_ptexversion:D - . - \int_use:N \tex_ptexminorversion:D - \tex_ptexrevision:D - - - \int_use:N \tex_epTeXversion:D - } - } - { luatex } - { - \int_div_truncate:nn { \tex_luatexversion:D } { 100 } - . - \int_mod:nn { \tex_luatexversion:D } { 100 } - . - \tex_luatexrevision:D - } - { uptex } - { - \cs_if_exist:NT \tex_ptexversion:D - { - p - \int_use:N \tex_ptexversion:D - . - \int_use:N \tex_ptexminorversion:D - \tex_ptexrevision:D - - - u - \int_use:N \tex_uptexversion:D - \tex_uptexrevision:D - - - \int_use:N \tex_epTeXversion:D - } - } - { xetex } - { - \int_use:N \tex_XeTeXversion:D - \tex_XeTeXrevision:D - } - } - } -% \end{macrocode} -% \end{variable} -% -% \subsection{Additions to \pkg{l3file}} -% -% \begin{macrocode} -%<@@=ior> -% \end{macrocode} -% -% \begin{macro}{\ior_shell_open:Nn} -% \begin{macro}{\@@_shell_open:nN} -% Actually much easier than either the standard open or input versions! -% When calling \cs{__kernel_ior_open:Nn} the file the pipe is added to -% signal a shell command, but the quotes are not added yet---they are -% added later by \cs{__kernel_file_name_quote:n}. -% \begin{macrocode} -\cs_new_protected:Npn \ior_shell_open:Nn #1#2 - { - \sys_if_shell:TF - { \exp_args:No \@@_shell_open:nN { \tl_to_str:n {#2} } #1 } - { \msg_error:nn { ior } { pipe-failed } } - } -\cs_new_protected:Npn \@@_shell_open:nN #1#2 - { - \tl_if_in:nnTF {#1} { " } - { - \msg_error:nnx - { kernel } { quote-in-shell } {#1} - } - { \__kernel_ior_open:Nn #2 { |#1 } } - } -\msg_new:nnnn { ior } { pipe-failed } - { Cannot~run~piped~system~commands. } - { - LaTeX~tried~to~call~a~system~process~but~this~was~not~possible.\\ - Try~the~"--shell-escape"~(or~"--enable-pipes")~option. - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \subsection{Additions to \pkg{l3tl}} % % \subsubsection{Building a token list} @@ -1409,161 +704,6 @@ % \end{macrocode} % \end{macro} % -% \subsubsection{Other additions to \pkg{l3tl}} -% -% \begin{macro}{\tl_range_braced:Nnn, \tl_range_braced:cnn, \tl_range_braced:nnn} -% \begin{macro} -% {\tl_range_unbraced:Nnn, \tl_range_unbraced:cnn, \tl_range_unbraced:nnn} -% \begin{macro} -% { -% \@@_range_braced:w, \@@_range_collect_braced:w, -% \@@_range_unbraced:w, \@@_range_collect_unbraced:w, -% } -% For the braced version \cs{@@_range_braced:w} sets up -% \cs{@@_range_collect_braced:w} which stores items one by one in an -% argument after the semicolon. The unbraced version is almost -% identical. The version preserving braces and spaces starts by -% deleting spaces before the argument to avoid collecting them, and -% sets up \cs{@@_range_collect:nn} with a first argument of the form -% |{| \Arg{collected} \meta{tokens} |}|, whose head is the collected -% tokens and whose tail is what remains of the original token list. -% This form makes it easier to move tokens to the \meta{collected} -% tokens. -% \begin{macrocode} -\cs_new:Npn \tl_range_braced:Nnn { \exp_args:No \tl_range_braced:nnn } -\cs_generate_variant:Nn \tl_range_braced:Nnn { c } -\cs_new:Npn \tl_range_braced:nnn { \@@_range:Nnnn \@@_range_braced:w } -\cs_new:Npn \tl_range_unbraced:Nnn - { \exp_args:No \tl_range_unbraced:nnn } -\cs_generate_variant:Nn \tl_range_unbraced:Nnn { c } -\cs_new:Npn \tl_range_unbraced:nnn - { \@@_range:Nnnn \@@_range_unbraced:w } -\cs_new:Npn \@@_range_braced:w #1 ; #2 - { \@@_range_collect_braced:w #1 ; { } #2 } -\cs_new:Npn \@@_range_unbraced:w #1 ; #2 - { \@@_range_collect_unbraced:w #1 ; { } #2 } -\cs_new:Npn \@@_range_collect_braced:w #1 ; #2#3 - { - \if_int_compare:w #1 > \c_one_int - \exp_after:wN \@@_range_collect_braced:w - \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; - \fi: - { #2 {#3} } - } -\cs_new:Npn \@@_range_collect_unbraced:w #1 ; #2#3 - { - \if_int_compare:w #1 > \c_one_int - \exp_after:wN \@@_range_collect_unbraced:w - \int_value:w \int_eval:n { #1 - 1 } \exp_after:wN ; - \fi: - { #2 #3 } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \subsection{Additions to \pkg{l3token}} -% -% \begin{variable}{\c_catcode_active_space_tl} -% While \cs{char_generate:nn} can produce active characters in some -% engines it cannot in general. It would be possible to simply change -% the catcode of space but then the code would need to avoid all -% spaces, making it quite unreadable. Instead we use the primitive -% \cs{tex_lowercase:D} trick. -% \begin{macrocode} -\group_begin: - \char_set_catcode_active:N * - \char_set_lccode:nn { `* } { `\ } - \tex_lowercase:D { \tl_const:Nn \c_catcode_active_space_tl { * } } -\group_end: -% \end{macrocode} -% \end{variable} -% -% \begin{macrocode} -%<@@=peek> -% \end{macrocode} -% -% \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} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3cctab.dtx b/macros/latex/contrib/l3kernel/l3cctab.dtx index 8ae5d43cfb..e379c5406a 100644 --- a/macros/latex/contrib/l3kernel/l3cctab.dtx +++ b/macros/latex/contrib/l3kernel/l3cctab.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3clist.dtx b/macros/latex/contrib/l3kernel/l3clist.dtx index fd949c6ba9..1aaeb46384 100644 --- a/macros/latex/contrib/l3kernel/l3clist.dtx +++ b/macros/latex/contrib/l3kernel/l3clist.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3coffins.dtx b/macros/latex/contrib/l3kernel/l3coffins.dtx index c3d3116ba3..0d64025010 100644 --- a/macros/latex/contrib/l3kernel/l3coffins.dtx +++ b/macros/latex/contrib/l3kernel/l3coffins.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3color.dtx b/macros/latex/contrib/l3kernel/l3color.dtx index 36d4cfe178..a38773626f 100644 --- a/macros/latex/contrib/l3kernel/l3color.dtx +++ b/macros/latex/contrib/l3kernel/l3color.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3debug.dtx b/macros/latex/contrib/l3kernel/l3debug.dtx index 2d2e31d28e..b189c0e9ec 100644 --- a/macros/latex/contrib/l3kernel/l3debug.dtx +++ b/macros/latex/contrib/l3kernel/l3debug.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -954,7 +954,7 @@ \flag_if_raised:nTF \flag_if_raised_p:n \flag_height:n - \flag_raise_if_clear:n + \flag_ensure_raised:n \flag_clear:n } % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3deprecation.dtx b/macros/latex/contrib/l3kernel/l3deprecation.dtx index 790a511e45..3e4bbca6d5 100644 --- a/macros/latex/contrib/l3kernel/l3deprecation.dtx +++ b/macros/latex/contrib/l3kernel/l3deprecation.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -447,6 +447,25 @@ % \end{macrocode} % \end{macro} % +% \subsection{Deprecated \pkg{l3prg} functions} +% +% \begin{macrocode} +%<@@=cs> +% \end{macrocode} +% +% \begin{macro}[EXP, noTF]{\bool_case_true:n} +% \begin{macrocode} +\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:n } +\cs_gset:Npn \bool_case_true:n { \bool_case:n } +\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:nT } +\cs_gset:Npn \bool_case_true:nT { \bool_case:nT } +\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:nF } +\cs_gset:Npn \bool_case_true:nF { \bool_case:nF } +\__kernel_patch_deprecation:nnNNpn { 2023-05-03 } { \bool_case_true:nTF } +\cs_gset:Npn \bool_case_true:nTF { \bool_case:nTF } +% \end{macrocode} +% \end{macro} +% % \subsection{Deprecated \pkg{l3str} functions} % % \begin{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3doc.dtx b/macros/latex/contrib/l3kernel/l3doc.dtx index 4b477da007..c2b095f919 100644 --- a/macros/latex/contrib/l3kernel/l3doc.dtx +++ b/macros/latex/contrib/l3kernel/l3doc.dtx @@ -85,7 +85,7 @@ and all files in that bundle must be distributed together. % require you to do updates, if the class changes.}} % % \author{\Team} -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % \maketitle % \tableofcontents % diff --git a/macros/latex/contrib/l3kernel/l3doc.pdf b/macros/latex/contrib/l3kernel/l3doc.pdf Binary files differindex 87935262fa..ee26574500 100644 --- a/macros/latex/contrib/l3kernel/l3doc.pdf +++ b/macros/latex/contrib/l3kernel/l3doc.pdf diff --git a/macros/latex/contrib/l3kernel/l3docstrip.dtx b/macros/latex/contrib/l3kernel/l3docstrip.dtx index df53dc09f3..1431a78d3c 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.dtx +++ b/macros/latex/contrib/l3kernel/l3docstrip.dtx @@ -63,7 +63,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3docstrip.pdf b/macros/latex/contrib/l3kernel/l3docstrip.pdf Binary files differindex 0a54452672..bd8eb0411e 100644 --- a/macros/latex/contrib/l3kernel/l3docstrip.pdf +++ b/macros/latex/contrib/l3kernel/l3docstrip.pdf diff --git a/macros/latex/contrib/l3kernel/l3expan.dtx b/macros/latex/contrib/l3kernel/l3expan.dtx index b01149ee04..55f0b65159 100644 --- a/macros/latex/contrib/l3kernel/l3expan.dtx +++ b/macros/latex/contrib/l3kernel/l3expan.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -180,6 +180,20 @@ % functions explicitly is preferred to defining confusing variants. % \end{function} % +% \begin{function}[added = 2018-04-04, updated = 2019-02-08] +% {\exp_args_generate:n} +% \begin{syntax} +% \cs{exp_args_generate:n} \Arg{variant argument specifiers} +% \end{syntax} +% Defines \cs[no-index]{exp_args:N\meta{variant}} functions for each +% \meta{variant} given in the comma list \Arg{variant argument +% specifiers}. Each \meta{variant} should consist of the letters |N|, +% |c|, |n|, |V|, |v|, |o|, |f|, |e|, |x|, |p| and the resulting function is +% protected if the letter |x| appears in the \meta{variant}. This is +% only useful for cases where \cs{cs_generate_variant:Nn} is not +% applicable. +% \end{function} +% % \section{Introducing the variants} % % The |V| type returns the value of a register, which can be one of diff --git a/macros/latex/contrib/l3kernel/l3file.dtx b/macros/latex/contrib/l3kernel/l3file.dtx index 5d7a60824f..4d1b0660b7 100644 --- a/macros/latex/contrib/l3kernel/l3file.dtx +++ b/macros/latex/contrib/l3kernel/l3file.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -140,6 +140,23 @@ % additive). % \end{function} % +% \begin{function}[added = 2019-05-08]{\ior_shell_open:Nn} +% \begin{syntax} +% \cs{ior_shell_open:Nn} \meta{stream} \Arg{shell~command} +% \end{syntax} +% Opens the \emph{pseudo}-file created by the output of the +% \meta{shell command} for reading using \meta{stream} as the +% control sequence for access. If the \meta{stream} was already +% open it is closed before the new operation begins. The +% \meta{stream} is available for access immediately and will remain +% allocated to \meta{shell command} until a \cs{ior_close:N} instruction +% is given or the \TeX{} run ends. +% If piped system calls are disabled an error is raised. +% +% For details of handling of the \meta{shell command}, see +% \cs{sys_get_shell:nnNTF}. +% \end{function} +% % \begin{function}[updated = 2012-07-31] % {\ior_close:N, \ior_close:c, \iow_close:N, \iow_close:c} % \begin{syntax} @@ -390,6 +407,26 @@ % the \meta{stream} is not open. % \end{function} % +% \subsection{Reading from the terminal} +% +% \begin{function}[added = 2019-03-23]{\ior_get_term:nN, \ior_str_get_term:nN} +% \begin{syntax} +% \cs{ior_get_term:nN} \meta{prompt} \meta{token list variable} +% \end{syntax} +% Function that reads one or more lines (until an equal number of left +% and right braces are found) from the terminal and stores +% the result locally in the \meta{token list} variable. Tokenization +% occurs as described for \cs{ior_get:NN} or \cs{ior_str_get:NN}, respectively. +% When the \meta{prompt} +% is empty, \TeX{} will wait for input without any other indication: +% typically the programmer will have provided a suitable text using +% e.g.~\cs{iow_term:n}. Where the \meta{prompt} is given, it will appear +% in the terminal followed by an |=|, e.g. +% \begin{verbatim} +% prompt= +% \end{verbatim} +% \end{function} +% % \subsection{Writing to files} % % \begin{function}[updated = 2012-06-05]{\iow_now:Nn, \iow_now:Nx, \iow_now:cn, \iow_now:cx} @@ -516,8 +553,8 @@ % (for example after a control sequence), % \item |\#|, |\%|, |\{|, |\}|, |\~| may be used to represent % the corresponding character, -% \item \cs{iow_allow_break:} may be used to allow a line-break -% without inserting a space (this is experimental), +% \item \cs{iow_wrap_allow_break:} may be used to allow a line-break +% without inserting a space, % \item \cs{iow_indent:n} may be used to indent a part of the % \meta{text} (not the \meta{run-on text}). % \end{itemize} @@ -547,6 +584,15 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2023-04-25]{\iow_wrap_allow_break:} +% \begin{syntax} +% \cs{iow_wrap_allow_break:} +% \end{syntax} +% In the first argument of \cs{iow_wrap:nnnN} (for instance in +% messages), inserts a break-point that allows a line break. If +% no break occurs, this function adds nothing to the output. +% \end{function} +% % \begin{function}[added = 2011-09-21]{\iow_indent:n} % \begin{syntax} % \cs{iow_indent:n} \Arg{text} @@ -1111,6 +1157,38 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\ior_shell_open:Nn} +% \begin{macro}{\@@_shell_open:nN} +% Actually much easier than either the standard open or input versions! +% When calling \cs{__kernel_ior_open:Nn} the file the pipe is added to +% signal a shell command, but the quotes are not added yet---they are +% added later by \cs{__kernel_file_name_quote:n}. +% \begin{macrocode} +\cs_new_protected:Npn \ior_shell_open:Nn #1#2 + { + \sys_if_shell:TF + { \exp_args:No \@@_shell_open:nN { \tl_to_str:n {#2} } #1 } + { \msg_error:nn { ior } { pipe-failed } } + } +\cs_new_protected:Npn \@@_shell_open:nN #1#2 + { + \tl_if_in:nnTF {#1} { " } + { + \msg_error:nnx + { kernel } { quote-in-shell } {#1} + } + { \__kernel_ior_open:Nn #2 { |#1 } } + } +\msg_new:nnnn { ior } { pipe-failed } + { Cannot~run~piped~system~commands. } + { + LaTeX~tried~to~call~a~system~process~but~this~was~not~possible.\\ + Try~the~"--shell-escape"~(or~"--enable-pipes")~option. + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\ior_close:N, \ior_close:c} % Closing a stream means getting rid of it at the \TeX{} level and % removing from the various data structures. Unless the name passed @@ -1846,24 +1924,24 @@ % \end{variable} % \end{variable} % -% \begin{macro}{\iow_allow_break:} -% \begin{macro}[EXP]{\@@_allow_break:} -% \begin{macro}[EXP]{\@@_allow_break_error:} -% We set \cs{iow_allow_break:n} to produce an error when outside -% messages. Within wrapped message, it is set to \cs{@@_allow_break:} -% when valid and otherwise to \cs{@@_allow_break_error:}. The second +% \begin{macro}{\iow_wrap_allow_break:} +% \begin{macro}[EXP]{\@@_wrap_allow_break:} +% \begin{macro}[EXP]{\@@_wrap_allow_break_error:} +% We set \cs{iow_wrap_allow_break:n} to produce an error when outside +% messages. Within wrapped message, it is set to \cs{@@_wrap_allow_break:} +% when valid and otherwise to \cs{@@_wrap_allow_break_error:}. The second % produces an error expandably. % \begin{macrocode} -\cs_new_protected:Npn \iow_allow_break: +\cs_new_protected:Npn \iow_wrap_allow_break: { \msg_error:nnnn { kernel } { iow-indent } - { \iow_wrap:nnnN } { \iow_allow_break: } + { \iow_wrap:nnnN } { \iow_wrap_allow_break: } } -\cs_new:Npx \@@_allow_break: { \c_@@_wrap_allow_break_marker_tl } -\cs_new:Npn \@@_allow_break_error: +\cs_new:Npx \@@_wrap_allow_break: { \c_@@_wrap_allow_break_marker_tl } +\cs_new:Npn \@@_wrap_allow_break_error: { \msg_expandable_error:nnnn { kernel } { iow-indent } - { \iow_wrap:nnnN } { \iow_allow_break: } + { \iow_wrap:nnnN } { \iow_wrap_allow_break: } } % \end{macrocode} % \end{macro} @@ -1928,7 +2006,7 @@ \int_set:Nn \tex_escapechar:D { 92 } \cs_set_eq:NN \\ \iow_newline: \cs_set_eq:NN \ \c_catcode_other_space_tl - \cs_set_eq:NN \iow_allow_break: \@@_allow_break: + \cs_set_eq:NN \iow_wrap_allow_break: \@@_wrap_allow_break: \cs_set_eq:NN \iow_indent:n \@@_indent:n #3 % \end{macrocode} @@ -1941,7 +2019,7 @@ % \begin{macrocode} \cs_set_eq:NN \protect \token_to_str:N \__kernel_tl_set:Nx \l_@@_wrap_tl {#1} - \cs_set_eq:NN \iow_allow_break: \@@_allow_break_error: + \cs_set_eq:NN \iow_wrap_allow_break: \@@_wrap_allow_break_error: \cs_set_eq:NN \iow_indent:n \@@_indent_error:n % \end{macrocode} % Afterwards, set the newline marker (two assignments to fully expand, diff --git a/macros/latex/contrib/l3kernel/l3flag.dtx b/macros/latex/contrib/l3kernel/l3flag.dtx index bbc4453f05..98f74360d0 100644 --- a/macros/latex/contrib/l3kernel/l3flag.dtx +++ b/macros/latex/contrib/l3kernel/l3flag.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -152,6 +152,14 @@ % The \meta{flag}'s height is increased by $1$ locally. % \end{function} % +% \begin{function}[EXP, added = 2023-04-25]{\flag_ensure_raised:n} +% \begin{syntax} +% \cs{flag_ensure_raised:n} \Arg{flag name} +% \end{syntax} +% Ensures the \meta{flag} is raised by making its height at least~$1$, +% locally. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -299,6 +307,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[EXP]{\flag_ensure_raised:n} +% It might be faster to just call the \enquote{trap} function in all +% cases but conceptually the function name suggests we should only run +% it if the flag is zero in case the \enquote{trap} made customizable +% in the future. +% \begin{macrocode} +\cs_new:Npn \flag_ensure_raised:n #1 + { + \if_cs_exist:w flag~#1~0 \cs_end: + \else: + \cs:w flag~#1 \cs_end: 0 ; + \fi: + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} %</package> % \end{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3fp-assign.dtx b/macros/latex/contrib/l3kernel/l3fp-assign.dtx index 7d571fe460..03c018eec4 100644 --- a/macros/latex/contrib/l3kernel/l3fp-assign.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-assign.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % \maketitle % % \begin{documentation} @@ -200,9 +200,9 @@ % Use general tools. % \begin{macrocode} \cs_new_protected:Npn \fp_show:n - { \msg_show_eval:Nn \fp_to_tl:n } + { \__kernel_msg_show_eval:Nn \fp_to_tl:n } \cs_new_protected:Npn \fp_log:n - { \msg_log_eval:Nn \fp_to_tl:n } + { \__kernel_msg_log_eval:Nn \fp_to_tl:n } % \end{macrocode} % \end{macro} % diff --git a/macros/latex/contrib/l3kernel/l3fp-aux.dtx b/macros/latex/contrib/l3kernel/l3fp-aux.dtx index 01b9e1f5f4..dcd9442da6 100644 --- a/macros/latex/contrib/l3kernel/l3fp-aux.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-aux.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-basics.dtx b/macros/latex/contrib/l3kernel/l3fp-basics.dtx index 6bc8ca10eb..c9275deea4 100644 --- a/macros/latex/contrib/l3kernel/l3fp-basics.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-basics.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-convert.dtx b/macros/latex/contrib/l3kernel/l3fp-convert.dtx index b24812c13e..a9cf9298e7 100644 --- a/macros/latex/contrib/l3kernel/l3fp-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-convert.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-expo.dtx b/macros/latex/contrib/l3kernel/l3fp-expo.dtx index c039c6f70b..d80f06d201 100644 --- a/macros/latex/contrib/l3kernel/l3fp-expo.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-expo.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-extended.dtx b/macros/latex/contrib/l3kernel/l3fp-extended.dtx index 0c0d34cee0..1b87ecdc1b 100644 --- a/macros/latex/contrib/l3kernel/l3fp-extended.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-extended.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-logic.dtx b/macros/latex/contrib/l3kernel/l3fp-logic.dtx index 7d007b70f1..cdbdb96f77 100644 --- a/macros/latex/contrib/l3kernel/l3fp-logic.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-logic.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-parse.dtx b/macros/latex/contrib/l3kernel/l3fp-parse.dtx index ed2520fc4e..4f745b04a3 100644 --- a/macros/latex/contrib/l3kernel/l3fp-parse.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-parse.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-random.dtx b/macros/latex/contrib/l3kernel/l3fp-random.dtx index ba0a9a8e23..94313834ba 100644 --- a/macros/latex/contrib/l3kernel/l3fp-random.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-random.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -73,37 +73,6 @@ % % \subsection{Engine support} % -% Most engines provide random numbers, but not all. We write the test -% twice simply in order to write the \texttt{false} branch first. -% \begin{macrocode} -\sys_if_rand_exist:F - { - \msg_new:nnn { kernel } { fp-no-random } - { Random~numbers~unavailable~for~#1 } - \cs_new:Npn \@@_rand_o:Nw ? #1 @ - { - \msg_expandable_error:nnn { kernel } { fp-no-random } - { fp~rand } - \exp_after:wN \c_nan_fp - } - \cs_new_eq:NN \@@_randint_o:Nw \@@_rand_o:Nw - \cs_new:Npn \int_rand:nn #1#2 - { - \msg_expandable_error:nnn { kernel } { fp-no-random } - { \int_rand:nn {#1} {#2} } - \int_eval:n {#1} - } - \cs_new:Npn \int_rand:n #1 - { - \msg_expandable_error:nnn { kernel } { fp-no-random } - { \int_rand:n {#1} } - 1 - } - } -\sys_if_rand_exist:T - { -% \end{macrocode} -% % Obviously, every word \enquote{random} below means % \enquote{pseudo-random}, as we have no access to entropy (except a % very unreliable source of entropy: the time it takes to run some @@ -271,7 +240,7 @@ % Constant equal to $2^{17}-1$, the maximal size of a range that % \cs{int_range:nn} can do with its \enquote{simple} algorithm. % \begin{macrocode} - \int_const:Nn \c__kernel_randint_max_int { 131071 } +\int_const:Nn \c__kernel_randint_max_int { 131071 } % \end{macrocode} % \end{variable} % @@ -284,11 +253,11 @@ % $\operatorname{ediv}(p-2^{13},2^{14})$ but that wrongly gives $-1$ % for $p=0$. % \begin{macrocode} - \cs_new:Npn \__kernel_randint:n #1 - { - (#1 * \tex_uniformdeviate:D 16384 - + \tex_uniformdeviate:D #1 + 8192 ) / 16384 - } +\cs_new:Npn \__kernel_randint:n #1 + { + (#1 * \tex_uniformdeviate:D 16384 + + \tex_uniformdeviate:D #1 + 8192 ) / 16384 + } % \end{macrocode} % \end{macro} % @@ -300,17 +269,17 @@ % four (pseudo-random) digits. Digits are produced as a random number % in $[10000,19999]$ for the usual reason of preserving leading zeros. % \begin{macrocode} - \cs_new:Npn \@@_rand_myriads:n #1 - { \@@_rand_myriads_loop:w #1 \prg_break: X \prg_break_point: ; } - \cs_new:Npn \@@_rand_myriads_loop:w #1 X - { - #1 - \exp_after:wN \@@_rand_myriads_get:w - \int_value:w \@@_int_eval:w 9999 + - \__kernel_randint:n { 10000 } - \@@_rand_myriads_loop:w - } - \cs_new:Npn \@@_rand_myriads_get:w 1 #1 ; { ; {#1} } +\cs_new:Npn \@@_rand_myriads:n #1 + { \@@_rand_myriads_loop:w #1 \prg_break: X \prg_break_point: ; } +\cs_new:Npn \@@_rand_myriads_loop:w #1 X + { + #1 + \exp_after:wN \@@_rand_myriads_get:w + \int_value:w \@@_int_eval:w 9999 + + \__kernel_randint:n { 10000 } + \@@_rand_myriads_loop:w + } +\cs_new:Npn \@@_rand_myriads_get:w 1 #1 ; { ; {#1} } % \end{macrocode} % \end{macro} % @@ -324,27 +293,27 @@ % is correctly~$0$ but it raises the \texttt{underflow} flag; it % should not do that. % \begin{macrocode} - \cs_new:Npn \@@_rand_o:Nw ? #1 @ +\cs_new:Npn \@@_rand_o:Nw ? #1 @ + { + \tl_if_empty:nTF {#1} { - \tl_if_empty:nTF {#1} - { - \exp_after:wN \@@_rand_o:w - \exp:w \exp_end_continue_f:w - \@@_rand_myriads:n { XXXX } { 0000 } { 0000 } ; 0 - } - { - \msg_expandable_error:nnnnn - { fp } { num-args } { rand() } { 0 } { 0 } - \exp_after:wN \c_nan_fp - } + \exp_after:wN \@@_rand_o:w + \exp:w \exp_end_continue_f:w + \@@_rand_myriads:n { XXXX } { 0000 } { 0000 } ; 0 } - \cs_new:Npn \@@_rand_o:w ; { - \exp_after:wN \@@_sanitize:Nw - \exp_after:wN 0 - \int_value:w \@@_int_eval:w \c_zero_int - \@@_fixed_to_float_o:wN + \msg_expandable_error:nnnnn + { fp } { num-args } { rand() } { 0 } { 0 } + \exp_after:wN \c_nan_fp } + } +\cs_new:Npn \@@_rand_o:w ; + { + \exp_after:wN \@@_sanitize:Nw + \exp_after:wN 0 + \int_value:w \@@_int_eval:w \c_zero_int + \@@_fixed_to_float_o:wN + } % \end{macrocode} % \end{macro} % @@ -382,115 +351,115 @@ % numbers (namely $10^{16}$ to the integers they represent), except % of course when it is time to convert back to a float. % \begin{macrocode} - \cs_new:Npn \@@_randint_o:Nw ? - { - \@@_parse_function_one_two:nnw - { randint } - { \@@_randint_default:w \@@_randint_o:w } - } - \cs_new:Npn \@@_randint_default:w #1 { \exp_after:wN #1 \c_one_fp } - \cs_new:Npn \@@_randint_badarg:w \s_@@ \@@_chk:w #1#2#3; - { - \@@_int:wTF \s_@@ \@@_chk:w #1#2#3; - { - \if_meaning:w 1 #1 - \if_int_compare:w - \@@_use_i_until_s:nw #3 ; > \c_@@_prec_int - \c_one_int - \fi: - \fi: - } - { \c_one_int } - } - \cs_new:Npn \@@_randint_o:w #1; #2; @ - { - \if_case:w - \@@_randint_badarg:w #1; - \@@_randint_badarg:w #2; - \if:w 1 \@@_compare_back:ww #2; #1; \c_one_int \fi: - \c_zero_int - \@@_randint_auxi_o:ww #1; #2; - \or: - \@@_invalid_operation_tl_o:ff - { randint } { \@@_array_to_clist:n { #1; #2; } } - \exp:w - \fi: - \exp_after:wN \exp_end: - } - \cs_new:Npn \@@_randint_auxi_o:ww #1 ; #2 ; #3 \exp_end: - { - \fi: - \@@_randint_auxii:wn #2 ; - { \@@_randint_auxii:wn #1 ; \@@_randint_auxiii_o:ww } - } - \cs_new:Npn \@@_randint_auxii:wn \s_@@ \@@_chk:w #1#2#3#4 ; - { - \if_meaning:w 0 #1 - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - { \exp_after:wN \@@_fixed_continue:wn \c_@@_one_fixed_tl } - { - \exp_after:wN \@@_ep_to_fixed:wwn - \int_value:w \@@_int_eval:w - #3 - \c_@@_prec_int , #4 {0000} {0000} ; - { - \if_meaning:w 0 #2 - \exp_after:wN \use_i:nnnn - \exp_after:wN \@@_fixed_add_one:wN - \fi: - \exp_after:wN \@@_fixed_sub:wwn \c_@@_one_fixed_tl - } - \@@_fixed_continue:wn - } - } - \cs_new:Npn \@@_randint_auxiii_o:ww #1 ; #2 ; - { - \@@_fixed_add:wwn #2 ; - {0000} {0000} {0000} {0001} {0000} {0000} ; - \@@_fixed_sub:wwn #1 ; - { - \exp_after:wN \use_i:nn - \exp_after:wN \@@_fixed_mul_add:wwwn - \exp:w \exp_end_continue_f:w \@@_rand_myriads:n { XXXXXX } ; - } - #1 ; - \@@_randint_auxiv_o:ww - #2 ; - \@@_randint_auxv_o:w #1 ; @ - } - \cs_new:Npn \@@_randint_auxiv_o:ww #1#2#3#4#5 ; #6#7#8#9 +\cs_new:Npn \@@_randint_o:Nw ? + { + \@@_parse_function_one_two:nnw + { randint } + { \@@_randint_default:w \@@_randint_o:w } + } +\cs_new:Npn \@@_randint_default:w #1 { \exp_after:wN #1 \c_one_fp } +\cs_new:Npn \@@_randint_badarg:w \s_@@ \@@_chk:w #1#2#3; + { + \@@_int:wTF \s_@@ \@@_chk:w #1#2#3; { - \if_int_compare:w - \if_int_compare:w #1#2 > #6#7 \exp_stop_f: 1 \else: - \if_int_compare:w #1#2 < #6#7 \exp_stop_f: - \fi: \fi: - #3#4 > #8#9 \exp_stop_f: - \@@_use_i_until_s:nw + \if_meaning:w 1 #1 + \if_int_compare:w + \@@_use_i_until_s:nw #3 ; > \c_@@_prec_int + \c_one_int + \fi: \fi: - \@@_randint_auxv_o:w {#1}{#2}{#3}{#4}#5 } - \cs_new:Npn \@@_randint_auxv_o:w #1#2#3#4#5 ; #6 @ + { \c_one_int } + } +\cs_new:Npn \@@_randint_o:w #1; #2; @ + { + \if_case:w + \@@_randint_badarg:w #1; + \@@_randint_badarg:w #2; + \if:w 1 \@@_compare_back:ww #2; #1; \c_one_int \fi: + \c_zero_int + \@@_randint_auxi_o:ww #1; #2; + \or: + \@@_invalid_operation_tl_o:ff + { randint } { \@@_array_to_clist:n { #1; #2; } } + \exp:w + \fi: + \exp_after:wN \exp_end: + } +\cs_new:Npn \@@_randint_auxi_o:ww #1 ; #2 ; #3 \exp_end: + { + \fi: + \@@_randint_auxii:wn #2 ; + { \@@_randint_auxii:wn #1 ; \@@_randint_auxiii_o:ww } + } +\cs_new:Npn \@@_randint_auxii:wn \s_@@ \@@_chk:w #1#2#3#4 ; + { + \if_meaning:w 0 #1 + \exp_after:wN \use_i:nn + \else: + \exp_after:wN \use_ii:nn + \fi: + { \exp_after:wN \@@_fixed_continue:wn \c_@@_one_fixed_tl } + { + \exp_after:wN \@@_ep_to_fixed:wwn + \int_value:w \@@_int_eval:w + #3 - \c_@@_prec_int , #4 {0000} {0000} ; { - \exp_after:wN \@@_sanitize:Nw - \int_value:w - \if_int_compare:w #1 < 10000 \exp_stop_f: - 2 - \else: - 0 - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_reverse_args:Nww + \if_meaning:w 0 #2 + \exp_after:wN \use_i:nnnn + \exp_after:wN \@@_fixed_add_one:wN \fi: \exp_after:wN \@@_fixed_sub:wwn \c_@@_one_fixed_tl - {#1} {#2} {#3} {#4} {0000} {0000} ; - { - \exp_after:wN \exp_stop_f: - \int_value:w \@@_int_eval:w \c_@@_prec_int - \@@_fixed_to_float_o:wN - } - 0 - \exp:w \exp_after:wN \exp_end: } + \@@_fixed_continue:wn + } + } +\cs_new:Npn \@@_randint_auxiii_o:ww #1 ; #2 ; + { + \@@_fixed_add:wwn #2 ; + {0000} {0000} {0000} {0001} {0000} {0000} ; + \@@_fixed_sub:wwn #1 ; + { + \exp_after:wN \use_i:nn + \exp_after:wN \@@_fixed_mul_add:wwwn + \exp:w \exp_end_continue_f:w \@@_rand_myriads:n { XXXXXX } ; + } + #1 ; + \@@_randint_auxiv_o:ww + #2 ; + \@@_randint_auxv_o:w #1 ; @ + } +\cs_new:Npn \@@_randint_auxiv_o:ww #1#2#3#4#5 ; #6#7#8#9 + { + \if_int_compare:w + \if_int_compare:w #1#2 > #6#7 \exp_stop_f: 1 \else: + \if_int_compare:w #1#2 < #6#7 \exp_stop_f: - \fi: \fi: + #3#4 > #8#9 \exp_stop_f: + \@@_use_i_until_s:nw + \fi: + \@@_randint_auxv_o:w {#1}{#2}{#3}{#4}#5 + } +\cs_new:Npn \@@_randint_auxv_o:w #1#2#3#4#5 ; #6 @ + { + \exp_after:wN \@@_sanitize:Nw + \int_value:w + \if_int_compare:w #1 < 10000 \exp_stop_f: + 2 + \else: + 0 + \exp_after:wN \exp_after:wN + \exp_after:wN \@@_reverse_args:Nww + \fi: + \exp_after:wN \@@_fixed_sub:wwn \c_@@_one_fixed_tl + {#1} {#2} {#3} {#4} {0000} {0000} ; + { + \exp_after:wN \exp_stop_f: + \int_value:w \@@_int_eval:w \c_@@_prec_int + \@@_fixed_to_float_o:wN + } + 0 + \exp:w \exp_after:wN \exp_end: + } % \end{macrocode} % \end{macro} % \end{macro} @@ -504,38 +473,38 @@ % where \meta{choices} is the number of possible outcomes. If the % range is wide, use somewhat slower code. % \begin{macrocode} - \cs_new:Npn \int_rand:nn #1#2 +\cs_new:Npn \int_rand:nn #1#2 + { + \int_eval:n { - \int_eval:n - { - \exp_after:wN \@@_randint:ww - \int_value:w \int_eval:n {#1} \exp_after:wN ; - \int_value:w \int_eval:n {#2} ; - } + \exp_after:wN \@@_randint:ww + \int_value:w \int_eval:n {#1} \exp_after:wN ; + \int_value:w \int_eval:n {#2} ; } - \cs_new:Npn \@@_randint:ww #1; #2; - { - \if_int_compare:w #1 > #2 \exp_stop_f: - \msg_expandable_error:nnnn - { kernel } { randint-backward-range } {#1} {#2} - \@@_randint:ww #2; #1; - \else: - \if_int_compare:w \@@_int_eval:w #2 - \if_int_compare:w #1 > \c_zero_int - - #1 < \@@_int_eval:w - \else: - < \@@_int_eval:w #1 + - \fi: - \c__kernel_randint_max_int - \@@_int_eval_end: - \__kernel_randint:n - { \@@_int_eval:w #2 - #1 + 1 \@@_int_eval_end: } - - 1 + #1 + } +\cs_new:Npn \@@_randint:ww #1; #2; + { + \if_int_compare:w #1 > #2 \exp_stop_f: + \msg_expandable_error:nnnn + { kernel } { randint-backward-range } {#1} {#2} + \@@_randint:ww #2; #1; + \else: + \if_int_compare:w \@@_int_eval:w #2 + \if_int_compare:w #1 > \c_zero_int + - #1 < \@@_int_eval:w \else: - \__kernel_randint:nn {#1} {#2} + < \@@_int_eval:w #1 + \fi: - \fi: - } + \c__kernel_randint_max_int + \@@_int_eval_end: + \__kernel_randint:n + { \@@_int_eval:w #2 - #1 + 1 \@@_int_eval_end: } + - 1 + #1 + \else: + \__kernel_randint:nn {#1} {#2} + \fi: + \fi: + } % \end{macrocode} % \end{macro} % @@ -557,101 +526,95 @@ % \meta{Y_1}|;|\meta{Y_0}|;| \meta{R_2}|;|\meta{R_1}|;|\meta{R_0}|;.| % and we apply the algorithm described earlier. % \begin{macrocode} - \cs_new:Npn \__kernel_randint:nn #1#2 - { - #1 - \exp_after:wN \@@_randint_wide_aux:w - \int_value:w - \exp_after:wN \@@_randint_split_o:Nw - \tex_uniformdeviate:D 268435456 ; - \int_value:w - \exp_after:wN \@@_randint_split_o:Nw - \tex_uniformdeviate:D 268435456 ; +\cs_new:Npn \__kernel_randint:nn #1#2 + { + #1 + \exp_after:wN \@@_randint_wide_aux:w + \int_value:w + \exp_after:wN \@@_randint_split_o:Nw + \tex_uniformdeviate:D 268435456 ; + \int_value:w + \exp_after:wN \@@_randint_split_o:Nw + \tex_uniformdeviate:D 268435456 ; + \int_value:w + \exp_after:wN \@@_randint_split_o:Nw + \int_value:w \@@_int_eval:w 131072 + + \exp_after:wN \@@_randint_split_o:Nw \int_value:w - \exp_after:wN \@@_randint_split_o:Nw - \int_value:w \@@_int_eval:w 131072 + - \exp_after:wN \@@_randint_split_o:Nw - \int_value:w - \__kernel_int_add:nnn {#2} { -#1 } { -\c_max_int } ; - . - } - \cs_new:Npn \@@_randint_split_o:Nw #1#2 ; - { - \if_meaning:w 0 #1 - 0 \exp_after:wN ; \int_value:w 0 - \else: - \exp_after:wN \@@_randint_split_aux:w - \int_value:w \@@_int_eval:w (#1#2 - 8192) / 16384 ; - + #1#2 - \fi: - \exp_after:wN ; - } - \cs_new:Npn \@@_randint_split_aux:w #1 ; - { - #1 \exp_after:wN ; - \int_value:w \@@_int_eval:w - #1 * 16384 - } - \cs_new:Npn \@@_randint_wide_aux:w #1;#2; #3;#4; #5;#6;#7; . - { - \exp_after:wN \@@_randint_wide_auxii:w - \int_value:w \@@_int_eval:w #5 * #3 + #6 * #1 + - (#5 * #4 + #6 * #3 + #7 * #1 + - (#5 * #2 + #7 * #3 + - (16384 * #6 + #7) * (16384 * #4 + #2) / 268435456) / 16384 - ) / 16384 \exp_after:wN ; - \int_value:w \@@_int_eval:w (#5 + #6) * 16384 + #7 ; - #1 ; #5 ; - } - \cs_new:Npn \@@_randint_wide_auxii:w #1; #2; #3; #4; - { - \if_int_odd:w 0 - \if_int_compare:w #1 = #2 \else: \exp_stop_f: \fi: - \if_int_compare:w #4 = \c_zero_int 1 \fi: - \if_int_compare:w #3 = 16383 ~ 1 \fi: - \exp_stop_f: - \exp_after:wN \prg_break: - \fi: - \if_int_compare:w #4 < 8 \exp_stop_f: - + #4 * #3 * 16384 - \else: - + 8 * #3 * 16384 + (#4 - 8) * #3 * 16384 - \fi: - + #1 - \prg_break_point: - } + \__kernel_int_add:nnn {#2} { -#1 } { -\c_max_int } ; + . + } +\cs_new:Npn \@@_randint_split_o:Nw #1#2 ; + { + \if_meaning:w 0 #1 + 0 \exp_after:wN ; \int_value:w 0 + \else: + \exp_after:wN \@@_randint_split_aux:w + \int_value:w \@@_int_eval:w (#1#2 - 8192) / 16384 ; + + #1#2 + \fi: + \exp_after:wN ; + } +\cs_new:Npn \@@_randint_split_aux:w #1 ; + { + #1 \exp_after:wN ; + \int_value:w \@@_int_eval:w - #1 * 16384 + } +\cs_new:Npn \@@_randint_wide_aux:w #1;#2; #3;#4; #5;#6;#7; . + { + \exp_after:wN \@@_randint_wide_auxii:w + \int_value:w \@@_int_eval:w #5 * #3 + #6 * #1 + + (#5 * #4 + #6 * #3 + #7 * #1 + + (#5 * #2 + #7 * #3 + + (16384 * #6 + #7) * (16384 * #4 + #2) / 268435456) / 16384 + ) / 16384 \exp_after:wN ; + \int_value:w \@@_int_eval:w (#5 + #6) * 16384 + #7 ; + #1 ; #5 ; + } +\cs_new:Npn \@@_randint_wide_auxii:w #1; #2; #3; #4; + { + \if_int_odd:w 0 + \if_int_compare:w #1 = #2 \else: \exp_stop_f: \fi: + \if_int_compare:w #4 = \c_zero_int 1 \fi: + \if_int_compare:w #3 = 16383 ~ 1 \fi: + \exp_stop_f: + \exp_after:wN \prg_break: + \fi: + \if_int_compare:w #4 < 8 \exp_stop_f: + + #4 * #3 * 16384 + \else: + + 8 * #3 * 16384 + (#4 - 8) * #3 * 16384 + \fi: + + #1 + \prg_break_point: + } % \end{macrocode} % \end{macro} % % \begin{macro}{\int_rand:n, \@@_randint:n} % Similar to \cs{int_rand:nn}, but needs fewer checks. % \begin{macrocode} - \cs_new:Npn \int_rand:n #1 - { - \int_eval:n - { \exp_args:Nf \@@_randint:n { \int_eval:n {#1} } } - } - \cs_new:Npn \@@_randint:n #1 - { - \if_int_compare:w #1 < \c_one_int - \msg_expandable_error:nnnn - { kernel } { randint-backward-range } { 1 } {#1} - \@@_randint:ww #1; 1; - \else: - \if_int_compare:w #1 > \c__kernel_randint_max_int - \__kernel_randint:nn { 1 } {#1} - \else: - \__kernel_randint:n {#1} - \fi: - \fi: - } -% \end{macrocode} -% \end{macro} -% -% End the initial conditional that ensures these commands are only -% defined in engines that support random numbers. -% \begin{macrocode} +\cs_new:Npn \int_rand:n #1 + { + \int_eval:n + { \exp_args:Nf \@@_randint:n { \int_eval:n {#1} } } + } +\cs_new:Npn \@@_randint:n #1 + { + \if_int_compare:w #1 < \c_one_int + \msg_expandable_error:nnnn + { kernel } { randint-backward-range } { 1 } {#1} + \@@_randint:ww #1; 1; + \else: + \if_int_compare:w #1 > \c__kernel_randint_max_int + \__kernel_randint:nn { 1 } {#1} + \else: + \__kernel_randint:n {#1} + \fi: + \fi: } % \end{macrocode} +% \end{macro} % % \begin{macrocode} %</package> diff --git a/macros/latex/contrib/l3kernel/l3fp-round.dtx b/macros/latex/contrib/l3kernel/l3fp-round.dtx index d6117c166e..4e0f7fcd8f 100644 --- a/macros/latex/contrib/l3kernel/l3fp-round.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-round.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp-traps.dtx b/macros/latex/contrib/l3kernel/l3fp-traps.dtx index c6af74af44..6ece565727 100644 --- a/macros/latex/contrib/l3kernel/l3fp-traps.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-traps.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % \maketitle % % \begin{documentation} @@ -165,7 +165,7 @@ { #1 \@@_error:nnfn { invalid } {##2} { \fp_to_tl:n { ##3; } } { } - \flag_raise_if_clear:n { fp_invalid_operation } + \flag_ensure_raised:n { fp_invalid_operation } ##1 } \exp_args:Nno \use:n @@ -174,7 +174,7 @@ #1 \@@_error:nffn { invalid-ii } { \fp_to_tl:n { ##2; } } { \fp_to_tl:n { ##3; } } {##1} - \flag_raise_if_clear:n { fp_invalid_operation } + \flag_ensure_raised:n { fp_invalid_operation } \exp_after:wN \c_nan_fp } \exp_args:Nno \use:n @@ -182,7 +182,7 @@ { #1 \@@_error:nffn { invalid } {##1} {##2} { } - \flag_raise_if_clear:n { fp_invalid_operation } + \flag_ensure_raised:n { fp_invalid_operation } \exp_after:wN \c_nan_fp } } @@ -215,7 +215,7 @@ { #1 \@@_error:nnfn { zero-div } {##2} { \fp_to_tl:n { ##3; } } { } - \flag_raise_if_clear:n { fp_division_by_zero } + \flag_ensure_raised:n { fp_division_by_zero } \exp_after:wN ##1 } \exp_args:Nno \use:n @@ -224,7 +224,7 @@ #1 \@@_error:nffn { zero-div-ii } { \fp_to_tl:n { ##3; } } { \fp_to_tl:n { ##4; } } {##2} - \flag_raise_if_clear:n { fp_division_by_zero } + \flag_ensure_raised:n { fp_division_by_zero } \exp_after:wN ##1 } } @@ -287,7 +287,7 @@ { \fp_to_tl:n { \s_@@ \@@_chk:w ##1##2##3; } } { \token_if_eq_meaning:NNF 0 ##2 { - } #4 } {#2} - \flag_raise_if_clear:n { fp_#2 } + \flag_ensure_raised:n { fp_#2 } #3 ##2 } } diff --git a/macros/latex/contrib/l3kernel/l3fp-trig.dtx b/macros/latex/contrib/l3kernel/l3fp-trig.dtx index b3b955191d..bb6192a8c8 100644 --- a/macros/latex/contrib/l3kernel/l3fp-trig.dtx +++ b/macros/latex/contrib/l3kernel/l3fp-trig.dtx @@ -40,7 +40,7 @@ % {latex-team@latex-project.org}^^A % }^^A % } -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3fp.dtx b/macros/latex/contrib/l3kernel/l3fp.dtx index 8bd82ea2cb..b7ee984fa7 100644 --- a/macros/latex/contrib/l3kernel/l3fp.dtx +++ b/macros/latex/contrib/l3kernel/l3fp.dtx @@ -49,7 +49,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -476,6 +476,15 @@ % slightly slower. % \end{function} % +% \begin{function}[pTF, added = 2019-08-25]{\fp_if_nan:n} +% \begin{syntax} +% \cs{fp_if_nan:n} \Arg{fp expr} +% \end{syntax} +% Evaluates the \meta{fp expr} and tests whether the result is exactly +% \nan{}. The test returns \texttt{false} for any other result, even +% a tuple containing \nan{}. +% \end{function} +% % \section{Floating point expression loops} % % \begin{function}[rEXP, added = 2012-08-16, tested = m3fp-logic003] diff --git a/macros/latex/contrib/l3kernel/l3fparray.dtx b/macros/latex/contrib/l3kernel/l3fparray.dtx index f49eb427be..fbd5758a5c 100644 --- a/macros/latex/contrib/l3kernel/l3fparray.dtx +++ b/macros/latex/contrib/l3kernel/l3fparray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3int.dtx b/macros/latex/contrib/l3kernel/l3int.dtx index 387c5b4916..bdfa2a6385 100644 --- a/macros/latex/contrib/l3kernel/l3int.dtx +++ b/macros/latex/contrib/l3kernel/l3int.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -2555,7 +2555,7 @@ % expressions: this gives a more unified output. % \begin{macrocode} \cs_new_protected:Npn \int_show:n - { \msg_show_eval:Nn \int_eval:n } + { \__kernel_msg_show_eval:Nn \int_eval:n } % \end{macrocode} % \end{macro} % @@ -2571,7 +2571,7 @@ % Similar to \cs{int_show:n}. % \begin{macrocode} \cs_new_protected:Npn \int_log:n - { \msg_log_eval:Nn \int_eval:n } + { \__kernel_msg_log_eval:Nn \int_eval:n } % \end{macrocode} % \end{macro} % diff --git a/macros/latex/contrib/l3kernel/l3intarray.dtx b/macros/latex/contrib/l3kernel/l3intarray.dtx index bc521e41f2..d2af694015 100644 --- a/macros/latex/contrib/l3kernel/l3intarray.dtx +++ b/macros/latex/contrib/l3kernel/l3intarray.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -495,7 +495,6 @@ end, 'global') % \end{macrocode} % \end{macro} % -% \begin{macro}[rEXP]{\intarray_to_clist:N, \intarray_to_clist:c} % \begin{macro}[rEXP]{\@@_to_clist:Nn, \@@_to_clist:w} % The \cs{@@_to_clist:Nn} auxiliary allows to choose the delimiter and % is also used in \cs{intarray_show:N}. Here we just pass the information @@ -504,8 +503,6 @@ end, 'global') % an issue since the delimiter is always just a comma or a comma and a space. % In both cases \texttt{sprint(2, ...)} provides the right catcodes. % \begin{macrocode} - \cs_new:Npn \intarray_to_clist:N #1 { \@@_to_clist:Nn #1 { , } } - \cs_generate_variant:Nn \intarray_to_clist:N { c } %</tex> %<*lua> local concat = table.concat @@ -517,7 +514,6 @@ end, 'global') %</lua> % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}[rEXP]{\__kernel_intarray_range_to_clist:Nnn, \@@_range_to_clist:w} % Loop through part of the array. @@ -840,14 +836,11 @@ luacmd('@@_gset_range:w', function() % \end{macro} % \end{macro} % -% \begin{macro}[rEXP]{\intarray_to_clist:N, \intarray_to_clist:c} % \begin{macro}[rEXP]{\@@_to_clist:Nn, \@@_to_clist:w} % Loop through the array, putting a comma before each item. Remove % the leading comma with |f|-expansion. We also use the auxiliary in % \cs{intarray_show:N} with argument comma, space. % \begin{macrocode} - \cs_new:Npn \intarray_to_clist:N #1 { \@@_to_clist:Nn #1 { , } } - \cs_generate_variant:Nn \intarray_to_clist:N { c } \cs_new:Npn \@@_to_clist:Nn #1#2 { \int_compare:nNnF { \intarray_count:N #1 } = \c_zero_int @@ -867,7 +860,6 @@ luacmd('@@_gset_range:w', function() } % \end{macrocode} % \end{macro} -% \end{macro} % % \begin{macro}[rEXP]{\__kernel_intarray_range_to_clist:Nnn, \@@_range_to_clist:ww} % Loop through part of the array. @@ -941,102 +933,6 @@ luacmd('@@_gset_range:w', function() % \end{macrocode} % \end{macro} % -% \subsubsection{Random arrays} -% -% \begin{macro}{\intarray_gset_rand:Nn, \intarray_gset_rand:cn} -% \begin{macro}{\intarray_gset_rand:Nnn, \intarray_gset_rand:cnn} -% \begin{macro} -% { -% \@@_gset_rand:Nnn, -% \@@_gset_rand:Nff, -% \@@_gset_rand_auxi:Nnnn, -% \@@_gset_rand_auxii:Nnnn, -% \@@_gset_rand_auxiii:Nnnn, -% \@@_gset_all_same:Nn, -% } -% We only perform the bounds checks once. This is done by two -% \cs{@@_gset_overflow_test:nw}, with an appropriate empty argument to -% avoid a spurious \enquote{at position \texttt{\#1}} part in the -% error message. Then calculate the number of choices: this is at -% most $(2^{30}-1)-(-(2^{30}-1))+1=2^{31}-1$, which just barely does -% not overflow. For small ranges use \cs{__kernel_randint:n} (making -% sure to subtract~$1$ \emph{before} adding the random number to the -% \meta{min}, to avoid overflow when \meta{min} or \meta{max} are -% $\pm\cs{c_max_int}$), otherwise \cs{__kernel_randint:nn}. Finally, -% if there are no random numbers do not define any of the auxiliaries. -% \begin{macrocode} -\cs_new_protected:Npn \intarray_gset_rand:Nn #1 - { \intarray_gset_rand:Nnn #1 { 1 } } -\cs_generate_variant:Nn \intarray_gset_rand:Nn { c } -\sys_if_rand_exist:TF - { - \cs_new_protected:Npn \intarray_gset_rand:Nnn #1#2#3 - { - \@@_gset_rand:Nff #1 - { \int_eval:n {#2} } { \int_eval:n {#3} } - } - \cs_new_protected:Npn \@@_gset_rand:Nnn #1#2#3 - { - \int_compare:nNnTF {#2} > {#3} - { - \msg_expandable_error:nnnn - { kernel } { randint-backward-range } {#2} {#3} - \@@_gset_rand:Nnn #1 {#3} {#2} - } - { - \@@_gset_overflow_test:nw {#2} - \@@_gset_rand_auxi:Nnnn #1 { } {#2} {#3} - } - } - \cs_generate_variant:Nn \@@_gset_rand:Nnn { Nff } - \cs_new_protected:Npn \@@_gset_rand_auxi:Nnnn #1#2#3#4 - { - \@@_gset_overflow_test:nw {#4} - \@@_gset_rand_auxii:Nnnn #1 { } {#4} {#3} - } - \cs_new_protected:Npn \@@_gset_rand_auxii:Nnnn #1#2#3#4 - { - \exp_args:NNf \@@_gset_rand_auxiii:Nnnn #1 - { \int_eval:n { #3 - #4 + 1 } } {#4} {#3} - } - \cs_new_protected:Npn \@@_gset_rand_auxiii:Nnnn #1#2#3#4 - { - \exp_args:NNf \@@_gset_all_same:Nn #1 - { - \int_compare:nNnTF {#2} > \c__kernel_randint_max_int - { - \exp_stop_f: - \int_eval:n { \__kernel_randint:nn {#3} {#4} } - } - { - \exp_stop_f: - \int_eval:n { \__kernel_randint:n {#2} - 1 + #3 } - } - } - } - \cs_new_protected:Npn \@@_gset_all_same:Nn #1#2 - { - \int_zero:N \l_@@_loop_int - \prg_replicate:nn { \intarray_count:N #1 } - { - \int_incr:N \l_@@_loop_int - \__kernel_intarray_gset:Nnn #1 \l_@@_loop_int {#2} - } - } - } - { - \cs_new_protected:Npn \intarray_gset_rand:Nnn #1#2#3 - { - \msg_error:nnn { kernel } { fp-no-random } - { \intarray_gset_rand:Nnn #1 {#2} {#3} } - } - } -\cs_generate_variant:Nn \intarray_gset_rand:Nnn { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macrocode} %</tex> %</package> diff --git a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx index 0e997b8008..35441b1fdb 100644 --- a/macros/latex/contrib/l3kernel/l3kernel-functions.dtx +++ b/macros/latex/contrib/l3kernel/l3kernel-functions.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -296,6 +296,17 @@ % Inserts a kern of the specified \meta{length}, a dimension expression. % \end{variable} % +% \begin{function}{\__kernel_msg_show_eval:Nn, \__kernel_msg_log_eval:Nn} +% \begin{syntax} +% \cs{__kernel_msg_show_eval:Nn} \meta{function} \Arg{expression} +% \end{syntax} +% Shows or logs the \meta{expression} (turned into a string), an equal +% sign, and the result of applying the \meta{function} to the +% \Arg{expression} (with \texttt{f}-expansion). For instance, if the +% \meta{function} is \cs{int_eval:n} and the \meta{expression} is +% |1+2| then this logs |> 1+2=3.| +% \end{function} +% % \begin{variable}{\g__kernel_prg_map_int} % This integer is used by non-expandable mapping functions to track % the level of nesting in force. The functions diff --git a/macros/latex/contrib/l3kernel/l3keys.dtx b/macros/latex/contrib/l3kernel/l3keys.dtx index 66a223e101..4d5faa2af5 100644 --- a/macros/latex/contrib/l3kernel/l3keys.dtx +++ b/macros/latex/contrib/l3kernel/l3keys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3legacy.dtx b/macros/latex/contrib/l3kernel/l3legacy.dtx index 57ce66e990..c3024b4fba 100644 --- a/macros/latex/contrib/l3kernel/l3legacy.dtx +++ b/macros/latex/contrib/l3kernel/l3legacy.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3luatex.dtx b/macros/latex/contrib/l3kernel/l3luatex.dtx index 5c77d703c8..cd31d0ebe2 100644 --- a/macros/latex/contrib/l3kernel/l3luatex.dtx +++ b/macros/latex/contrib/l3kernel/l3luatex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3msg.dtx b/macros/latex/contrib/l3kernel/l3msg.dtx index e8f3723833..f2705cf8bc 100644 --- a/macros/latex/contrib/l3kernel/l3msg.dtx +++ b/macros/latex/contrib/l3kernel/l3msg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -496,6 +496,35 @@ % present. % \end{function} % +% \begin{function}[EXP, added = 2017-12-04] +% {\msg_show_item:n, \msg_show_item_unbraced:n, \msg_show_item:nn, \msg_show_item_unbraced:nn} +% \begin{syntax} +% \cs{seq_map_function:NN} \meta{seq} \cs{msg_show_item:n} +% \cs{prop_map_function:NN} \meta{prop} \cs{msg_show_item:nn} +% \end{syntax} +% Used in the text of messages for \cs{msg_show:nnxxxx} to show or log +% a list of items or key--value pairs. The output of +% \cs{msg_show_item:n} produces a newline, the prefix |>|, two spaces, +% then the braced string representation of its argument. +% The two-argument versions separates the key and value using +% \verb*| => |, and the \texttt{unbraced} versions don't print the +% surrounding braces. +% +% These functions are suitable for usage with iterator functions like +% \cs{seq_map_function:NN}, \cs{prop_map_function:NN}, etc. For +% example, with a sequence \cs[no-index]{l_tmpa_seq} containing |a|, +% |{b}| and |\c|, +% \begin{verbatim} +% \seq_map_function:NN \l_tmpa_seq \msg_show_item:n +% \end{verbatim} +% would expand to three lines: +% \begin{quotation} +% \noindent\verb*|> {a}|\\ +% \verb*|> {{b}}|\\ +% \verb*|> {\c }| +% \end{quotation} +% \end{function} +% % \subsection{Expandable error messages} % % In very rare cases it may be necessary to produce errors in an @@ -1382,6 +1411,40 @@ \group_end: % \end{macrocode} % +% \begin{macro}[EXP]{\msg_show_item:n} +% \begin{macro}[EXP]{\msg_show_item_unbraced:n} +% \begin{macro}[EXP]{\msg_show_item:nn} +% \begin{macro}[EXP]{\msg_show_item_unbraced:nn} +% Each item in the variable is formatted using one of the following +% functions. We cannot use |\\| and so on because these short-hands +% cannot be used inside the arguments of messages, only when defining +% the messages. We need to use |^^J| here directly as \pkg{l3file} is +% not yet loaded. +% \begin{macrocode} +\cs_new:Npx \msg_show_item:n #1 + { ^^J > ~ \c_space_tl \exp_not:N \tl_to_str:n { {#1} } } +\cs_new:Npx \msg_show_item_unbraced:n #1 + { ^^J > ~ \c_space_tl \exp_not:N \tl_to_str:n {#1} } +\cs_new:Npx \msg_show_item:nn #1#2 + { + ^^J > \use:nn { ~ } { ~ } + \exp_not:N \tl_to_str:n { {#1} } + \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ } + \exp_not:N \tl_to_str:n { {#2} } + } +\cs_new:Npx \msg_show_item_unbraced:nn #1#2 + { + ^^J > \use:nn { ~ } { ~ } + \exp_not:N \tl_to_str:n {#1} + \use:nn { ~ } { ~ } => \use:nn { ~ } { ~ } + \exp_not:N \tl_to_str:n {#2} + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% % \begin{macro}{\@@_class_chk_exist:nT} % Checking that a message class exists. We build this from % \cs{cs_if_free:cTF} rather than \cs{cs_if_exist:cTF} because that @@ -1634,6 +1697,25 @@ % % \subsection{Kernel-specific functions} % +% \begin{macro}{\__kernel_msg_show_eval:Nn, \__kernel_msg_log_eval:Nn, \@@_show_eval:nnN} +% A short-hand used for \cs{int_show:n} and similar functions that +% passes to \cs{tl_show:n} the result of applying |#1| (a +% function such as \cs{int_eval:n}) to the expression |#2|. The use of +% \texttt{f}-expansion ensures that |#1| is expanded in the scope in which the +% show command is called, rather than in the group created by +% \cs{iow_wrap:nnnN}. This is only important for expressions +% involving the \tn{currentgrouplevel} or \tn{currentgrouptype}. +% On the other hand we want the expression to be converted to a string +% with the usual escape character, hence within the wrapping code. +% \begin{macrocode} +\cs_new_protected:Npn \__kernel_msg_show_eval:Nn #1#2 + { \exp_args:Nf \@@_show_eval:nnN { #1 {#2} } {#2} \tl_show:n } +\cs_new_protected:Npn \__kernel_msg_log_eval:Nn #1#2 + { \exp_args:Nf \@@_show_eval:nnN { #1 {#2} } {#2} \tl_log:n } +\cs_new_protected:Npn \@@_show_eval:nnN #1#2#3 { #3 { #2 = #1 } } +% \end{macrocode} +% \end{macro} +% % These are all retained purely for older \pkg{xparse} support. % % \begin{macro}{\__kernel_msg_new:nnnn, \__kernel_msg_new:nnn} diff --git a/macros/latex/contrib/l3kernel/l3names.dtx b/macros/latex/contrib/l3kernel/l3names.dtx index 62d6f9438c..7a04a58b0b 100644 --- a/macros/latex/contrib/l3kernel/l3names.dtx +++ b/macros/latex/contrib/l3kernel/l3names.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3news.pdf b/macros/latex/contrib/l3kernel/l3news.pdf Binary files differindex 493f8dfb13..bc190a368d 100644 --- a/macros/latex/contrib/l3kernel/l3news.pdf +++ b/macros/latex/contrib/l3kernel/l3news.pdf diff --git a/macros/latex/contrib/l3kernel/l3news01.pdf b/macros/latex/contrib/l3kernel/l3news01.pdf Binary files differindex 1a12b238b3..156a7a5378 100644 --- a/macros/latex/contrib/l3kernel/l3news01.pdf +++ b/macros/latex/contrib/l3kernel/l3news01.pdf diff --git a/macros/latex/contrib/l3kernel/l3news02.pdf b/macros/latex/contrib/l3kernel/l3news02.pdf Binary files differindex 40cea25f0d..5831b805d8 100644 --- a/macros/latex/contrib/l3kernel/l3news02.pdf +++ b/macros/latex/contrib/l3kernel/l3news02.pdf diff --git a/macros/latex/contrib/l3kernel/l3news03.pdf b/macros/latex/contrib/l3kernel/l3news03.pdf Binary files differindex 63ae313dab..d36a7cc5db 100644 --- a/macros/latex/contrib/l3kernel/l3news03.pdf +++ b/macros/latex/contrib/l3kernel/l3news03.pdf diff --git a/macros/latex/contrib/l3kernel/l3news04.pdf b/macros/latex/contrib/l3kernel/l3news04.pdf Binary files differindex d77981d7b8..2d7a417810 100644 --- a/macros/latex/contrib/l3kernel/l3news04.pdf +++ b/macros/latex/contrib/l3kernel/l3news04.pdf diff --git a/macros/latex/contrib/l3kernel/l3news05.pdf b/macros/latex/contrib/l3kernel/l3news05.pdf Binary files differindex 5ecae2ec1a..c40b6b1ac5 100644 --- a/macros/latex/contrib/l3kernel/l3news05.pdf +++ b/macros/latex/contrib/l3kernel/l3news05.pdf diff --git a/macros/latex/contrib/l3kernel/l3news06.pdf b/macros/latex/contrib/l3kernel/l3news06.pdf Binary files differindex 0e2478eea0..f974a19833 100644 --- a/macros/latex/contrib/l3kernel/l3news06.pdf +++ b/macros/latex/contrib/l3kernel/l3news06.pdf diff --git a/macros/latex/contrib/l3kernel/l3news07.pdf b/macros/latex/contrib/l3kernel/l3news07.pdf Binary files differindex b3a5fe57b1..2074566cda 100644 --- a/macros/latex/contrib/l3kernel/l3news07.pdf +++ b/macros/latex/contrib/l3kernel/l3news07.pdf diff --git a/macros/latex/contrib/l3kernel/l3news08.pdf b/macros/latex/contrib/l3kernel/l3news08.pdf Binary files differindex 408590fae6..50c2eb1947 100644 --- a/macros/latex/contrib/l3kernel/l3news08.pdf +++ b/macros/latex/contrib/l3kernel/l3news08.pdf diff --git a/macros/latex/contrib/l3kernel/l3news09.pdf b/macros/latex/contrib/l3kernel/l3news09.pdf Binary files differindex fd8e8224dc..241159b270 100644 --- a/macros/latex/contrib/l3kernel/l3news09.pdf +++ b/macros/latex/contrib/l3kernel/l3news09.pdf diff --git a/macros/latex/contrib/l3kernel/l3news10.pdf b/macros/latex/contrib/l3kernel/l3news10.pdf Binary files differindex aa11e82c32..0dec104832 100644 --- a/macros/latex/contrib/l3kernel/l3news10.pdf +++ b/macros/latex/contrib/l3kernel/l3news10.pdf diff --git a/macros/latex/contrib/l3kernel/l3news11.pdf b/macros/latex/contrib/l3kernel/l3news11.pdf Binary files differindex 3f576f07be..e4f69d06f8 100644 --- a/macros/latex/contrib/l3kernel/l3news11.pdf +++ b/macros/latex/contrib/l3kernel/l3news11.pdf diff --git a/macros/latex/contrib/l3kernel/l3news12.pdf b/macros/latex/contrib/l3kernel/l3news12.pdf Binary files differindex 7962c74d53..7c5d4bdd4a 100644 --- a/macros/latex/contrib/l3kernel/l3news12.pdf +++ b/macros/latex/contrib/l3kernel/l3news12.pdf diff --git a/macros/latex/contrib/l3kernel/l3pdf.dtx b/macros/latex/contrib/l3kernel/l3pdf.dtx index 12953c06f3..aa22e82215 100644 --- a/macros/latex/contrib/l3kernel/l3pdf.dtx +++ b/macros/latex/contrib/l3kernel/l3pdf.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3prefixes.pdf b/macros/latex/contrib/l3kernel/l3prefixes.pdf Binary files differindex 7552a57b18..1b0b196286 100644 --- a/macros/latex/contrib/l3kernel/l3prefixes.pdf +++ b/macros/latex/contrib/l3kernel/l3prefixes.pdf diff --git a/macros/latex/contrib/l3kernel/l3prg.dtx b/macros/latex/contrib/l3kernel/l3prg.dtx index e8e4bbf4f1..1324b1eb42 100644 --- a/macros/latex/contrib/l3kernel/l3prg.dtx +++ b/macros/latex/contrib/l3kernel/l3prg.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -304,6 +304,18 @@ % the logical truth of this evaluation. % \end{function} % +% \begin{function}[added = 2018-05-10] +% { +% \bool_set_inverse:N , \bool_set_inverse:c , +% \bool_gset_inverse:N, \bool_gset_inverse:c +% } +% \begin{syntax} +% \cs{bool_set_inverse:N} \meta{boolean} +% \end{syntax} +% Toggles the \meta{boolean} from \texttt{true} to \texttt{false} and +% conversely: sets it to the inverse of its current value. +% \end{function} +% % \begin{function}[EXP,pTF, updated = 2017-07-15]{\bool_if:N, \bool_if:c} % \begin{syntax} % \cs{bool_if_p:N} \meta{boolean} @@ -625,6 +637,45 @@ % then loops until the \meta{boolean expression} is \texttt{false}. % \end{function} % +% \begin{function}[added = 2023-05-03, EXP, noTF]{\bool_case:n} +% \begin{syntax} +% \cs{bool_case:nTF} \\ +% ~~|{| \\ +% ~~~~\Arg{boolexpr case_1} \Arg{code case_1} \\ +% ~~~~\Arg{boolexpr case_2} \Arg{code case_2} \\ +% ~~~~\ldots \\ +% ~~~~\Arg{boolexpr case_n} \Arg{code case_n} \\ +% ~~|}| \\ +% ~~\Arg{true code} +% ~~\Arg{false code} +% \end{syntax} +% Evaluates in turn each of the \meta{boolean expression cases} until +% the first one that evaluates to \texttt{true}. +% The \meta{code} associated to this first case is left in the input +% stream, followed by the \meta{true code}, and other cases are +% discarded. If none of the cases match then only the \meta{false +% code} is inserted. The function \cs{bool_case_true:n}, +% which does nothing if there is no match, is +% also available. For example +% \begin{verbatim} +% \bool_case:nF +% { +% { \dim_compare_p:n { \l__mypkg_wd_dim <= 10pt } } +% { Fits } +% { \int_compare_p:n { \l__mypkg_total_int >= 10 } } +% { Many } +% { \l__mypkg_special_bool } +% { Special } +% } +% { No idea! } +% \end{verbatim} +% leaves \enquote{\texttt{Fits}} or \enquote{\texttt{Many}} or +% \enquote{\texttt{Special}} or \enquote{\texttt{No idea!}} in the +% input stream, in a way similar to some other language's +% \enquote{\texttt{if} \ldots\ \texttt{elseif} \ldots\ \texttt{elseif} \ldots\ +% \texttt{else} \ldots}. +% \end{function} +% % \section{Producing multiple copies} % % \begin{function}[updated = 2011-07-04, EXP]{\prg_replicate:nn} @@ -929,6 +980,19 @@ % \end{macro} % \end{macro} % +% \begin{macro}[added = 2018-05-10] +% {\bool_set_inverse:N, \bool_set_inverse:c, \bool_gset_inverse:N, \bool_gset_inverse:c} +% Set to \texttt{false} or \texttt{true} locally or globally. +% \begin{macrocode} +\cs_new_protected:Npn \bool_set_inverse:N #1 + { \bool_if:NTF #1 { \bool_set_false:N } { \bool_set_true:N } #1 } +\cs_generate_variant:Nn \bool_set_inverse:N { c } +\cs_new_protected:Npn \bool_gset_inverse:N #1 + { \bool_if:NTF #1 { \bool_gset_false:N } { \bool_gset_true:N } #1 } +\cs_generate_variant:Nn \bool_gset_inverse:N { c } +% \end{macrocode} +% \end{macro} +% % \subsection{Internal auxiliaries} % % \begin{variable}{\q_@@_recursion_tail,\q_@@_recursion_stop} @@ -984,9 +1048,9 @@ % Show the truth value of the boolean. % \begin{macrocode} \cs_new_protected:Npn \bool_show:n - { \msg_show_eval:Nn \bool_to_str:n } + { \__kernel_msg_show_eval:Nn \bool_to_str:n } \cs_new_protected:Npn \bool_log:n - { \msg_log_eval:Nn \bool_to_str:n } + { \__kernel_msg_log_eval:Nn \bool_to_str:n } % \end{macrocode} % \end{macro} % @@ -1458,6 +1522,46 @@ % \end{macrocode} % \end{macro} % +% \begin{variable}{\s_@@_mark,\s_@@_stop} +% Internal scan marks. +% \begin{macrocode} +\scan_new:N \s_@@_mark +\scan_new:N \s_@@_stop +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[EXP, noTF]{\bool_case:n} +% \begin{macro}{\@@_case:NnTF} +% \begin{macro}{\@@_case:w,a\@@_case_end:nw} +% For boolean cases the overall idea is the same as for +% \cs{tl_case:nnTF} as described in \pkg{l3tl}. +% \begin{macrocode} +\cs_new:Npn \bool_case:nTF + { \exp:w \@@_case:nTF } +\cs_new:Npn \bool_case:nT #1#2 + { \exp:w \@@_case:nTF {#1} {#2} { } } +\cs_new:Npn \bool_case:nF #1 + { \exp:w \@@_case:nTF {#1} { } } +\cs_new:Npn \bool_case:n #1 + { \exp:w \@@_case:nTF {#1} { } { } } +\cs_new:Npn \@@_case:nTF #1#2#3 + { + \@@_case:w + #1 \c_true_bool { } \s_@@_mark {#2} \s_@@_mark {#3} \s_@@_stop + } +\cs_new:Npn \@@_case:w #1#2 + { + \bool_if:nTF {#1} + { \@@_case_end:nw {#2} } + { \@@_case:w } + } +\cs_new:Npn \@@_case_end:nw #1#2#3 \s_@@_mark #4#5 \s_@@_stop + { \exp_end: #1 #4 } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Producing multiple copies} % % \begin{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3prop.dtx b/macros/latex/contrib/l3kernel/l3prop.dtx index b6abe20084..da3a73a51c 100644 --- a/macros/latex/contrib/l3kernel/l3prop.dtx +++ b/macros/latex/contrib/l3kernel/l3prop.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3quark.dtx b/macros/latex/contrib/l3kernel/l3quark.dtx index 4b7b2b29e2..a039cf8a97 100644 --- a/macros/latex/contrib/l3kernel/l3quark.dtx +++ b/macros/latex/contrib/l3kernel/l3quark.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3regex.dtx b/macros/latex/contrib/l3kernel/l3regex.dtx index 92861173b6..b2443a4b27 100644 --- a/macros/latex/contrib/l3kernel/l3regex.dtx +++ b/macros/latex/contrib/l3kernel/l3regex.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -3536,7 +3536,7 @@ \@@_compile_cs_aux:Nn } { - \@@_quark_if_nil:NF #1 { \flag_raise_if_clear:n { @@_cs } } + \@@_quark_if_nil:NF #1 { \flag_ensure_raised:n { @@_cs } } \@@_use_none_delimit_by_q_recursion_stop:w } } @@ -3558,7 +3558,7 @@ { \@@_quark_if_nil:NF #1 { - \flag_raise_if_clear:n { @@_cs } + \flag_ensure_raised:n { @@_cs } \@@_use_i_delimit_by_q_recursion_stop:nw } \@@_use_none_delimit_by_q_recursion_stop:w @@ -6938,6 +6938,9 @@ % \end{macro} % % \begin{macro}{\@@_group_end_extract_seq:N} +% \begin{macro}{\@@_extract_seq:N} +% \begin{macro}{\@@_extract_seq:NNn} +% \begin{macro}{\@@_extract_seq_loop:Nw} % The end-points of submatches are stored as entries of two arrays % from \cs{l_@@_min_submatch_int} to \cs{l_@@_submatch_int} % (exclusive). Extract the relevant ranges into \cs{g_@@_internal_tl}, @@ -6977,12 +6980,28 @@ { \int_use:N \l_@@_added_end_int } } \group_end: - \cs_set_eq:NN \@@_tmp:w \@@_extract_map_loop:w - \seq_set_from_function:NnN #1 - { \@@_extract_map:N } \exp_not:n + \@@_extract_seq:N #1 + } +\cs_gset_protected:Npn \@@_extract_seq:N #1 + { + \seq_clear:N #1 + \cs_set_eq:NN \@@_tmp:w \@@_extract_seq_loop:Nw + \exp_after:wN \@@_extract_seq:NNn + \exp_after:wN #1 + \g_@@_internal_tl \use_none:nnn + } +\cs_new_protected:Npn \@@_extract_seq:NNn #1#2#3 + { #3 #2 #1 \prg_do_nothing: } +\cs_new_protected:Npn \@@_extract_seq_loop:Nw #1#2 \@@_tmp:w #3 + { + \seq_put_right:No #1 {#2} + #3 \@@_extract_seq_loop:Nw #1 \prg_do_nothing: } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}[EXP]{\@@_extract_seq_aux:n, \@@_extract_seq_aux:ww} % The \texttt{:n} auxiliary builds one item of the sequence of @@ -7090,35 +7109,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP] -% { -% \@@_extract_map:N, -% \@@_extract_map_aux:NNn, -% \@@_extract_map_loop:w -% } -% This receives a |seq| internal function and maps it over all items -% in \cs{g_@@_internal_tl}. This token list takes the form -% \cs{@@_tmp:w} |{}| \meta{item_1} \cs{@@_tmp:w} |{}| \meta{item_2} -% \ldots{} \cs{@@_tmp:w}, and the calling code has set \cs{@@_tmp:w} -% equal to \cs{@@_extract_map_loop:w}. The loop is otherwise pretty -% standard, with \cs{prg_do_nothing:} to avoid losing braces. -% \begin{macrocode} -\cs_new:Npn \@@_extract_map:N #1 - { - \exp_after:wN \@@_extract_map_aux:NNn - \exp_after:wN #1 - \g_@@_internal_tl \use_none:nnn - } -\cs_new:Npn \@@_extract_map_aux:NNn #1#2#3 - { #3 #2 #1 \prg_do_nothing: } -\cs_new:Npn \@@_extract_map_loop:w #1#2 \@@_tmp:w #3 - { - \exp_after:wN #1 \exp_after:wN {#2} - #3 \@@_extract_map_loop:w #1 \prg_do_nothing: - } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\@@_extract:, \@@_extract_aux:w} % Our task here is to store the list of end-points of submatches, and % store them in appropriate array entries, from diff --git a/macros/latex/contrib/l3kernel/l3seq.dtx b/macros/latex/contrib/l3kernel/l3seq.dtx index 24d115669c..e4aeffa83f 100644 --- a/macros/latex/contrib/l3kernel/l3seq.dtx +++ b/macros/latex/contrib/l3kernel/l3seq.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -1608,50 +1608,42 @@ % somewhat moot. The integer variables are declared in \pkg{l3int}: % load-order issues. % \begin{macrocode} -\cs_if_exist:NTF \tex_uniformdeviate:D +\seq_new:N \g_@@_internal_seq +\cs_new_protected:Npn \seq_shuffle:N { \@@_shuffle:NN \seq_set_eq:NN } +\cs_new_protected:Npn \seq_gshuffle:N { \@@_shuffle:NN \seq_gset_eq:NN } +\cs_new_protected:Npn \@@_shuffle:NN #1#2 { - \seq_new:N \g_@@_internal_seq - \cs_new_protected:Npn \seq_shuffle:N { \@@_shuffle:NN \seq_set_eq:NN } - \cs_new_protected:Npn \seq_gshuffle:N { \@@_shuffle:NN \seq_gset_eq:NN } - \cs_new_protected:Npn \@@_shuffle:NN #1#2 + \int_compare:nNnTF { \seq_count:N #2 } > \c_max_register_int { - \int_compare:nNnTF { \seq_count:N #2 } > \c_max_register_int - { - \msg_error:nnx { seq } { shuffle-too-large } - { \token_to_str:N #2 } - } - { - \group_begin: - \int_zero:N \l_@@_internal_a_int - \@@_push_item_def: - \cs_gset_eq:NN \@@_item:n \@@_shuffle_item:n - #2 - \@@_pop_item_def: - \seq_gset_from_inline_x:Nnn \g_@@_internal_seq - { \int_step_function:nN { \l_@@_internal_a_int } } - { \tex_the:D \tex_toks:D ##1 } - \group_end: - #1 #2 \g_@@_internal_seq - \seq_gclear:N \g_@@_internal_seq - } + \msg_error:nnx { seq } { shuffle-too-large } + { \token_to_str:N #2 } } - \cs_new_protected:Npn \@@_shuffle_item:n { - \int_incr:N \l_@@_internal_a_int - \int_set:Nn \l_@@_internal_b_int - { 1 + \tex_uniformdeviate:D \l_@@_internal_a_int } - \tex_toks:D \l_@@_internal_a_int - = \tex_toks:D \l_@@_internal_b_int - \tex_toks:D \l_@@_internal_b_int - } + \group_begin: + \int_zero:N \l_@@_internal_a_int + \@@_push_item_def: + \cs_gset_eq:NN \@@_item:n \@@_shuffle_item:n + #2 + \@@_pop_item_def: + \seq_gclear:N \g_@@_internal_seq + \int_step_inline:nn \l_@@_internal_a_int + { + \seq_gput_right:Nx \g_@@_internal_seq + { \tex_the:D \tex_toks:D ##1 } + } + \group_end: + #1 #2 \g_@@_internal_seq + \seq_gclear:N \g_@@_internal_seq + } } +\cs_new_protected:Npn \@@_shuffle_item:n { - \cs_new_protected:Npn \seq_shuffle:N #1 - { - \msg_error:nnn { kernel } { fp-no-random } - { \seq_shuffle:N #1 } - } - \cs_new_eq:NN \seq_gshuffle:N \seq_shuffle:N + \int_incr:N \l_@@_internal_a_int + \int_set:Nn \l_@@_internal_b_int + { 1 + \tex_uniformdeviate:D \l_@@_internal_a_int } + \tex_toks:D \l_@@_internal_a_int + = \tex_toks:D \l_@@_internal_b_int + \tex_toks:D \l_@@_internal_b_int } \cs_generate_variant:Nn \seq_shuffle:N { c } \cs_generate_variant:Nn \seq_gshuffle:N { c } diff --git a/macros/latex/contrib/l3kernel/l3skip.dtx b/macros/latex/contrib/l3kernel/l3skip.dtx index 521d976250..2d18a850d5 100644 --- a/macros/latex/contrib/l3kernel/l3skip.dtx +++ b/macros/latex/contrib/l3kernel/l3skip.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -1738,7 +1738,7 @@ % dimension expressions: this gives a more unified output. % \begin{macrocode} \cs_new_protected:Npn \dim_show:n - { \msg_show_eval:Nn \dim_eval:n } + { \__kernel_msg_show_eval:Nn \dim_eval:n } % \end{macrocode} % \end{macro} % @@ -1748,7 +1748,7 @@ \cs_new_eq:NN \dim_log:N \__kernel_register_log:N \cs_new_eq:NN \dim_log:c \__kernel_register_log:c \cs_new_protected:Npn \dim_log:n - { \msg_log_eval:Nn \dim_eval:n } + { \__kernel_msg_log_eval:Nn \dim_eval:n } % \end{macrocode} % \end{macro} % @@ -1996,7 +1996,7 @@ % skip expressions: this gives a more unified output. % \begin{macrocode} \cs_new_protected:Npn \skip_show:n - { \msg_show_eval:Nn \skip_eval:n } + { \__kernel_msg_show_eval:Nn \skip_eval:n } % \end{macrocode} % \end{macro} % @@ -2006,7 +2006,7 @@ \cs_new_eq:NN \skip_log:N \__kernel_register_log:N \cs_new_eq:NN \skip_log:c \__kernel_register_log:c \cs_new_protected:Npn \skip_log:n - { \msg_log_eval:Nn \skip_eval:n } + { \__kernel_msg_log_eval:Nn \skip_eval:n } % \end{macrocode} % \end{macro} % @@ -2195,7 +2195,7 @@ % muskip expressions: this gives a more unified output. % \begin{macrocode} \cs_new_protected:Npn \muskip_show:n - { \msg_show_eval:Nn \muskip_eval:n } + { \__kernel_msg_show_eval:Nn \muskip_eval:n } % \end{macrocode} % \end{macro} % @@ -2205,7 +2205,7 @@ \cs_new_eq:NN \muskip_log:N \__kernel_register_log:N \cs_new_eq:NN \muskip_log:c \__kernel_register_log:c \cs_new_protected:Npn \muskip_log:n - { \msg_log_eval:Nn \muskip_eval:n } + { \__kernel_msg_log_eval:Nn \muskip_eval:n } % \end{macrocode} % \end{macro} % diff --git a/macros/latex/contrib/l3kernel/l3sort.dtx b/macros/latex/contrib/l3kernel/l3sort.dtx index 67bf484492..80be229f40 100644 --- a/macros/latex/contrib/l3kernel/l3sort.dtx +++ b/macros/latex/contrib/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -428,12 +428,13 @@ { \group_begin: \@@_main:NNNn #1 #2 #4 {#5} - \seq_gset_from_inline_x:Nnn \g_@@_internal_seq + \seq_gclear:N \g_@@_internal_seq + \int_step_inline:nnn + \l_@@_min_int { \l_@@_top_int - 1 } { - \int_step_function:nnN - { \l_@@_min_int } { \l_@@_top_int - 1 } + \seq_gput_right:Nx \g_@@_internal_seq + { \tex_the:D \tex_toks:D ##1 } } - { \tex_the:D \tex_toks:D ##1 } \group_end: #3 #4 \g_@@_internal_seq \seq_gclear:N \g_@@_internal_seq diff --git a/macros/latex/contrib/l3kernel/l3str-convert.dtx b/macros/latex/contrib/l3kernel/l3str-convert.dtx index e5ac12e01b..abaeb6d72a 100644 --- a/macros/latex/contrib/l3kernel/l3str-convert.dtx +++ b/macros/latex/contrib/l3kernel/l3str-convert.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3str.dtx b/macros/latex/contrib/l3kernel/l3str.dtx index 7e6e9abaed..603af98607 100644 --- a/macros/latex/contrib/l3kernel/l3str.dtx +++ b/macros/latex/contrib/l3kernel/l3str.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3styleguide.pdf b/macros/latex/contrib/l3kernel/l3styleguide.pdf Binary files differindex a3fdc61713..dc78cc2558 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.pdf +++ b/macros/latex/contrib/l3kernel/l3styleguide.pdf diff --git a/macros/latex/contrib/l3kernel/l3styleguide.tex b/macros/latex/contrib/l3kernel/l3styleguide.tex index 47191fd28d..d72c42d3bf 100644 --- a/macros/latex/contrib/l3kernel/l3styleguide.tex +++ b/macros/latex/contrib/l3kernel/l3styleguide.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2023-04-20} +\date{Released 2023-05-05} \begin{document} diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf Binary files differindex 845b5f70a4..42670a750f 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.pdf +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.pdf diff --git a/macros/latex/contrib/l3kernel/l3syntax-changes.tex b/macros/latex/contrib/l3kernel/l3syntax-changes.tex index 3f54877621..4b050d797d 100644 --- a/macros/latex/contrib/l3kernel/l3syntax-changes.tex +++ b/macros/latex/contrib/l3kernel/l3syntax-changes.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2023-04-20} +\date{Released 2023-05-05} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3sys.dtx b/macros/latex/contrib/l3kernel/l3sys.dtx index 2457024b1b..6125c76928 100644 --- a/macros/latex/contrib/l3kernel/l3sys.dtx +++ b/macros/latex/contrib/l3kernel/l3sys.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -121,6 +121,27 @@ % \tn{fmtname}). % \end{variable} % +% \begin{variable}[added = 2018-05-02]{\c_sys_engine_version_str} +% The version string of the current engine, in the same form as +% given in the banner issued when running a job. For \pdfTeX{} +% and \LuaTeX{} this is of the form +% \begin{quote} +% \meta{major}.\meta{minor}.\meta{revision} +% \end{quote} +% For \XeTeX{}, the form is +% \begin{quote} +% \meta{major}.\meta{minor} +% \end{quote} +% For \pTeX{} and \upTeX{}, only releases since \TeX{} Live 2018 +% make the data available, and the form is more complex, as it comprises +% the \pTeX{} version, the \upTeX{} version and the e-\pTeX{} version. +% \begin{quote} +% p\meta{major}.\meta{minor}.\meta{revision}-u\meta{major}.\meta{minor}^^A +% -\meta{epTeX} +% \end{quote} +% where the |u| part is only present for \upTeX{}. +% \end{variable} +% % \begin{function}[added = 2020-09-24, EXP]{\sys_timer:} % \begin{syntax} % \cs{sys_timer:} @@ -472,18 +493,69 @@ % \end{macrocode} % \end{variable} % -% \subsubsection{Randomness} -% -% This candidate function is placed there because -% \cs{sys_if_rand_exist:TF} is used in \pkg{l3fp-rand}. -% -% \begin{macro}[EXP, pTF]{\sys_if_rand_exist:} -% Currently, randomness exists under \pdfTeX{}, \LuaTeX{}, \pTeX{} and \upTeX{}. +% \begin{variable}{\c_sys_engine_version_str} +% Various different engines, various different ways to extract the +% data! % \begin{macrocode} -\@@_const:nn { sys_if_rand_exist } - { \cs_if_exist_p:N \tex_uniformdeviate:D } +\str_const:Nx \c_sys_engine_version_str + { + \str_case:on \c_sys_engine_str + { + { pdftex } + { + \int_div_truncate:nn { \tex_pdftexversion:D } { 100 } + . + \int_mod:nn { \tex_pdftexversion:D } { 100 } + . + \tex_pdftexrevision:D + } + { ptex } + { + \cs_if_exist:NT \tex_ptexversion:D + { + p + \int_use:N \tex_ptexversion:D + . + \int_use:N \tex_ptexminorversion:D + \tex_ptexrevision:D + - + \int_use:N \tex_epTeXversion:D + } + } + { luatex } + { + \int_div_truncate:nn { \tex_luatexversion:D } { 100 } + . + \int_mod:nn { \tex_luatexversion:D } { 100 } + . + \tex_luatexrevision:D + } + { uptex } + { + \cs_if_exist:NT \tex_ptexversion:D + { + p + \int_use:N \tex_ptexversion:D + . + \int_use:N \tex_ptexminorversion:D + \tex_ptexrevision:D + - + u + \int_use:N \tex_uptexversion:D + \tex_uptexrevision:D + - + \int_use:N \tex_epTeXversion:D + } + } + { xetex } + { + \int_use:N \tex_XeTeXversion:D + \tex_XeTeXrevision:D + } + } + } % \end{macrocode} -% \end{macro} +% \end{variable} % % \subsubsection{Platform} % @@ -856,23 +928,11 @@ end % \subsubsection{Random numbers} % % \begin{macro}[EXP]{\sys_rand_seed:} -% Unpack the primitive. When random numbers are not available, we -% return zero after an error (and incidentally make sure the number of -% expansions needed is the same as with random numbers available). +% Unpack the primitive. % \begin{macrocode} \@@_everyjob:n { - \sys_if_rand_exist:TF - { \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D } } - { - \cs_new:Npn \sys_rand_seed: - { - \int_value:w - \msg_expandable_error:nnn { kernel } { fp-no-random } - { \sys_rand_seed: } - \c_zero_int - } - } + \cs_new:Npn \sys_rand_seed: { \tex_the:D \tex_randomseed:D } } % \end{macrocode} % \end{macro} @@ -882,18 +942,8 @@ end % \begin{macrocode} \@@_everyjob:n { - \sys_if_rand_exist:TF - { - \cs_new_protected:Npn \sys_gset_rand_seed:n #1 - { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: } - } - { - \cs_new_protected:Npn \sys_gset_rand_seed:n #1 - { - \msg_error:nnn { kernel } { fp-no-random } - { \sys_gset_rand_seed:n {#1} } - } - } + \cs_new_protected:Npn \sys_gset_rand_seed:n #1 + { \tex_setrandomseed:D \int_eval:n {#1} \exp_stop_f: } } % \end{macrocode} % \end{macro} diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.pdf b/macros/latex/contrib/l3kernel/l3term-glossary.pdf Binary files differindex a6d9267db8..f70f96750d 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.pdf +++ b/macros/latex/contrib/l3kernel/l3term-glossary.pdf diff --git a/macros/latex/contrib/l3kernel/l3term-glossary.tex b/macros/latex/contrib/l3kernel/l3term-glossary.tex index 39a88040a1..c33970000c 100644 --- a/macros/latex/contrib/l3kernel/l3term-glossary.tex +++ b/macros/latex/contrib/l3kernel/l3term-glossary.tex @@ -32,7 +32,7 @@ The released version of this bundle is available from CTAN. {latex-team@latex-project.org}% }% } -\date{Released 2023-04-20} +\date{Released 2023-05-05} \newcommand{\TF}{\textit{(TF)}} diff --git a/macros/latex/contrib/l3kernel/l3text-case.dtx b/macros/latex/contrib/l3kernel/l3text-case.dtx index dcb3ed925c..3a71dd4b01 100644 --- a/macros/latex/contrib/l3kernel/l3text-case.dtx +++ b/macros/latex/contrib/l3kernel/l3text-case.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3text-map.dtx b/macros/latex/contrib/l3kernel/l3text-map.dtx index 005f3c8da8..ef93deb909 100644 --- a/macros/latex/contrib/l3kernel/l3text-map.dtx +++ b/macros/latex/contrib/l3kernel/l3text-map.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3text-purify.dtx b/macros/latex/contrib/l3kernel/l3text-purify.dtx index 0e3b99825b..35c73a621a 100644 --- a/macros/latex/contrib/l3kernel/l3text-purify.dtx +++ b/macros/latex/contrib/l3kernel/l3text-purify.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3text.dtx b/macros/latex/contrib/l3kernel/l3text.dtx index ba9f7d84c0..d9057ea51f 100644 --- a/macros/latex/contrib/l3kernel/l3text.dtx +++ b/macros/latex/contrib/l3kernel/l3text.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx index c494baaaba..c9beca06a3 100644 --- a/macros/latex/contrib/l3kernel/l3tl-analysis.dtx +++ b/macros/latex/contrib/l3kernel/l3tl-analysis.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/l3tl.dtx b/macros/latex/contrib/l3kernel/l3tl.dtx index 2d75fd2e3a..741463fee8 100644 --- a/macros/latex/contrib/l3kernel/l3tl.dtx +++ b/macros/latex/contrib/l3kernel/l3tl.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -1048,8 +1048,6 @@ %^^A The behavior of \cs{tl_range:Nnn} is exactly the same, acting on the %^^A contents of the tl variable. % -% For better performance, see \cs{tl_range_braced:nnn} and -% \cs{tl_range_unbraced:nnn}. % \begin{texnote} % The result is returned within the \tn{unexpanded} % primitive (\cs{exp_not:n}), which means that the \meta{item} diff --git a/macros/latex/contrib/l3kernel/l3token.dtx b/macros/latex/contrib/l3kernel/l3token.dtx index e934973a51..dad206a406 100644 --- a/macros/latex/contrib/l3kernel/l3token.dtx +++ b/macros/latex/contrib/l3kernel/l3token.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % @@ -155,6 +155,11 @@ % \end{texnote} % \end{function} % +% \begin{variable}[added = 2017-08-07]{\c_catcode_active_space_tl} +% Token list containing one character with category code $13$, +% (\enquote{active}), and character code $32$ (space). +% \end{variable} +% % \begin{variable}[added = 2011-09-05]{\c_catcode_other_space_tl} % Token list containing one character with category code $12$, % (\enquote{other}), and character code $32$ (space). @@ -1838,6 +1843,21 @@ % \end{macro} % \end{macro} % +% \begin{variable}{\c_catcode_active_space_tl} +% While \cs{char_generate:nn} can produce active characters in some +% engines it cannot in general. It would be possible to simply change +% the catcode of space but then the code would need to avoid all +% spaces, making it quite unreadable. Instead we use the primitive +% \cs{tex_lowercase:D} trick. +% \begin{macrocode} +\group_begin: + \char_set_catcode_active:N * + \char_set_lccode:nn { `* } { `\ } + \tex_lowercase:D { \tl_const:Nn \c_catcode_active_space_tl { * } } +\group_end: +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\c_catcode_other_space_tl} % Create a space with category code $12$: an \enquote{other} space. % \begin{macrocode} diff --git a/macros/latex/contrib/l3kernel/l3unicode.dtx b/macros/latex/contrib/l3kernel/l3unicode.dtx index 1df63cf85d..7c10f17791 100644 --- a/macros/latex/contrib/l3kernel/l3unicode.dtx +++ b/macros/latex/contrib/l3kernel/l3unicode.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2023-04-20} +% \date{Released 2023-05-05} % % \maketitle % diff --git a/macros/latex/contrib/l3kernel/source3.pdf b/macros/latex/contrib/l3kernel/source3.pdf Binary files differindex 45550d1fbb..820dcb66c9 100644 --- a/macros/latex/contrib/l3kernel/source3.pdf +++ b/macros/latex/contrib/l3kernel/source3.pdf diff --git a/macros/latex/contrib/l3kernel/source3.tex b/macros/latex/contrib/l3kernel/source3.tex index 9556341a0c..95a81cac1b 100644 --- a/macros/latex/contrib/l3kernel/source3.tex +++ b/macros/latex/contrib/l3kernel/source3.tex @@ -53,7 +53,7 @@ for those people who are interested. {latex-team@latex-project.org}% }% } -\date{Released 2023-04-20} +\date{Released 2023-05-05} \pagenumbering{roman} \maketitle |