From 809ee2bda7e5afc20f6e22fe1d7a322af86b225e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 23 Sep 2014 21:34:07 +0000 Subject: bnumexpr (23sep14) git-svn-id: svn://tug.org/texlive/trunk@35239 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/bnumexpr/README | 125 +++-- .../texmf-dist/doc/latex/bnumexpr/bnumexpr.changes | 28 ++ Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf | Bin 82370 -> 93887 bytes .../texmf-dist/doc/latex/bnumexpr/bnumexpr.readme | 120 +++++ Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex | 9 +- .../texmf-dist/source/latex/bnumexpr/bnumexpr.dtx | 555 ++++++++++++--------- .../texmf-dist/source/latex/bnumexpr/bnumexpr.ins | 10 +- Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty | 67 ++- 8 files changed, 613 insertions(+), 301 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.changes create mode 100644 Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.readme (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/bnumexpr/README b/Master/texmf-dist/doc/latex/bnumexpr/README index 6579fbceaf6..f79a2c871cb 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/README +++ b/Master/texmf-dist/doc/latex/bnumexpr/README @@ -1,33 +1,21 @@ -The bnumexpr package -Version: 2014/09/21, v1.1 -Info: Expressions with big integers - -Copyright (C) 2014 by Jean-Francois Burnol - -This work may be distributed and/or modified under the -conditions of the LaTeX Project Public License, either -version 1.3c of this license or (at your option) any later -version. This version of this license is in - http://www.latex-project.org/lppl/lppl-1-3c.txt -and the latest version of this license is in - http://www.latex-project.org/lppl.txt -and version 1.3 or later is part of all distributions of -LaTeX version 2005/12/01 or later. - -This work has the LPPL maintenance status "maintained". - -This Current Maintainer of this work is Jean-Francois Burnol. - -This work consists of the main source file bnumexpr.dtx -and the derived files - bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex +%%---------------------------------------------------------------- +%% The bnumexpr package: Expressions with big integers +%% Copyright (C) 2014 by Jean-Francois Burnol +%%---------------------------------------------------------------- +Source: bnumexpr.dtx +Version: v1.1a, 2014/09/22 +Author: Jean-Francois Burnol +Info: Expressions with big integers +License: LPPL 1.3c or later + +This README file: Usage, Installation, License Usage ===== \usepackage{bnumexpr} -Then \thebnumexpr \relax is like +Then \thebnumexpr \relax is like \the\numexpr \relax with the difference of accepting or producing arbitrarily big integers. @@ -39,43 +27,63 @@ outputs: which would create an arithmetic overflow in \numexpr. \bnumexpr...\relax is a scaled down version of \xintiiexpr...\relax -from package xintexpr. +from package xintexpr. By default, bnumexpr.sty loads xint.sty for its arithmetic macros -doing addition, subtraction, multiplication, division. +doing addition, subtraction, multiplication, division. + +- with option custom, xint.sty is not loaded and it is up to the +user to define \bnumexprAdd, \bnumexprSub, \bnumexprMul, \bnumexprDiv -With option custom, xint.sty is not loaded and it is up to the user -to define \bnumexprAdd, \bnumexprSub, \bnumexprMul, \bnumexprDiv +- option bigintcalc loads the package of the same name and uses +its arithmetic macros, -Option bigintcalc maps them to the macros from package bigintcalc. +- option l3bigint similarly with package l3bigint, which is +downloadable from the development repository of the on-going +LaTeX3 project. -Option allowpower enables ^ as power operator. +Option allowpower enables ^ as power operator (only for xint and +bigintcalc currently). Installation ============ -obtain bnumexpr.dtx, bnumexpr.ins and the README from CTAN: - http://www.ctan.org/pkg/bnumexpr +Obtain bnumexpr.dtx (and possibly, bnumexpr.ins and the README) +from CTAN: + http://www.ctan.org/pkg/bnumexpr + +To generate files from the source bnumexpr.dtx: + + - with bnumexpr.ins: "tex bnumexpr.ins" in the same repertory as + bnumexpr.dtx will create (or overwrite) the files in this repertory. + + - without bnumexpr.ins: "tex bnumexpr.dtx" also extracts the files. + + * bnumexpr.sty is the style file -- "tex bnumexpr.ins" generates the style file -(pre-existing file in the same repertory will be overwritten). + * bnumexpr.readme reconstitutes this README. -- without bnumexpr.ins: "tex or latex or pdflatex or xelatex bnumexpr.dtx" -will also generate the style files (and bnumexpr.ins). + * bnumexpr.changes lists changes since last version. -bnumexpr.tex is also extracted, use it for the documentation: + * bnumexpr.tex is used for generating the documentation: -- with latex+dvipdfmx: latex bnumexpr.tex thrice then dvipdfmx bnumexpr.dvi -Ignore dvipdfmx warnings, but if the pdf file has problems with fonts -(possibly from an old dvipdfmx), use then rather pdflatex or xelatex. + - with latex+dvipdfmx: + "latex bnumexpr.tex" (thrice) then "dvipdfmx bnumexpr.dvi" + Ignore dvipdfmx warnings, but if the pdf file has problems with + fonts (possibly from an old dvipdfmx), use then rather pdflatex. -- with pdflatex or xelatex: run it directly thrice on bnumexpr.dtx, or run -it on bnumexpr.tex after having edited the suitable toggle therein. + - with pdflatex: + set the suitable toggle in bnumexpr.tex to disable dvipdfmx + settings and compile it with pdflatex (thrice). -Finishing the installation: (on first installation the destination -repertories may need to be created) + * without bnumexpr.tex: - bnumexpr.sty --> TDS:tex/latex/bnumexpr/ + pdflatex bnumexpr.dtx (thrice) generates simultaneously the style + file and the pdf documentation. + +Finishing the installation: + + bnumexpr.sty --> TDS:tex/latex/bnumexpr/ bnumexpr.dtx --> TDS:source/latex/bnumexpr/ bnumexpr.ins --> TDS:source/latex/bnumexpr/ @@ -83,3 +91,30 @@ repertories may need to be created) bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ README --> TDS:doc/latex/bnumexpr/ +Files bnumexpr.tex, bnumexpr.changes, bnumexpr.readme may be discarded. + +License +======= + +Copyright (C) 2014 by Jean-Francois Burnol (jfbu at free dot fr) + +This Work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3c of this license or (at your option) any later +version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt +and the latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This Work has the LPPL maintenance status "maintained". + +The Current Maintainer of this Work is Jean-Francois Burnol. + +This Work consists of the main source file bnumexpr.dtx +and the derived files + bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, + bnumexpr.changes, bnumexpr.readme + +End of README file. diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.changes b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.changes new file mode 100644 index 00000000000..024f53f7954 --- /dev/null +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.changes @@ -0,0 +1,28 @@ +%%---------------------------------------------------------------- +%% The bnumexpr package: Expressions with big integers +%% Copyright (C) 2014 by Jean-Francois Burnol +%%---------------------------------------------------------------- +%% This is a generated file. +%% +%% For distribution see the terms in the source file bnumexpr.dtx. +%% +\item[1.1a (2014/09/22)] \begin{itemize} + \item added |l3bigint| option to use experimental \LaTeX3 + package of the same name. + + \item added Changes and Readme sections to the documentation. + + \item better |\BNE_protect| mechanism for use of + |\bnumexpr...\relax| inside an |\edef| (without |\bnethe|). Previous one, + inherited from |xintexpr.sty 1.09n|, assumed that the |\.=| dummy + control sequence encapsulating the computation result had |\relax| + meaning. But removing this assumption was only a matter of letting + |\BNE_protect| protect two, not one, tokens. This will be backported to + next version of |xintexpr.sty|, naturally. + \end{itemize} +\item[1.1 (2014/09/21)] First release. This is down-scaled from the + (development version of) |xintexpr.sty|. Motivation came the previous day + from a chat with \textsc{Joseph Wright} over big int status in \LaTeX3. + The |\bnumexpr...\relax| parser can be used on top of big int macros of + one's choice. Functionalities limited to the basic operations. I leave + the power operator |^| as an option. diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf index 22235b4a02f..2792d382b19 100644 Binary files a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf and b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.pdf differ diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.readme b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.readme new file mode 100644 index 00000000000..f79a2c871cb --- /dev/null +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.readme @@ -0,0 +1,120 @@ +%%---------------------------------------------------------------- +%% The bnumexpr package: Expressions with big integers +%% Copyright (C) 2014 by Jean-Francois Burnol +%%---------------------------------------------------------------- +Source: bnumexpr.dtx +Version: v1.1a, 2014/09/22 +Author: Jean-Francois Burnol +Info: Expressions with big integers +License: LPPL 1.3c or later + +This README file: Usage, Installation, License + +Usage +===== + +\usepackage{bnumexpr} + +Then \thebnumexpr \relax is like + \the\numexpr \relax +with the difference of accepting or producing arbitrarily big +integers. + +Example: + \thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax +outputs: + -202785405180 +which would create an arithmetic overflow in \numexpr. + +\bnumexpr...\relax is a scaled down version of \xintiiexpr...\relax +from package xintexpr. + +By default, bnumexpr.sty loads xint.sty for its arithmetic macros +doing addition, subtraction, multiplication, division. + +- with option custom, xint.sty is not loaded and it is up to the +user to define \bnumexprAdd, \bnumexprSub, \bnumexprMul, \bnumexprDiv + +- option bigintcalc loads the package of the same name and uses +its arithmetic macros, + +- option l3bigint similarly with package l3bigint, which is +downloadable from the development repository of the on-going +LaTeX3 project. + +Option allowpower enables ^ as power operator (only for xint and +bigintcalc currently). + +Installation +============ + +Obtain bnumexpr.dtx (and possibly, bnumexpr.ins and the README) +from CTAN: + http://www.ctan.org/pkg/bnumexpr + +To generate files from the source bnumexpr.dtx: + + - with bnumexpr.ins: "tex bnumexpr.ins" in the same repertory as + bnumexpr.dtx will create (or overwrite) the files in this repertory. + + - without bnumexpr.ins: "tex bnumexpr.dtx" also extracts the files. + + * bnumexpr.sty is the style file + + * bnumexpr.readme reconstitutes this README. + + * bnumexpr.changes lists changes since last version. + + * bnumexpr.tex is used for generating the documentation: + + - with latex+dvipdfmx: + "latex bnumexpr.tex" (thrice) then "dvipdfmx bnumexpr.dvi" + Ignore dvipdfmx warnings, but if the pdf file has problems with + fonts (possibly from an old dvipdfmx), use then rather pdflatex. + + - with pdflatex: + set the suitable toggle in bnumexpr.tex to disable dvipdfmx + settings and compile it with pdflatex (thrice). + + * without bnumexpr.tex: + + pdflatex bnumexpr.dtx (thrice) generates simultaneously the style + file and the pdf documentation. + +Finishing the installation: + + bnumexpr.sty --> TDS:tex/latex/bnumexpr/ + + bnumexpr.dtx --> TDS:source/latex/bnumexpr/ + bnumexpr.ins --> TDS:source/latex/bnumexpr/ + + bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ + README --> TDS:doc/latex/bnumexpr/ + +Files bnumexpr.tex, bnumexpr.changes, bnumexpr.readme may be discarded. + +License +======= + +Copyright (C) 2014 by Jean-Francois Burnol (jfbu at free dot fr) + +This Work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3c of this license or (at your option) any later +version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt +and the latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This Work has the LPPL maintenance status "maintained". + +The Current Maintainer of this Work is Jean-Francois Burnol. + +This Work consists of the main source file bnumexpr.dtx +and the derived files + bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, + bnumexpr.changes, bnumexpr.readme + +End of README file. diff --git a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex index de20c8461aa..cd1ef3205b6 100644 --- a/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex +++ b/Master/texmf-dist/doc/latex/bnumexpr/bnumexpr.tex @@ -1,6 +1,6 @@ -\def\bnedocdate {2014/09/21} % package bnumexpr documentation date -\def\bnepackdate{2014/09/21} % package bnumexpr date -\def\bneversion {1.1} % package bnumexpr version +\def\bnedocdate {2014/09/22} % package bnumexpr documentation date +\def\bnepackdate{2014/09/22} % package bnumexpr date +\def\bneversion {1.1a} % package bnumexpr version %%---------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers %% Copyright (C) 2014 by Jean-Francois Burnol @@ -8,8 +8,9 @@ %% This is a generated file. %% %% latex bnumexpr.tex (thrice) && dvipdfmx bnumexpr.dvi --> bnumexpr.dtx +%% for pdflatex, set the \Withdvipdfmx toggle below to 0 %% -%% See bnumexpr.dtx for the copyright and license statements. +%% For distribution see the terms in the source file bnumexpr.dtx. %% \NeedsTeXFormat{LaTeX2e} \ProvidesFile{bnumexpr.tex}% diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx index 2f9a8666495..8d07850f7fd 100644 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx +++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx @@ -1,111 +1,168 @@ % -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*- -%<*dtx> -\def\bnedtxtimestamp {Time-stamp: <21-09-2014 at 15:24:58 CEST>} -% -% -% File: bnumexpr.dtx -% Version: 2014/09/21, v1.1 -% Info: Expressions with big integers -% -% Copyright (C) 2014 by Jean-Francois Burnol -% -% This work may be distributed and/or modified under the -% conditions of the LaTeX Project Public License, either -% version 1.3c of this license or (at your option) any later -% version. This version of this license is in -% http://www.latex-project.org/lppl/lppl-1-3c.txt -% and the latest version of this license is in -% http://www.latex-project.org/lppl.txt -% and version 1.3 or later is part of all distributions of -% LaTeX version 2005/12/01 or later. -% -% This work has the LPPL maintenance status "maintained". -% -% This Current Maintainer of this work is Jean-Francois Burnol. -% -% This work consists of the main source file bnumexpr.dtx -% and the derived files -% bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex -% -% Usage -% ===== -% -% \usepackage{bnumexpr} -% -% Then \thebnumexpr \relax is like -% \the\numexpr \relax -% with the difference of accepting or producing arbitrarily big -% integers. -% -% Example: -% \thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax -% outputs: -% -202785405180 -% which would create an arithmetic overflow in \numexpr. -% -% \bnumexpr...\relax is a scaled down version of \xintiiexpr...\relax -% from package xintexpr. -% -% By default, bnumexpr.sty loads xint.sty for its arithmetic macros -% doing addition, subtraction, multiplication, division. -% -% With option custom, xint.sty is not loaded and it is up to the user -% to define \bnumexprAdd, \bnumexprSub, \bnumexprMul, \bnumexprDiv -% -% Option bigintcalc maps them to the macros from package bigintcalc. -% -% Option allowpower enables ^ as power operator. -% -% Installation -% ============ -% -% obtain bnumexpr.dtx, bnumexpr.ins and the README from CTAN: -% http://www.ctan.org/pkg/bnumexpr -% -% - "tex bnumexpr.ins" generates the style file -% (pre-existing file in the same repertory will be overwritten). -% -% - without bnumexpr.ins: "tex or latex or pdflatex or xelatex bnumexpr.dtx" -% will also generate the style files (and bnumexpr.ins). -% -% bnumexpr.tex is also extracted, use it for the documentation: -% -% - with latex+dvipdfmx: latex bnumexpr.tex thrice then dvipdfmx bnumexpr.dvi -% Ignore dvipdfmx warnings, but if the pdf file has problems with fonts -% (possibly from an old dvipdfmx), use then rather pdflatex or xelatex. -% -% - with pdflatex or xelatex: run it directly thrice on bnumexpr.dtx, or run -% it on bnumexpr.tex after having edited the suitable toggle therein. -% -% Finishing the installation: (on first installation the destination -% repertories may need to be created) -% -% bnumexpr.sty --> TDS:tex/latex/bnumexpr/ -% -% bnumexpr.dtx --> TDS:source/latex/bnumexpr/ -% bnumexpr.ins --> TDS:source/latex/bnumexpr/ -% -% bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ -% README --> TDS:doc/latex/bnumexpr/ -% %<*drv> -\def\bnedocdate {2014/09/21} % package bnumexpr documentation date -\def\bnepackdate{2014/09/21} % package bnumexpr date -\def\bneversion {1.1} % package bnumexpr version +\def\bnedocdate {2014/09/22} % package bnumexpr documentation date +\def\bnepackdate{2014/09/22} % package bnumexpr date +\def\bneversion {1.1a} % package bnumexpr version % +%<*dtx> +\def\bnedtxtimestamp {Time-stamp: <22-09-2014 at 23:21:33 CEST>} +\iffalse +% %%---------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers %% Copyright (C) 2014 by Jean-Francois Burnol %%---------------------------------------------------------------- -%<*dtx> -\iffalse -% -%<*drv>---------------------------------------------------------------------- +%<*readme>-------------------------------------------------------- +Source: bnumexpr.dtx +Version: v1.1a, 2014/09/22 +Author: Jean-Francois Burnol +Info: Expressions with big integers +License: LPPL 1.3c or later + +This README file: Usage, Installation, License + +Usage +===== + +\usepackage{bnumexpr} + +Then \thebnumexpr \relax is like + \the\numexpr \relax +with the difference of accepting or producing arbitrarily big +integers. + +Example: + \thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax +outputs: + -202785405180 +which would create an arithmetic overflow in \numexpr. + +\bnumexpr...\relax is a scaled down version of \xintiiexpr...\relax +from package xintexpr. + +By default, bnumexpr.sty loads xint.sty for its arithmetic macros +doing addition, subtraction, multiplication, division. + +- with option custom, xint.sty is not loaded and it is up to the +user to define \bnumexprAdd, \bnumexprSub, \bnumexprMul, \bnumexprDiv + +- option bigintcalc loads the package of the same name and uses +its arithmetic macros, + +- option l3bigint similarly with package l3bigint, which is +downloadable from the development repository of the on-going +LaTeX3 project. + +Option allowpower enables ^ as power operator (only for xint and +bigintcalc currently). + +Installation +============ + +Obtain bnumexpr.dtx (and possibly, bnumexpr.ins and the README) +from CTAN: + http://www.ctan.org/pkg/bnumexpr + +To generate files from the source bnumexpr.dtx: + + - with bnumexpr.ins: "tex bnumexpr.ins" in the same repertory as + bnumexpr.dtx will create (or overwrite) the files in this repertory. + + - without bnumexpr.ins: "tex bnumexpr.dtx" also extracts the files. + + * bnumexpr.sty is the style file + + * bnumexpr.readme reconstitutes this README. + + * bnumexpr.changes lists changes since last version. + + * bnumexpr.tex is used for generating the documentation: + + - with latex+dvipdfmx: + "latex bnumexpr.tex" (thrice) then "dvipdfmx bnumexpr.dvi" + Ignore dvipdfmx warnings, but if the pdf file has problems with + fonts (possibly from an old dvipdfmx), use then rather pdflatex. + + - with pdflatex: + set the suitable toggle in bnumexpr.tex to disable dvipdfmx + settings and compile it with pdflatex (thrice). + + * without bnumexpr.tex: + + pdflatex bnumexpr.dtx (thrice) generates simultaneously the style + file and the pdf documentation. + +Finishing the installation: + + bnumexpr.sty --> TDS:tex/latex/bnumexpr/ + + bnumexpr.dtx --> TDS:source/latex/bnumexpr/ + bnumexpr.ins --> TDS:source/latex/bnumexpr/ + + bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ + README --> TDS:doc/latex/bnumexpr/ + +Files bnumexpr.tex, bnumexpr.changes, bnumexpr.readme may be discarded. + +License +======= + +Copyright (C) 2014 by Jean-Francois Burnol (jfbu at free dot fr) + +This Work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3c of this license or (at your option) any later +version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt +and the latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This Work has the LPPL maintenance status "maintained". + +The Current Maintainer of this Work is Jean-Francois Burnol. + +This Work consists of the main source file bnumexpr.dtx +and the derived files + bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, + bnumexpr.changes, bnumexpr.readme + +End of README file. +%-------------------------------------------------------- +%<*changes>------------------------------------------------------- +%% This is a generated file. +%% +%% For distribution see the terms in the source file bnumexpr.dtx. +%% +\item[1.1a (2014/09/22)] \begin{itemize} + \item added |l3bigint| option to use experimental \LaTeX3 + package of the same name. + + \item added Changes and Readme sections to the documentation. + + \item better |\BNE_protect| mechanism for use of + |\bnumexpr...\relax| inside an |\edef| (without |\bnethe|). Previous one, + inherited from |xintexpr.sty 1.09n|, assumed that the |\.=| dummy + control sequence encapsulating the computation result had |\relax| + meaning. But removing this assumption was only a matter of letting + |\BNE_protect| protect two, not one, tokens. This will be backported to + next version of |xintexpr.sty|, naturally. + \end{itemize} +\item[1.1 (2014/09/21)] First release. This is down-scaled from the + (development version of) |xintexpr.sty|. Motivation came the previous day + from a chat with \textsc{Joseph Wright} over big int status in \LaTeX3. + The |\bnumexpr...\relax| parser can be used on top of big int macros of + one's choice. Functionalities limited to the basic operations. I leave + the power operator |^| as an option. +%------------------------------------------------------- +%<*drv>----------------------------------------------------------- %% This is a generated file. %% %% latex bnumexpr.tex (thrice) && dvipdfmx bnumexpr.dvi --> bnumexpr.dtx +%% for pdflatex, set the \Withdvipdfmx toggle below to 0 %% -%% See bnumexpr.dtx for the copyright and license statements. +%% For distribution see the terms in the source file bnumexpr.dtx. %% \NeedsTeXFormat{LaTeX2e} \ProvidesFile{bnumexpr.tex}% @@ -118,18 +175,20 @@ %%% Local Variables: %%% mode: latex %%% End: -%---------------------------------------------------------------------- -%<*ins>------------------------------------------------------------------------- +%----------------------------------------------------------- +%<*ins>----------------------------------------------------------- %% This is a generated file. %% -%% tex bnumexpr.ins will extract bnumexpr.sty and bnumexpr.tex -%% from source file bnumexpr.dtx +%% tex bnumexpr.ins will extract bnumexpr.sty from bnumexpr.dtx %% -%% See bnumexpr.dtx for the copyright and license statements. +%% For distribution see the terms in the source file bnumexpr.dtx. %% \input docstrip.tex \askforoverwritefalse -\generate{\nopreamble +\generate{\nopreamble\nopostamble +\file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} +\file{bnumexpr.readme}{\from{bnumexpr.dtx}{readme}} +\usepostamble\defaultpostamble \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} \usepreamble\defaultpreamble \file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} @@ -149,9 +208,9 @@ \Msg{*} \Msg{************************************************************************} \endbatchfile -%------------------------------------------------------------------------- +%----------------------------------------------------------- %<*dtx> -\fi % end of \iffalse block +\fi % end of \iffalse block around generated files \chardef\noetex 0 \expandafter\ifx\csname numexpr\endcsname\relax \chardef\noetex 1 \fi \ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop @@ -162,11 +221,11 @@ \expandafter\ifx\csname Withdvipdfmx\endcsname\relax % latex run is on bnumexpr.dtx, we will extract all files \chardef\extractfiles 1 % 1 = extract and typeset, 2=only typeset - \chardef\Withdvipdfmx 0 % 1 = use dvipdfmx, 0 = use pdflatex + \chardef\Withdvipdfmx 0 % 1 = use dvipdfmx, 0 = use pdflatex \chardef\NoSourceCode 0 % 1 = do not include source code \NeedsTeXFormat{LaTeX2e}% \PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}% - \else % latex run is on etoc.tex, + \else % latex run is on bnumexpr.tex, \chardef\extractfiles 2 % no extractions \fi \ProvidesFile{bnumexpr.dtx}[bundle source (\bnedtxtimestamp)]% @@ -192,7 +251,10 @@ \begingroup \input docstrip.tex \askforoverwritefalse - \generate{\nopreamble + \generate{\nopreamble\nopostamble + \file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} + \file{bnumexpr.readme}{\from{bnumexpr.dtx}{readme}} + \usepostamble\defaultpostamble \file{bnumexpr.ins}{\from{bnumexpr.dtx}{ins}} \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} \usepreamble\defaultpreamble @@ -200,7 +262,7 @@ \endgroup \fi % end of file extraction \ifnum\extractfiles=0 -% direct tex/etex/xetex/etc on bnumexpr.dtx, files now extracted, stop +% direct tex/etex/xetex on bnumexpr.dtx, files now extracted, stop \MessageDeFin\expandafter\end \fi % no use of docstrip to extract files if latex compilation was on bnumexpr.tex @@ -255,8 +317,6 @@ \colorlet{jfverbcolor}{yellow!5} \usepackage[english]{babel} -\usepackage[autolanguage,np]{numprint} -\AtBeginDocument{\npthousandsep{,\hskip .5pt plus .1pt minus .1pt}} \usepackage[pdfencoding=pdfdoc]{hyperref} \hypersetup{% @@ -273,30 +333,6 @@ pdfstartview=FitH,% pdfpagemode=UseOutlines} \usepackage{bookmark} -%---- \centeredline: OUR OWN LITTLE MACRO FOR CENTERING LINES - -% 7 mars 2013 -% This macro allows to conveniently center a line inside a paragraph and still -% use therein \verb or other commands changing catcodes. -% A proposito, the \LaTeX \centerline uses \hsize and not \linewidth ! -% (which in my humble opinion is bad) - -% \ignorespaces ajouté le 9 juin. - -\makeatletter -\newcommand*\centeredline {% - \ifhmode \\\relax - \def\centeredline@{\hss\egroup\hskip\z@skip\ignorespaces }% - \else - \def\centeredline@{\hss\egroup }% - \fi - \afterassignment\@centeredline - \let\next=} -\def\@centeredline - {\hbox to \linewidth \bgroup \hss \bgroup \aftergroup\centeredline@ } -\makeatother - - %---- \verb, and verbatim like `environments'. \MicroFont et \MacroFont \def\MicroFont {\ttfamily } \def\MacroFont {\ttfamily\baselineskip12pt\relax} @@ -356,20 +392,20 @@ pdfpagemode=UseOutlines} \def\bnename {\texorpdfstring {\hyperref[sec:bnumexpr]% - {{\color{joli}\bfseries\ttfamily\hyphenchar\font45 bnumexpr}}} + {{\color{joli}\bfseries\ttfamily bnumexpr}}} {bnumexpr}% \xspace }% \def\bnenameimp {\texorpdfstring - {\hyperref[sec:bnumexprimp]% + {\hyperref[sec:bnumexprcode]% {{\color[named]{RoyalPurple}% - \bfseries\ttfamily\hyphenchar\font45 bnumexpr}}} + \bfseries\ttfamily bnumexpr}}} {bnumexpr}% \xspace }% \frenchspacing -% possible options: custom, bigintcalc, nocsv, notacitmul, allowpower +% possible options: custom, bigintcalc, l3bigint, nocsv, notacitmul, allowpower \usepackage[allowpower]{bnumexpr} \usepackage{etoc} @@ -397,6 +433,20 @@ pdfpagemode=UseOutlines} \etocsetnexttocdepth{section} \tableofcontents +\section{Readme} +\begingroup +\makeatletter\def\x{\baselineskip10pt + \ttfamily\settowidth\dimen@{X}% + %\parindent \dimexpr.5\linewidth-33\dimen@\relax + \let\do\do@noligs\verbatim@nolig@list + \let\do\@makeother\dospecials + \def\par{\leavevmode \null\@@par\penalty\interlinepenalty}% + \makestarlowast + \@vobeyspaces\obeylines + \noindent\kern\parindent\input bnumexpr.readme +\endgroup }\x + + \section{Introduction} \label{sec:bnumexpr} @@ -441,7 +491,7 @@ rounded division while |xint|'s |\xintiiQuo| does Euclidean division, \bnename contains a few extra code lines on top of the underlying division macros from |xint.sty|. -See the discussion of options |bigintcalc| and |custom| in +See the discussion of options |bigintcalc|, |l3bigint| and |custom| in \autoref{sec:options} for alternatives. The starting point for the |\bnumexpr| parser was not the |\xintiiexpr| version @@ -460,15 +510,7 @@ around in one-go the possibly hundreds of digits composing a number. \section{Options}\label{sec:options} -Option |bigintcalc| says to map the infix operators to the macros from -package \href{http://www.ctan.org/pkg/bigintcalc}{bigintcalc} by \textsc{Heiko - Oberdiek}. Note though that |/| is mapped to |\bigintcalcDiv| which does -\emph{truncated} (not rounded) division. - -Option |custom| leaves it up to the user to specify the macros to be used, -i.e. provide definitions for |\bnumexprAdd|, |\bnumexprSub|, |\bnumexprMul|, -|\bnumexprDiv| (and possibly |\bnumexprPow|). Without it, the package does by -default: +The package does by default: \begin{verbatim} \RequirePackage{xint} \let\bnumexprAdd\xintiiAdd @@ -477,8 +519,23 @@ default: %% \bnumexprDiv has custom definition on top of macros from xint.sty \let\bnumexprPow\xintiiPow % only if option allowpower \end{verbatim} -To let |/| do euclidean division (like currently in |\xintiiexpr|) it is -thus sufficient to do |\let\bnumexprDiv\xintiiQuo| after loading the package. +% To let |/| do euclidean division (like currently in |\xintiiexpr|) it is +% thus sufficient to do |\let\bnumexprDiv\xintiiQuo| after loading the package. + +Option |bigintcalc| says to not load \href{http://www.ctan.org/pkg/xint}{xint} +but to use rather the macros from package +\href{http://www.ctan.org/pkg/bigintcalc}{bigintcalc} +by \textsc{Heiko Oberdiek}. Note though that |/| is mapped to |\bigintcalcDiv| +which does \emph{truncated} (not rounded) division. + +Option |l3bigint| similarly says to use the macros which are provided with the +eponym package, a part of the development work of the +\href{http://latex-project.org/code.html}{\LaTeX3 project}. There is no power +operation available with this option. + +Option |custom| does not load any package and leaves it up to the user to +specify the macros to be used, i.e. provide definitions for |\bnumexprAdd|, +|\bnumexprSub|, |\bnumexprMul|, |\bnumexprDiv| (and possibly |\bnumexprPow|). If using option |custom|: the four arithmetic macros |\bnumexprAdd|, |\bnumexprSub|, |\bnumexprMul|, |\bnumexprDiv| (and possibly |\bnumexprPow|) @@ -491,7 +548,6 @@ those of |bigintcalc.sty|) are expandable in a stronger sense (only two expansion steps suffice). Perhaps speed gains are achievable from dropping these stronger requirements. - Option |nocsv| makes comma separated expressions illegal. Option |notacitmul| removes the possibility of tacit multiplication in front of @@ -499,64 +555,76 @@ parentheses, \string\count\space registers, sub-expressions. Option |allowpower| enables the |^| as power operator (left associative). +\section{Further commands} + +The package provides |\bnumexprUsesxint|, |\bnumexprUsesbigintcalc| and +|\bnumexprUsesliiibigint| which allow to use in the same document more than one +of the available big integer mathematical engines. + +It is up to the user to have issued the necessary |\usepackage| or +|\RequirePackage| in the preamble, and this may be done after having loaded +|bnumexpr.sty|. Recall that |xint| is loaded by default, but is not loaded in +case of one of the options |custom|, |bigintcalc|, |l3bigint|. + + \section{Examples} -\centeredline{|\thebnumexpr 128637867168*2187917891279\relax|} +\begin{flushleft}\parindent0pt \obeylines +|\thebnumexpr 128637867168*2187917891279\relax| % \thebnumexpr 128637867168*2187917891279\relax -\noindent\centeredline{|\thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax|} +|\thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax| % \thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax -\noindent\centeredline{|\newcount\cnta \cnta 123|} -\centeredline{|\the\numexpr \cnta*\cnta*\cnta\relax=\thebnumexpr \cnta*\cnta*\cnta\relax|} \newcount\cnta\cnta 123 -\the\numexpr \cnta*\cnta*\cnta\relax=\thebnumexpr \cnta*\cnta*\cnta\relax - -\noindent\centeredline{|\newcount\cntb \cntb 188|} -\centeredline{|\the\numexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax=|} -\centeredline{|\thebnumexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax|} \newcount\cntb \cntb 188 -\the\numexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax -=\thebnumexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax -\centeredline{|\the\numexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax=|} -\centeredline{|\thebnumexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax|} -\the\numexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax -=\thebnumexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax -\centeredline{|\the\numexpr 123/188*188\relax|, - |\the\numexpr 123/(188*188)\relax|,} -\centeredline{|\thebnumexpr 123/188*188\relax|, - |\thebnumexpr 123/(188*188)\relax|.} -\the\numexpr 123/188*188\relax, - \the\numexpr 123/(188*188)\relax, -\thebnumexpr 123/188*188\relax, - \thebnumexpr 123/(188*188)\relax. - -\noindent -\centeredline{|\edef\tmp {\bnumexpr 121873197*123-218137917*188\relax}|} -\centeredline{|\bnethe\tmp\ (\meaning\tmp)|} -\centeredline{|\thebnumexpr \tmp*(173197129797-\tmp)*(2179171982-\tmp)\relax|} -\edef\tmp {\bnumexpr 121873197*123-218137917*188\relax}% -\bnethe\tmp\ \mbox{(\meaning\tmp)}\\ + +|\newcount\cnta \cnta 123 \newcount\cntb \cntb 188| +% |\the\numexpr \cnta*\cnta*\cnta\relax| % +% \the\numexpr \cnta*\cnta*\cnta\relax {} +% |\the\bnumexpr \cnta*\cnta*\cnta\relax| % +% \thebnumexpr \cnta*\cnta*\cnta\relax {} +|\the\numexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax| % +\the\numexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax {} +|\thebnumexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax| % +\thebnumexpr \cnta*\cnta*\cnta/\cntb+\cntb*\cntb*\cntb/\cnta\relax {} + +% |\the\numexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax| +% \the\numexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax {} +% |\thebnumexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax| +% \thebnumexpr \cnta*\cnta*(\cnta/\cntb)+\cntb*\cntb*(\cntb/\cnta)\relax {} +|\the\numexpr 123/188*188\relax|, |\the\numexpr 123/(188*188)\relax|, % +|\thebnumexpr 123/188*188\relax|, |\thebnumexpr 123/(188*188)\relax|. +\the\numexpr 123/188*188\relax, \the\numexpr 123/(188*188)\relax, % +\thebnumexpr 123/188*188\relax, \thebnumexpr 123/(188*188)\relax. + +\edef\tmp {\bnumexpr 121873197*123-218137917*188\relax} +|\edef\tmp {\bnumexpr 121873197*123-218137917*188\relax}\bnethe\tmp| +\bnethe\tmp {} +|\meaning\tmp| +\meaning\tmp {} +|\thebnumexpr \tmp*(173197129797-\tmp)*(2179171982-\tmp)\relax| \thebnumexpr \tmp*(173197129797-\tmp)*(2179171982-\tmp)\relax -\noindent -\centeredline {|\cnta \thebnumexpr 2152966419779999/987654321\relax\space \the\cnta|} +|\cnta \thebnumexpr 2152966419779999/987654321\relax\space| +|\the\cnta| % \cnta \thebnumexpr 2152966419779999/987654321\relax\space \the\cnta -\noindent -\centeredline {|\thebnumexpr 2179878*987654321-2152966419779999,2179879*987654321-2152966419779999\relax|} -\thebnumexpr 2179878*987654321-2152966419779999,2179879*987654321-2152966419779999\relax\ (there was indeed rounding of the exact quotient) +|\thebnumexpr 2179878*987654321-2152966419779999, 2179879*987654321-2152966419779999\relax| % +\thebnumexpr 2179878*987654321-2152966419779999,2179879*987654321-2152966419779999\relax\ \ \ (there was indeed rounding of the exact quotient.) -\medskip -\noindent -An example with the power operator |^| (option |allowpower|): -\centeredline {|\thebnumexpr (1^10+2^10+3^10+4^10+5^10+6^10)^3\relax|} +An example with the power operator |^| (option |allowpower|, not compatible with +|l3bigint|): % +|\thebnumexpr (1^10+2^10+3^10+4^10+5^10+6^10)^3\relax| % \thebnumexpr (1^10+2^10+3^10+4^10+5^10+6^10)^3\relax +\end{flushleft} \StopEventually{\end{document}\endinput} -\newgeometry{hscale=0.75} +\newgeometry{hscale=0.75,vscale=0.75}% ATTENTION \newgeometry fait + % un reset de vscale si on ne le + % précise pas ici !!! \MakePercentIgnore % @@ -567,6 +635,7 @@ An example with the power operator |^| (option |allowpower|): %<*package> % % \section{Package \bnenameimp implementation} +% \label{sec:bnumexprcode} % % \localtableofcontents \bigskip % @@ -575,18 +644,17 @@ An example with the power operator |^| (option |allowpower|): % control sequence attempts to trigger writing to the log of some sort of % informative message. It is recommended to set |\errorcontextlines| to at % least |2| for more meaningful context. -% \label{sec:bnumexprimp} % \subsection{Package identification and catcode setup} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2014/09/21 v1.1 Expressions with big integers (jfB)]% +\ProvidesPackage{bnumexpr}[2014/09/22 v1.1a Expressions with big integers (jfB)]% \edef\BNErestorecatcodes {\catcode`\noexpand\!\the\catcode`\! \catcode`\noexpand\?\the\catcode`\? \catcode`\noexpand\_\the\catcode`\_ \catcode`\noexpand\:\the\catcode`\:\relax }% -\catcode`\! 11 -\catcode`\? 11 -\catcode`\_ 11 +\catcode`\! 11 % some other catcodes will be manipulated: comma, (, ), +\catcode`\? 11 % but we reset them to their standard values, thus +\catcode`\_ 11 % \BNErestorecatcodes is a bit pedantic here. \catcode`\: 11 % \end{macrocode} % \subsection{Package options} @@ -603,6 +671,11 @@ An example with the power operator |^| (option |allowpower|): Option bigintcalc: the macros from package bigintcalc are used.^^J Notice that / is mapped to \protect\bigintcalcDiv\space which does truncated division}% }% +\DeclareOption {l3bigint}{\def\BNE_tmpa {3}% + \PackageWarningNoLine{bnumexpr}{^^J + Option l3bigint: the macros from package l3bigint are used.^^J + There is no power operation, currently}% +}% \DeclareOption {nocsv}{% \PackageInfo{bnumexpr}{Comma separated expressions disabled}% \AtEndOfPackage{\expandafter\let\csname BNE_precedence_,\endcsname @@ -619,36 +692,49 @@ An example with the power operator |^| (option |allowpower|): }% \ProcessOptions\relax % \end{macrocode} -% \subsection{Mapping to the arithmetic routines.} +% \subsection{Mapping to an underlying big integer engine.} +% In case option |bigintcalc| is used, notice that |/| is mapped to the macro +% |\bigintcalcDiv| which does truncated division. We did not add the extra code +% for rounded division in that case. +% +% With option |l3bigint|, there is no power operation available currently. +% Furthermore the package is part of the experimental trunk of the \LaTeX3 +% project hence the names of its macros could change. +% \begin{macrocode} +\def\bnumexprUsesxint {% + \let\bnumexprAdd\xintiiAdd + \let\bnumexprSub\xintiiSub + \let\bnumexprMul\xintiiMul + \let\bnumexprDiv\BNE_xintiiDivRound + \let\bnumexprPow\xintiiPow +}% +\def\bnumexprUsesbigintcalc {% + \let\bnumexprAdd\bigintcalcAdd + \let\bnumexprSub\bigintcalcSub + \let\bnumexprMul\bigintcalcMul + \let\bnumexprDiv\bigintcalcDiv % NOTE: THIS DOES TRUNCATED DIVISION + \let\bnumexprPow\bigintcalcPow +}% +\def\bnumexprUsesliiibigint {% + \let\bnumexprAdd\bigint_add:nn + \let\bnumexprSub\bigint_sub:nn + \let\bnumexprMul\bigint_mul:nn + \let\bnumexprDiv\bigint_div_round:nn + \let\bnumexprPow\bigint_pow:nn % does not exist! +}% +% \end{macrocode} % The |\xintiiQuo| macro from |xint.sty| does Euclidean division. Rounded -% division is available from |xintfrac.sty|, rather than loading it, we define -% directly here |\bnumexprDiv| as a suitable wrapper to the |xint.sty| division -% macros, to achieve, not really economically, rounded division. +% division is available from |xintfrac.sty|, but rather than loading it, we +% define directly here |\bnumexprDiv| as a suitable wrapper to the |xint.sty| +% division macros. This, or something similar, should be incorporated in next +% release of |xint|. % % Current CTAN version of |xint| (1.09n) has some sub-optimal code for dealing % with the signs of the divisor and dividend, this has been improved in -% development version 1.1, not yet released at time of writing. -% -% In case option |bigintcalc| is used, notice that |/| is mapped to the macro -% |\bigintcalcDiv| which does truncated division. We did not add the extra code -% for rounded division in that case. +% development version 1.1, which we follow here. % \begin{macrocode} -\if2\BNE_tmpa % Toggle to load bigintcalc.sty -\RequirePackage{bigintcalc}% -\let\bnumexprAdd\bigintcalcAdd -\let\bnumexprSub\bigintcalcSub -\let\bnumexprMul\bigintcalcMul -\let\bnumexprDiv\bigintcalcDiv % NOTE: THIS DOES TRUNCATED DIVISION -\if1\BNE_allowpower\let\bnumexprPow\bigintcalcPow\fi -\fi -\if0\BNE_tmpa % Toggle to load xint.sty (and also xinttools.sty) -\RequirePackage{xint}% -\let\bnumexprAdd\xintiiAdd -\let\bnumexprSub\xintiiSub -\let\bnumexprMul\xintiiMul -\if1\BNE_allowpower\let\bnumexprPow\xintiiPow\fi -\def\bnumexprDiv {\romannumeral0\bnumexprdiv }% -\def\bnumexprdiv #1{\expandafter\BNE_div \romannumeral-`0#1\Z }% +\def\BNE_xintiiDivRound {\romannumeral0\BNE_xintiidivround }% +\def\BNE_xintiidivround #1{\expandafter\BNE_div \romannumeral-`0#1\Z }% \def\BNE_div #1#2\Z #3{\expandafter\BNE_div_a\expandafter #1% \romannumeral-`0#3\Z #2\Z }% \def\BNE_div_a #1#2% #1 de A, #2 de B. @@ -687,6 +773,17 @@ An example with the power operator |^| (option |allowpower|): \def\BNE_div_pos_small\Z\BNE_div_pos_c #1#2{\ifnum #1>\xint_c_iv\expandafter \xint_secondoftwo\else\expandafter \xint_firstoftwo\fi { 0}{ 1}}% +\if0\BNE_tmpa % Toggle to load xint.sty (and also xinttools.sty) + \RequirePackage{xint}% + \bnumexprUsesxint +\fi +\if2\BNE_tmpa % Toggle to load bigintcalc.sty + \RequirePackage{bigintcalc}% + \bnumexprUsesbigintcalc +\fi +\if3\BNE_tmpa % Toggle to load l3bigint.sty + \RequirePackage{l3bigint}% + \bnumexprUsesliiibigint \fi % \end{macrocode} % \subsection{Some helper macros and constants from xint} @@ -756,7 +853,7 @@ An example with the power operator |^| (option |allowpower|): \def\BNE_eval {\expandafter\BNE_until_end_a\romannumeral-`0\BNE_getnext }% \def\BNE_wrap { !\BNE_usethe\BNE_protect\BNE_unlock }% \protected\def\BNE_usethe\BNE_protect {\BNE:missing_bnethe!}% -\def\BNE_protect {\noexpand\BNE_protect\noexpand }% +\def\BNE_protect\BNE_unlock {\noexpand\BNE_protect\noexpand\BNE_unlock\noexpand }% \let\BNE_done\space \def\thebnumexpr {\romannumeral-`0\expandafter\BNE_unlock\romannumeral0\BNE_eval }% @@ -1089,13 +1186,19 @@ An example with the power operator |^| (option |allowpower|): % \end{macrocode} % \subsection{Cleanup} % \begin{macrocode} -\let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax \let\BNE_allowpower\relax +\let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax \BNErestorecatcodes % \end{macrocode} -% \DeleteShortVerb{\|} % \MakePercentComment % %<*dtx> +\section{Changes} +\small +\begin{description} +\input bnumexpr.changes +\end{description} + +\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 @@ -1111,7 +1214,7 @@ An example with the power operator |^| (option |allowpower|): Right bracket \] Circumflex \^ Underscore \_ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum {885} +\CheckSum {915} \makeatletter\check@checksum\makeatother \Finale %% End of file xint.dtx diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins index d6391452197..7441aae10fb 100644 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins +++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins @@ -4,14 +4,16 @@ %%---------------------------------------------------------------- %% This is a generated file. %% -%% tex bnumexpr.ins will extract bnumexpr.sty and bnumexpr.tex -%% from source file bnumexpr.dtx +%% tex bnumexpr.ins will extract bnumexpr.sty from bnumexpr.dtx %% -%% See bnumexpr.dtx for the copyright and license statements. +%% For distribution see the terms in the source file bnumexpr.dtx. %% \input docstrip.tex \askforoverwritefalse -\generate{\nopreamble +\generate{\nopreamble\nopostamble +\file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} +\file{bnumexpr.readme}{\from{bnumexpr.dtx}{readme}} +\usepostamble\defaultpostamble \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} \usepreamble\defaultpreamble \file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} diff --git a/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty b/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty index 748e392c117..f10bc5da65f 100644 --- a/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty +++ b/Master/texmf-dist/tex/latex/bnumexpr/bnumexpr.sty @@ -25,14 +25,14 @@ %% Copyright (C) 2014 by Jean-Francois Burnol %%---------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2014/09/21 v1.1 Expressions with big integers (jfB)]% +\ProvidesPackage{bnumexpr}[2014/09/22 v1.1a Expressions with big integers (jfB)]% \edef\BNErestorecatcodes {\catcode`\noexpand\!\the\catcode`\! \catcode`\noexpand\?\the\catcode`\? \catcode`\noexpand\_\the\catcode`\_ \catcode`\noexpand\:\the\catcode`\:\relax }% -\catcode`\! 11 -\catcode`\? 11 -\catcode`\_ 11 +\catcode`\! 11 % some other catcodes will be manipulated: comma, (, ), +\catcode`\? 11 % but we reset them to their standard values, thus +\catcode`\_ 11 % \BNErestorecatcodes is a bit pedantic here. \catcode`\: 11 \def\BNE_tmpa {0}% \DeclareOption {custom}{\def\BNE_tmpa {1}% @@ -46,6 +46,11 @@ Option bigintcalc: the macros from package bigintcalc are used.^^J Notice that / is mapped to \protect\bigintcalcDiv\space which does truncated division}% }% +\DeclareOption {l3bigint}{\def\BNE_tmpa {3}% + \PackageWarningNoLine{bnumexpr}{^^J + Option l3bigint: the macros from package l3bigint are used.^^J + There is no power operation, currently}% +}% \DeclareOption {nocsv}{% \PackageInfo{bnumexpr}{Comma separated expressions disabled}% \AtEndOfPackage{\expandafter\let\csname BNE_precedence_,\endcsname @@ -61,22 +66,29 @@ \def\BNE_allowpower {1}% }% \ProcessOptions\relax -\if2\BNE_tmpa % Toggle to load bigintcalc.sty -\RequirePackage{bigintcalc}% -\let\bnumexprAdd\bigintcalcAdd -\let\bnumexprSub\bigintcalcSub -\let\bnumexprMul\bigintcalcMul -\let\bnumexprDiv\bigintcalcDiv % NOTE: THIS DOES TRUNCATED DIVISION -\if1\BNE_allowpower\let\bnumexprPow\bigintcalcPow\fi -\fi -\if0\BNE_tmpa % Toggle to load xint.sty (and also xinttools.sty) -\RequirePackage{xint}% -\let\bnumexprAdd\xintiiAdd -\let\bnumexprSub\xintiiSub -\let\bnumexprMul\xintiiMul -\if1\BNE_allowpower\let\bnumexprPow\xintiiPow\fi -\def\bnumexprDiv {\romannumeral0\bnumexprdiv }% -\def\bnumexprdiv #1{\expandafter\BNE_div \romannumeral-`0#1\Z }% +\def\bnumexprUsesxint {% + \let\bnumexprAdd\xintiiAdd + \let\bnumexprSub\xintiiSub + \let\bnumexprMul\xintiiMul + \let\bnumexprDiv\BNE_xintiiDivRound + \let\bnumexprPow\xintiiPow +}% +\def\bnumexprUsesbigintcalc {% + \let\bnumexprAdd\bigintcalcAdd + \let\bnumexprSub\bigintcalcSub + \let\bnumexprMul\bigintcalcMul + \let\bnumexprDiv\bigintcalcDiv % NOTE: THIS DOES TRUNCATED DIVISION + \let\bnumexprPow\bigintcalcPow +}% +\def\bnumexprUsesliiibigint {% + \let\bnumexprAdd\bigint_add:nn + \let\bnumexprSub\bigint_sub:nn + \let\bnumexprMul\bigint_mul:nn + \let\bnumexprDiv\bigint_div_round:nn + \let\bnumexprPow\bigint_pow:nn % does not exist! +}% +\def\BNE_xintiiDivRound {\romannumeral0\BNE_xintiidivround }% +\def\BNE_xintiidivround #1{\expandafter\BNE_div \romannumeral-`0#1\Z }% \def\BNE_div #1#2\Z #3{\expandafter\BNE_div_a\expandafter #1% \romannumeral-`0#3\Z #2\Z }% \def\BNE_div_a #1#2% #1 de A, #2 de B. @@ -115,6 +127,17 @@ \def\BNE_div_pos_small\Z\BNE_div_pos_c #1#2{\ifnum #1>\xint_c_iv\expandafter \xint_secondoftwo\else\expandafter \xint_firstoftwo\fi { 0}{ 1}}% +\if0\BNE_tmpa % Toggle to load xint.sty (and also xinttools.sty) + \RequirePackage{xint}% + \bnumexprUsesxint +\fi +\if2\BNE_tmpa % Toggle to load bigintcalc.sty + \RequirePackage{bigintcalc}% + \bnumexprUsesbigintcalc +\fi +\if3\BNE_tmpa % Toggle to load l3bigint.sty + \RequirePackage{l3bigint}% + \bnumexprUsesliiibigint \fi \chardef\xint_c_ 0 \chardef\xint_c_i 1 @@ -148,7 +171,7 @@ \def\BNE_eval {\expandafter\BNE_until_end_a\romannumeral-`0\BNE_getnext }% \def\BNE_wrap { !\BNE_usethe\BNE_protect\BNE_unlock }% \protected\def\BNE_usethe\BNE_protect {\BNE:missing_bnethe!}% -\def\BNE_protect {\noexpand\BNE_protect\noexpand }% +\def\BNE_protect\BNE_unlock {\noexpand\BNE_protect\noexpand\BNE_unlock\noexpand }% \let\BNE_done\space \def\thebnumexpr {\romannumeral-`0\expandafter\BNE_unlock\romannumeral0\BNE_eval }% @@ -398,7 +421,7 @@ {!##1}{\expandafter\BNE_scan_nbr_b\string ##1}% }% }% -\let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax \let\BNE_allowpower\relax +\let\BNE_tmpa\relax \let\BNE_tmpb\relax \let\BNE_tmpc\relax \BNErestorecatcodes \endinput %% -- cgit v1.2.3