diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-14 20:11:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-14 20:11:19 +0000 |
commit | 94e30de3e8e2b8a03f814dfa490e6db7d81aba44 (patch) | |
tree | 8207b2cb96e3cfc658ea3882b70bf50e9095dc2b /Master/texmf-dist | |
parent | 0e681a8aa154482499e8184c6596d330c40071fc (diff) |
bnumexpr (14may21)
git-svn-id: svn://tug.org/texlive/trunk@59193 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/README.md | 9 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf | bin | 88616 -> 96634 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex | 11 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx | 277 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty | 14 |
6 files changed, 202 insertions, 115 deletions
diff --git a/Master/texmf-dist/doc/latex/bnumexpr/README.md b/Master/texmf-dist/doc/latex/bnumexpr/README.md index bda6edef58a..a7db8bf12c8 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/README.md +++ b/Master/texmf-dist/doc/latex/bnumexpr/README.md @@ -1,5 +1,5 @@ | Source: bnumexpr.dtx -| Version: v1.4, 2021/05/12 (doc: 2021/05/12) +| Version: v1.4a, 2021/05/13 (doc: 2021/05/13) | Author: Jean-Francois Burnol | Info: Expressions with big integers | License: LPPL 1.3c @@ -35,13 +35,6 @@ the syntax elements to macros from an alternative big integer expandable engine of the user own choosing, and then [xintcore](http://ctan.org/pkg/xint) is not loaded. -Note; the possibility not to use the xintcore macros might be -removed in the future: perhaps a future release will maintain during -computations a private internal representation (especially tailored -either for the xintcore macros or new ones which would be included -within `bnumexpr.sty` itself) and the constraints this implies may -render optional use of other macros impossible. - Installation ============ diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf Binary files differindex d6fce09181b..79f259f3f2c 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex index d31477086c5..7a24b491dee 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex @@ -21,9 +21,9 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% --------------------------------------------------------------- -\def\bnedocdate {2021/05/12}% package bnumexpr documentation date -\def\bnepackdate{2021/05/12}% package bnumexpr date -\def\bneversion {1.4} % package bnumexpr version +\def\bnedocdate {2021/05/13}% package bnumexpr documentation date +\def\bnepackdate{2021/05/13}% package bnumexpr date +\def\bneversion {1.4a} % package bnumexpr version %% --------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers %% Copyright (C) 2014-2021 by Jean-Francois Burnol diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex b/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex index e39bd39df1e..5ca9d231d5d 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexprchanges.tex @@ -24,6 +24,17 @@ %% The bnumexpr package: Expressions with big integers %% Copyright (C) 2014-2021 by Jean-Francois Burnol %% +\item[1.4a (2021/05/13)] + \begin{itemize} + \item fix undefined control sequences errors encountered by the parser in + case of either extra or missing closing parenthesis (due to a problem + in technology transfer at |1.4| from upstream \xintexprname). + \item fix |\BNE_Op_opp| must now be f-expandable (also caused as a + collateral to the technology transfer). + \item fix user documentation regarding the constraints applying to the user + replacement macros for the core algebra, as they have changed at |1.4|. + \end{itemize} + \item[1.4 (2021/05/12)] \begin{itemize} \item technology transfer from \xintexprname |1.4| of diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx index 83e0ab6c381..23ead1e2e1e 100644 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx +++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx @@ -1,17 +1,17 @@ % -*- coding: utf-8-unix; time-stamp-format: "%02d-%02m-%:y %02H:%02M:%02S %Z"; sentence-end-double-space: t; -*- %<*dtx> -\def\bnedtxtimestamp {Time-stamp: <12-05-2021 22:05:26 CEST>} +\def\bnedtxtimestamp {Time-stamp: <13-05-2021 12:37:08 CEST>} \iffalse %</dtx> %<*drv> %% --------------------------------------------------------------- -\def\bnedocdate {2021/05/12}% package bnumexpr documentation date -\def\bnepackdate{2021/05/12}% package bnumexpr date -\def\bneversion {1.4} % package bnumexpr version +\def\bnedocdate {2021/05/13}% package bnumexpr documentation date +\def\bnepackdate{2021/05/13}% package bnumexpr date +\def\bneversion {1.4a} % package bnumexpr version %</drv> %<*readme>-------------------------------------------------------- | Source: bnumexpr.dtx -| Version: v1.4, 2021/05/12 (doc: 2021/05/12) +| Version: v1.4a, 2021/05/13 (doc: 2021/05/13) | Author: Jean-Francois Burnol | Info: Expressions with big integers | License: LPPL 1.3c @@ -47,13 +47,6 @@ the syntax elements to macros from an alternative big integer expandable engine of the user own choosing, and then [xintcore](http://ctan.org/pkg/xint) is not loaded. -Note; the possibility not to use the xintcore macros might be -removed in the future: perhaps a future release will maintain during -computations a private internal representation (especially tailored -either for the xintcore macros or new ones which would be included -within `bnumexpr.sty` itself) and the constraints this implies may -render optional use of other macros impossible. - Installation ============ @@ -129,6 +122,17 @@ and the derived files %% %</!readme> %<*changes>------------------------------------------------------- +\item[1.4a (2021/05/13)] + \begin{itemize} + \item fix undefined control sequences errors encountered by the parser in + case of either extra or missing closing parenthesis (due to a problem + in technology transfer at |1.4| from upstream \xintexprname). + \item fix |\BNE_Op_opp| must now be f-expandable (also caused as a + collateral to the technology transfer). + \item fix user documentation regarding the constraints applying to the user + replacement macros for the core algebra, as they have changed at |1.4|. + \end{itemize} + \item[1.4 (2021/05/12)] \begin{itemize} \item technology transfer from \xintexprname |1.4| of @@ -300,7 +304,7 @@ and the derived files \PassOptionsToPackage{dvipdfm}{geometry} \PassOptionsToPackage{bookmarks=true}{hyperref} \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref} - \PassOptionsToPackage{dvipdfmx-outline-open}{bookmark} + %\PassOptionsToPackage{dvipdfmx-outline-open}{bookmark} % \def\pgfsysdriver{pgfsys-dvipdfm.def} \else @@ -476,12 +480,14 @@ pdfpagemode=UseOutlines} {bnumexpr}% \xspace }% +\def\xintkernelname + {\href{http://www.ctan.org/pkg/xint}{xintkernel}\xspace }% \def\xintname {\href{http://www.ctan.org/pkg/xint}{xint}\xspace }% \def\xintcorename {\href{http://www.ctan.org/pkg/xint}{xintcore}\xspace }% \def\xintexprname - {\href{http://www.ctan.org/pkg/xint}{xintexpr}\xspace }% + {\href{http://www.ctan.org/pkg/xintexpr}{xintexpr}\xspace }% \def\xintbinhexname {\href{http://www.ctan.org/pkg/xint}{xintbinhex}\xspace }% @@ -546,15 +552,10 @@ pdfpagemode=UseOutlines} \etocsetnexttocdepth{section} \tableofcontents -\section{\csh{thebnumexpr}, \csh{bnumeval}, \csh{evaltohex}} +\section{\csh{bnumeval} (\csh{thebnumexpr}), \csh{evaltohex}} \label{sec:bnumexpr} -\LaTeX\ Package \bnumname provides |\thebnumexpr|\meta{expression}|\relax|:% -% -\footnote{Since |1.4|, one can use |\bnumexpr...\relax| directly in - typesetting context, it is not mandatory to prefix it with |\bnethe| or to - use |\thebnumexpr|.} -% +\LaTeX\ Package \bnumname provides |\thebnumexpr|\meta{expression}|\relax|: it is analogous to |\the\numexpr|\meta{expression}|\relax|, with these extensions: \begin{itemize} @@ -569,11 +570,20 @@ it is analogous to separator, \item comma separated expressions are allowed. \end{itemize} -There is also an alternative interface |\bnumeval|\marg{expression}, where the -expression is fetched as braced argument. And there is -|\evaltohex|\marg{expression} which does the same as -|\bnumeval|\marg{expression} but with a conversion to hexadecimal notation of -the (possibly comma separated) output. Hexadecimal input uses the |"| prefix. +There is also a more core-level |\bnumexpr...\relax| construct% +\footnote{Since |1.4|, one can use |\bnumexpr...\relax| directly in + typesetting context, it is not mandatory to prefix it with |\bnethe| or to + use |\thebnumexpr|.}% +, which expands +to a self-contained unit, rather than to explicit digit tokens (and commas). +See \autoref{sec:differences} for some related information. + +There is also the alternative interface |\bnumeval|\marg{expression}, where the +expression is fetched as braced argument. + +And there is |\evaltohex|\marg{expression} which does the same as |\bnumeval| +but with a conversion to hexadecimal notation of the (possibly comma +separated) output. Hexadecimal input uses the |"| prefix. This package parser is a scaled-down variant of |\xintiiexpr| from package \xintexprname, dropping support for nested structures, functions, variables, @@ -594,32 +604,27 @@ possible to replace them by expandable macros of a custom origin. \noindent\bneshow {---1 208 637 867 * (2 187 917 891 - 3 109 197 072)}% \bneshoweval {(13_8089_1090-300_1890_2902)*(1083_1908_3901-109_8290_3890)}% -\bneshow{(92_874_927_979**5-31_9792_7979**6)/30!}% +\bneshoweval {(92_874_927_979**5-31_9792_7979**6)/30!}% \bneshoweval {30!/20!/21/22/23/24/25/(26*27*28*29)}% -\bneshow {13^50//12^50, 13^50/:12^50}% +\bneshoweval {13^50//12^50, 13^50/:12^50}% \bneshoweval {13^50/12^50, 12^50}% -\bneshow {(1^10+2^10+3^10+4^10+5^10+6^10+7^10+8^10+9^10)^3}% +\bneshoweval {(1^10+2^10+3^10+4^10+5^10+6^10+7^10+8^10+9^10)^3}% \bneshoweval {100!/36^100}% \bneshoweval {"10*"100*"1000*"A0000, 16^(1+2+3+4)*10}% \bneshowevaltohex{"7FFFFFFF+1, "400^3, "ABCDEF*"FEDCBA}% \section{Differences from \csh{numexpr}} +\label{sec:differences} Apart from the extension to big integers (i.e. exceeding the \TeX{} limit at \number"7FFFFFFF), and the added operators, there are a number of important differences between |\bnumexpr| and |\numexpr|: \begin{enumerate} -\item one may embed directly |\bnumexpr...\relax| in another one (or in - a |\xintexpr...\relax|), but not in a |\numexpr...\relax|: it must - then be using |\thebnumexpr...| or |\bnethe\bnumexpr...| syntax; on - the other hand a |\numexpr...\relax| does not need to be prefixed by - |\the| or |\number| inside |\bnumexpr...\relax|. - \item contrarily to |\numexpr|, the |\bnumexpr| parser stops only after having - found (and swallowed) a mandatory ending |\relax| token, + found (and swallowed) a mandatory ending |\relax| token (it can arise from expansion), -\item in particular spaces between digits do not stop |\bnumexpr|, in contrast +\item in particular note that spaces between digits do not stop |\bnumexpr|, in contrast with |\numexpr|: |\the\numexpr 3 5+79\relax| expands (in one step) to \expandafter|\the\numexpr 3 5+79\relax| @@ -627,15 +632,23 @@ differences between |\bnumexpr| and |\numexpr|: |\thebnumexpr 3 5+79\relax| expands (in two steps) to \expandafter\expandafter\expandafter|\thebnumexpr 3 5+79\relax| -\item one may do |\edef\variable{\bnumexpr 1+2\relax}|, and then either use - |\variable| in another |\bnumexpr...\relax|, or print it via - |\bnethe\variable| (or directly since |1.4|). The computation is done at the time of the |\edef| - (and two expansion steps suffice). This is again in contrast with - |\numexpr...\relax| which, without |\the| (or |\number| or - |\romannumeral|) as prefix would not expand inside an |\edef|, +\item with |\edef\myVar{\thebnumexpr1+2\relax}|, the computation is of course + done at time of the |\edef|. But one is also allowed to do + |\edef\myVar{\bnumexpr1+2\relax}| which prepares |\myVar| as a macro which + can be inserted in other \bnumname expressions and behave there as a + self-contained pre-computed unit triggering tacit multiplication, or be + typeset directly if inserted in the typesetting stream.% +% +\footnote{Prior to |1.4|, one would have had to use |\bnethe\myVar| for + typesetting, or |\bnumeval{\myVar}|.} +% + There is no analog with |\numexpr| as |\edef\myVar{\numexpr1+2\relax}| does + not pre-compute anything and furthermore |\the\numexpr2\myVar\relax| in + typesetting flow then triggers the |You can't use `\numexpr' in horizontal + mode| error. \item expressions may be comma separated. On input, spaces are ignored, - naturally, and on output the values are comma separated with a space after + and on output the values are comma separated with a space after each comma, \item |\bnumexpr -(1+1)\relax| is legal contrarily to |\numexpr -(1+1)\relax| @@ -644,9 +657,6 @@ differences between |\bnumexpr| and |\numexpr|: \item |\numexpr 2\cnta\relax| is illegal (with |\cnta| a |\count|-variable.) But |\bnumexpr 2\cnta\relax| is perfectly legal and will do the tacit multiplication, -% \newcount\cnta -% \cnta 1111 -% \thebnumexpr 2\cnta\relax \item more generally, tacit multiplication applies in front of parenthesized sub-expressions, or sub |\bnumexpr...\relax| (or |\numexpr...\relax|), or @@ -657,13 +667,34 @@ differences between |\bnumexpr| and |\numexpr|: \end{enumerate} +As hinted above |\bnumexpr...\relax| differs from |\thebnumexpr...\relax| as +the latter expands to explicit digit tokens, but the former expands to a +private self-contained format which can serve as sub-unit in other +expressions, or be used inside |\edef|. Since |1.4| the former idiom can also +be inserted directly inside the typesetting stream, or be written out to an +external file where it will expand to some control sequences, braces, and +character tokens, all with their standard catcodes. + +One can use |\numexpr...\relax| as a sub-unit in |\bnumexpr...\relax| but the +reverse does not apply: it would either cause an error or an +anticipated end to the |\numexpr| which will think having hit a |\relax|. + An important thing to keep in mind is that if one has a calculation whose result is a small integer, acceptable by \TeX{} in |\ifnum| or count assignments, this integer produced by |\thebnumexpr| is not self-delimiting, contrarily to a |\numexpr...\relax| construct: the situation is exactly as with a |\the\numexpr...\relax|, thus one may need to terminate the number to avoid premature expansion of following -tokens; for example with the |\space| token. +tokens; for example with the |\space| control sequence. When using |\bnumeval{...}| +syntax as in +\begin{verbatim} +\ifnum\bnumeval{...} +... +\fi +\end{verbatim} +the end of line will insert a terminating space token. Again, here +|\bnumeval{...}| must produce an integer acceptable to \TeX, i.e. at most +{\number"7FFFFFFF} in absolute value. \section{Printing big numbers} @@ -737,7 +768,8 @@ the following way: \usepackage{xintcore} \bnumexprsetup{add=\xintiiAdd, sub=\xintiiSub, mul=\xintiiMul, divround=\xintiiDivRound, div=\xintiiDivFloor, - mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac} + mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac, + opp=\xintiiOpp}% \end{verbatim} If @@ -748,27 +780,22 @@ multiplication will be changed. Naturally it is up to the user to load the appropriate package for the alternative macros. -As per the macros which are the key values, they must have the -following properties: -\begin{enumerate} -\item they must be completely expandable (in the sense of an |\edef| - or a |\csname...\endcsname|.) -\item they must fully expand their arguments first (in the sense of - |\romannumeral-`0|.) -\item they must output a number with no leading zeros, at most one - minus sign and no plus sign. -\end{enumerate} -The first two items are truly mandatory, the last one may be not -obeyed if the extra key |opp| is used with \csa{bnumexprsetup} to -specify a suitable macro for the opposite of a number. This macro will -be presented not with a braced argument but directly with a sequence -of digits (either as gathered by the parser which skips leading -zeros, or as produced by the other arithmetic macros and then there -could be a minus, or even a plus if macros others than the ones from -\xintcorename have been used). -Thus, |opp| could identify a plus sign |+| upfront and then act -adequately.\footnote{see \csa{BNE_Op_opp} in the code for the - default.} +The macros serving as custom user replacements must be \emph{f}-expandable.% +% +\footnote{Prior to |1.4|, only \emph{x}-expandability was required. The author + could relax again the constraint, if asked to do so. Or perhaps simply add + an option for it.} +% +(except for the computation of factorials, which only has to be +\emph{x}-expandable). + +They will by default receive arguments composed of explicit digit tokens, with +no leading zeros, with at most one leading minus sign and no plus sign. + +The format of these arguments may depend on what the |opp=\foo| replacement +macro does. If the custom |\foo| inserts a |+| when taking the opposite of a +negative number, then the custom macros for arithmetic (and the |\foo| macro +itself) must be able to handle arguments starting optionally with such a |+|. Macro |\bnumexprsetup| can be used multiple times in the same document, thus allowing to switch math engines or to remap operators to some other arithmetic @@ -792,6 +819,8 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \noindent\kern\parindent\input README.md \endgroup }\x +%\clearpage + \section{Changes} %\small \begin{description} @@ -816,29 +845,65 @@ output is handled, it goes necessarily via the \xintbinhexname macros. % \label{sec:bnumexprcode} % \etocdefaultlines % \localtableofcontents +% \etocmarkbothnouc{Package \bnumnameimp implementation} % % Comments are sparse. Actually at |1.4|, there are simply no comments. I % transferred from \xintexprname its |\expanded| based infra-structure from -% its own |1.4| release of January 2020. It is a possibility that, even -% though I did remove very large chunks of unneeded macros, in the end, some -% more simplifications could have been considered here. +% its own |1.4| release of January 2020. % % Error handling by the parser is kept to a minimum; if something goes wrong, % the offensive token gets discarded, and it is not even always the case that % some expandable error message is issued. % +% A few comments at |1.4a|: +% \begin{itemize} +% \item It looked a bit costly and probably would have been mostly useless to +% end users to integrate in \bnumname support for nested structures via +% square brackets [, ], which is in \xintexprname since its January 2020 +% |1.4| release. But some underlying related architecture remains here; we +% could make some micro-gains probably but diverging from upstream code +% would make maintenance a nightmare. +% \item The |\bnumexpr\relax| syntax creating an empty ople is by itself now +% legal, and can be injected (comma separated) in an expression, keeping it +% invariant, however |\bnumeval{}| ends in a |File ended while scanning use +% of \BNE_print_c| error because |\BNEprint| makes the tacit requirement +% that the 1D ople to output has at least one item. +% \item Formerly, the |\csname...\endcsname| encapsulation technique had the +% after-effect to allow the macros supporting the infix operators to be only +% x-expandable. At |1.4|, I could have still allowed only x-expandable +% macros, but, keeping in sync with upstream, I have used only a +% |\romannumeral| trigger and did not insert an |\expanded|, so now the +% support macros must be f-expandable. The |1.4a| release fixes the related +% user documentation of |\bnumexprsetup| which was not updated at |1.4|. +% The support macro for the factorial however needs only be x-expandable. +% \item Also, I simply do not understand why the legacy user documentation +% said that the support macros were supposed to f-expand their arguments, as +% they are used only with arguments being explicit digit tokens (and +% optional minus sign). +% \item I hesitated a bit about making the decimal to hexadecimal and +% hexadecimal to decimal support macros customizable, but dropped the +% idea. Loading \xintbinhexname unconditionally has also the advantage to +% not have to define some \xintkernelname provided helper macros; and it +% still does not load \xintcorename, so is keeping dependencies somewhat low +% and the |custom| option significant. +% \item I had fleetingly consider a parser |\hexexpr| where input is +% hexadecimal with no |"| prefix, but implementing this basically means +% duplicating with new names a large chunk of the parser code to have parser +% specific |"getnext"| macros for example. Not worth it. +% \end{itemize} +% % \subsection{Package identification and catcode setup} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2021/05/12 v1.4 Expressions with big integers (JFB)]% +\ProvidesPackage{bnumexpr}[2021/05/13 v1.4a Expressions with big integers (JFB)]% % \end{macrocode} % \subsection{Load unconditionally xintbinhex} % Newly done at |1.4|. Formerly, \bnumname had no dependency if loaded % with option |custom|. But for |1.4| release I have decided to add % unconditional support for hexadecimal notation. % -% Let's require the most recent xint date at time of -% writing. We should check for availability of \string\expanded\space but well. +% Let's require the most recent \xintname date at time of +% writing. We should check for availability of |\expanded| but well. % % \begin{macrocode} \RequirePackage{xintbinhex}[2021/05/10]% @@ -858,6 +923,9 @@ output is handled, it goes necessarily via the \xintbinhexname macros. }% % \end{macrocode} % \subsection{Package options} +% The keys should have been |Add|, |Sub|, \dots, not |add|, |sub|, \dots, so +% internally macros |\BNE_Op_Add| etc\dots\ macro names would be used, but well, +% let's simply leave with this. % \begin{macrocode} \def\BNEtmpa {0}% \DeclareOption {custom}{\def\BNEtmpa {1}}% @@ -869,7 +937,8 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \RequirePackage{xintcore}[2021/05/10]% \bnumexprsetup{add=\xintiiAdd, sub=\xintiiSub, mul=\xintiiMul, divround=\xintiiDivRound, div=\xintiiDivFloor, - mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac}% + mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac, + opp=\xintiiOpp}% }% % \end{macrocode} % Strangely those three are not defined in xintkernel.sty, but only in xint.sty @@ -1148,12 +1217,17 @@ output is handled, it goes necessarily via the \xintbinhexname macros. }% }% \let\BNE_done\space +\def\BNE_getop_legacy #1% +{% + \expanded{\unexpanded{{#1}}\expandafter}\romannumeral`&&@\BNE_getop +}% \expandafter\BNE_tmpa \csname BNE_start\expandafter\endcsname \csname BNE_check\expandafter\endcsname \csname BNE_checkp\expandafter\endcsname \csname BNE_op_-xii\expandafter\endcsname \csname BNE_extra_)\endcsname +\catcode`) 11 \def\BNE_tmpa #1#2#3#4#5#6% {% \def #1##1% op_( @@ -1191,7 +1265,6 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \csname BNE_check-_)\expandafter\endcsname \csname BNE_checkp_)\expandafter\endcsname \csname BNE_op_-xii\endcsname -\catcode`) 11 \let\BNE_precedence_)\xint_c_i \def\BNE_missing_) {\XINT_expandableerror{Sorry to report a missing ) at the end of this journey.}% @@ -1199,6 +1272,11 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \catcode`) 12 % \end{macrocode} % \subsection{The comma as binary operator} +% At |1.4|, it is simply a union operator for 1D oples. Inserting directly +% here a |<space><comma>| separator (as in earlier releases) in accumulated +% result would avoid having to do it on output but to the cost of diverging +% from \xintexprname upstream code, and to have to let the |\evaltohex| output +% routine handle comma separated values rather than braced values. % \begin{macrocode} \def\BNE_tmpa #1#2#3#4#5% {% @@ -1234,6 +1312,15 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \expandafter\let\csname BNE_precedence_,\endcsname\xint_c_iii % \end{macrocode} % \subsection{The minus as prefix operator of variable precedence level} +% This |\BNE_Op_opp| causes trouble as at |1.4| it must be f-expandable, +% whereas earlier it expanded inside |\csname...\endcsname| context, so I +% could define it as {\catcode`\#12 |\if-#1\else\if0#10\else-#1\fi\fi|} where +% {\catcode`\#12 |#1|} was the +% first token of unbraced argument but this meant at |1.4| an added +% |\xint_firstofone| here. Well let's return to sanity at |1.4a| and not add +% the |\xint_firstofone| and simply default |\BNE_Op_opp| to |\xintiiOpp|, +% which it should have been all along! And on this occasion let's trim user +% documentation of irrelevant complications. % \begin{macrocode} \def\BNE_tmpb #1#2#3#4#5% {% @@ -1245,7 +1332,7 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \def #2##1##2##3% \BNE_exec_-<level> {% \expandafter ##1\expandafter ##2\expandafter - {\expandafter{\romannumeral`&&@\expandafter\BNE_Op_opp\xint_firstofone##3}}% + {\expandafter{\romannumeral`&&@\BNE_Op_opp##3}}% }% \def #3##1% \BNE_check-_-<level> {% @@ -1277,9 +1364,15 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \BNE_tmpa {xiv}% \BNE_tmpa {xvi}% \BNE_tmpa {xviii}% -\def\BNE_Op_opp #1{\if-#1\else\if0#10\else-#1\fi\fi }% % \end{macrocode} % \subsection{The infix operators.} +% I could have at the |1.4| refactoring injected usage of |\expanded| here, +% but kept in sync with upstream \xintexprname code. +% +% Macro names are somewhat bad and there is much risk of confusion in future +% maintenance of |\BNE_Op_| prefix (used for |\BNE_Op_add| etc...; besides +% this should have been |\BNE_Op_Add|) and |\BNE_op_| prefix (used for +% {\catcode`+ 11 |\BNE_op_+|} etc...). % \begin{macrocode} \def\BNE_defbin_c #1#2#3#4#5#6#7% {% @@ -1337,6 +1430,7 @@ output is handled, it goes necessarily via the \xintbinhexname macros. \expandafter\let\csname BNE_precedence_***\endcsname \xint_c_xvi % \end{macrocode} % \subsection{! as postfix factorial operator} +% This one uses |\expanded|. % \begin{macrocode} \catcode`! 11 \let\BNE_precedence_! \xint_c_xx @@ -1354,23 +1448,8 @@ output is handled, it goes necessarily via the \xintbinhexname macros. % \MakePercentComment %</package> %<*dtx> -\DeleteShortVerb{\|} -\CharacterTable - {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z - Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z - Digits \0\1\2\3\4\5\6\7\8\9 - Exclamation \! Double quote \" Hash (number) \# - Dollar \$ Percent \% Ampersand \& - Acute accent \' Left paren \( Right paren \) - Asterisk \* Plus \+ Comma \, - Minus \- Point \. Solidus \/ - Colon \: Semicolon \; Less than \< - Equals \= Greater than \> Question mark \? - Commercial at \@ Left bracket \[ Backslash \\ - Right bracket \] Circumflex \^ Underscore \_ - Grave accent \` Left brace \{ Vertical bar \| - Right brace \} Tilde \~} -\CheckSum {949} -\makeatletter\check@checksum\makeatother -\Finale +\DeleteShortVerb{\|}% +\CheckSum {947}% +\makeatletter\check@checksum\makeatother% +\Finale% %% End of file xint.dtx diff --git a/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty b/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty index 708694b02e5..3b20e0cdc29 100644 --- a/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty +++ b/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty @@ -25,7 +25,7 @@ %% Copyright (C) 2014-2021 by Jean-Francois Burnol %% \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2021/05/12 v1.4 Expressions with big integers (JFB)]% +\ProvidesPackage{bnumexpr}[2021/05/13 v1.4a Expressions with big integers (JFB)]% \RequirePackage{xintbinhex}[2021/05/10]% {\catcode`! 3 \catcode`_ 11 % \gdef\bnumexprsetup #1{\BNE_parsekeys #1,=!,}% @@ -48,7 +48,8 @@ \RequirePackage{xintcore}[2021/05/10]% \bnumexprsetup{add=\xintiiAdd, sub=\xintiiSub, mul=\xintiiMul, divround=\xintiiDivRound, div=\xintiiDivFloor, - mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac}% + mod=\xintiiMod, pow=\xintiiPow, fac=\xintiiFac, + opp=\xintiiOpp}% }% \long\def\xint_firstofthree #1#2#3{#1}% \long\def\xint_secondofthree #1#2#3{#2}% @@ -302,12 +303,17 @@ }% }% \let\BNE_done\space +\def\BNE_getop_legacy #1% +{% + \expanded{\unexpanded{{#1}}\expandafter}\romannumeral`&&@\BNE_getop +}% \expandafter\BNE_tmpa \csname BNE_start\expandafter\endcsname \csname BNE_check\expandafter\endcsname \csname BNE_checkp\expandafter\endcsname \csname BNE_op_-xii\expandafter\endcsname \csname BNE_extra_)\endcsname +\catcode`) 11 \def\BNE_tmpa #1#2#3#4#5#6% {% \def #1##1% op_( @@ -345,7 +351,6 @@ \csname BNE_check-_)\expandafter\endcsname \csname BNE_checkp_)\expandafter\endcsname \csname BNE_op_-xii\endcsname -\catcode`) 11 \let\BNE_precedence_)\xint_c_i \def\BNE_missing_) {\XINT_expandableerror{Sorry to report a missing ) at the end of this journey.}% @@ -393,7 +398,7 @@ \def #2##1##2##3% \BNE_exec_-<level> {% \expandafter ##1\expandafter ##2\expandafter - {\expandafter{\romannumeral`&&@\expandafter\BNE_Op_opp\xint_firstofone##3}}% + {\expandafter{\romannumeral`&&@\BNE_Op_opp##3}}% }% \def #3##1% \BNE_check-_-<level> {% @@ -425,7 +430,6 @@ \BNE_tmpa {xiv}% \BNE_tmpa {xvi}% \BNE_tmpa {xviii}% -\def\BNE_Op_opp #1{\if-#1\else\if0#10\else-#1\fi\fi }% \def\BNE_defbin_c #1#2#3#4#5#6#7% {% \def #1##1% \BNE_op_<op> |