summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltexpl.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-01-14 03:01:14 +0000
committerNorbert Preining <norbert@preining.info>2022-01-14 03:01:14 +0000
commit45623da68203ac8d7aa04b779a6ed65c92c3f866 (patch)
tree151ca3ede3ee826360d4b32c0029cfc106346ec9 /macros/latex-dev/base/ltexpl.dtx
parentee3f9ca89b21a2174f7e427d9d48247b1912e130 (diff)
CTAN sync 202201140301
Diffstat (limited to 'macros/latex-dev/base/ltexpl.dtx')
-rw-r--r--macros/latex-dev/base/ltexpl.dtx129
1 files changed, 126 insertions, 3 deletions
diff --git a/macros/latex-dev/base/ltexpl.dtx b/macros/latex-dev/base/ltexpl.dtx
index 021edc644c..e6a83d5725 100644
--- a/macros/latex-dev/base/ltexpl.dtx
+++ b/macros/latex-dev/base/ltexpl.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2019-2021
+% Copyright (C) 2019-2022
% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
@@ -33,7 +33,7 @@
%<*driver>
% \fi
\ProvidesFile{ltexpl.dtx}
- [2021/04/20 v1.3c LaTeX Kernel (expl3-dependent code)]
+ [2022/01/06 v1.3e LaTeX Kernel (expl3-dependent code)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltexpl.dtx}
@@ -57,7 +57,7 @@
%
% \section{\pkg{expl3}-dependent code}
%
-% \StopEventually{}
+% \MaybeStop{}
%
% \changes{v0.0}{2019-10-02}{Initial version}
%
@@ -387,4 +387,127 @@
% \end{macrocode}
%
%
+%
+%
+%
+%
+% \section{Document-level command names for \pkg{expl3} functions}
+%
+% Current home for L3 programing layer functions that we make
+% directly available at the document level. This section may need
+% to be moved later (after \cs{NewDocumentCommand} is defined in
+% case we want to use that in the setup).
+%
+%
+% \DescribeMacro\fpeval
+% The expandable command \cs{fpeval} takes as its argument a
+% floating point expression and produces a result using the normal
+% rules of mathematics. As this command is expandable it can be
+% used where \TeX{} requires a number and for example within a
+% low-level \cs{edef} operation to give a purely numerical
+% result. See \texttt{usrguide3} for further explanation.
+%
+% \DescribeMacro\inteval
+% \DescribeMacro\dimeval
+% \DescribeMacro\skipeval
+% The expandable command \cs{inteval} takes as its argument an
+% integer expression and produces a result using the normal rules
+% of mathematics. The operations recognised are |+|, |-|, |*| and
+% |/| plus parentheses. Division occurs with \emph{rounding}, and
+% ties are rounded away from zero. As this command is expandable it
+% can be used where \TeX{} requires a number and for example within
+% a low-level \cs{edef} operation to give a purely numerical
+% result. See \texttt{usrguide3} for further explanation.
+% \cs{dimeval} and \cs{skipeval} are similar, but generate fixed and
+% rubber length values, respectively.
+%
+%
+%
+% \begin{macro}{\fpeval,\inteval,\dimeval,\skipeval}
+% A document level wrapper around the code level function for
+% floating point calculations.
+% \changes{v1.3d}{2021/11/30}{Moved over from \texttt{xfp} package (gh/711)}
+% \begin{macrocode}
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2022/06/01}%
+%<latexrelease> {\fpeval}{fp and int calculations}%
+\ExplSyntaxOn
+\cs_new_eq:NN \fpeval \fp_eval:n
+% \end{macrocode}
+% And a few more, this time wrappers around the e\TeX{} primitives.
+% \begin{macrocode}
+\cs_new_eq:NN \inteval \int_eval:n
+% \end{macrocode}
+%
+% \changes{v1.3d}{2021/12/07}{Added \cs{dimeval} and \cs{skipeval} (gh/711)}
+% \begin{macrocode}
+\cs_new_eq:NN \dimeval \dim_eval:n
+\cs_new_eq:NN \skipeval \skip_eval:n
+\ExplSyntaxOff
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\fpeval}{fp and int calculations}%
+
+%<latexrelease>
+%<latexrelease>\let\fpeval\@undefined
+%<latexrelease>\let\inteval\@undefined
+%<latexrelease>\let\dimeval\@undefined
+%<latexrelease>\let\skipeval\@undefined
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+%
+% \DescribeMacro\UseName
+% \DescribeMacro\ExpandArgs
+% When declaring new commands with \cs{NewDocumentCommand} or
+% \cs{NewCommandCopy} or similar, it is sometimes necessary to
+% ``construct'' the csname. As a general mechanism the L3
+% programming layer has \cs{exp\_args:N...} for this, but there is
+% no mechanism for it if \cs{ExplSyntaxOn} is not active. We
+% therefore offer a few of these commands also with CamelCase names.
+%
+%
+% \begin{macro}{\UseName,\ExpandArgs}
+% A document wrapper for changing arguments to cs names for use
+% with \cs{NewDocumentCommand} and similar functions.
+%
+% \changes{v1.3d}{2021/12/28}{Added document level names for \cs{exp\_args:Nc} and the like (gh/735)}
+% \changes{v1.3e}{2022/01/06}{Adjust document level names for \cs{exp\_args:Nc} and the like (gh/735)}
+% \begin{macrocode}
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2022/06/01}%
+%<latexrelease> {\ExpandArgs}{Some pre-expansion commands}%
+\ExplSyntaxOn
+\cs_new_eq:NN \UseName \use:c
+% \end{macrocode}
+%
+% \begin{macrocode}
+\cs_new:Npn \ExpandArgs #1
+ {
+ \cs_if_exist_use:cF { exp_args:N #1 }
+ { \msg_expandable_error:nnn { kernel } { unknown-arg-expansion } {#1} }
+ }
+\msg_new:nnn { kernel } { unknown-arg-expansion }
+ { Unknown~arg~expansion~"#1" }
+\ExplSyntaxOff
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\ExpandArgs}{Some pre-expansion commands}%
+
+%<latexrelease>
+%<latexrelease>\let\UseName\@undefined
+%<latexrelease>\let\ExpandArgs\@undefined
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
% \Finale