diff options
author | Karl Berry <karl@freefriends.org> | 2014-10-29 22:33:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-10-29 22:33:12 +0000 |
commit | 99d98e0491e7e6534c414cf552ecfafee17bd20f (patch) | |
tree | de6dfd32a50bb433bd88547e86d38820fd6c01b5 /Master/texmf-dist/source/latex | |
parent | 836bd572a38295459c8201f029bda32baf5a4b38 (diff) |
bnumexpr (29oct14)
git-svn-id: svn://tug.org/texlive/trunk@35466 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx | 432 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins | 34 |
2 files changed, 237 insertions, 229 deletions
diff --git a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx index 8d07850f7fd..36269c7582d 100644 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx +++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.dtx @@ -1,100 +1,114 @@ % -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*- -%<*drv> -\def\bnedocdate {2014/09/22} % package bnumexpr documentation date -\def\bnepackdate{2014/09/22} % package bnumexpr date -\def\bneversion {1.1a} % package bnumexpr version -%</drv> %<*dtx> -\def\bnedtxtimestamp {Time-stamp: <22-09-2014 at 23:21:33 CEST>} +\def\bnedtxtimestamp {Time-stamp: <28-10-2014 at 22:49:58 CET>} \iffalse %</dtx> -%%---------------------------------------------------------------- -%% The bnumexpr package: Expressions with big integers -%% Copyright (C) 2014 by Jean-Francois Burnol -%%---------------------------------------------------------------- +%<*drv> +%% --------------------------------------------------------------- +\def\bnedocdate {2014/10/28} % package bnumexpr documentation date +\def\bnepackdate{2014/10/28} % package bnumexpr date +\def\bneversion {1.1b} % package bnumexpr version +%</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 +| Source: bnumexpr.dtx +| Version: v1.1b, 2014/10/28 +| Author: Jean-Francois Burnol +| Info: Expressions with big integers +| License: LPPL 1.3c or later + +README: [Usage], [Installation], [License] +========================================== Usage -===== +----- + + \usepackage{bnumexpr} + +Then + + \thebnumexpr <expression with +,-,*,/,(,)> \relax -\usepackage{bnumexpr} +is like + + \the\numexpr <expression with +,-,*,/,(,)> \relax -Then \thebnumexpr <expression with +,-,*,/,(,)> \relax is like - \the\numexpr <expression with +,-,*,/,(,)> \relax with the difference of accepting or producing arbitrarily big -integers. +integers. For example, + + \thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax + +outputs `-202785405180` and this computation would have created an +arithmetic overflow in `\numexpr`. + +`\bnumexpr...\relax` is a scaled down version of `\xintiiexpr...\relax` +from package xintexpr.[^1] + +By default, bnumexpr loads xintcore [^1] for its arithmetic macros +doing addition, subtraction, multiplication, division. -Example: - \thebnumexpr 30*(21-43*(512-67*(6133-812*2897)))\relax -outputs: - -202785405180 -which would create an arithmetic overflow in \numexpr. +- With option _custom_, xintcore is not loaded and it is up to + the user to define suitably the expandable macros`\bnumexprAdd`, + `\bnumexprSub`, `\bnumexprMul`, and `\bnumexprDiv`. -\bnumexpr...\relax is a scaled down version of \xintiiexpr...\relax -from package xintexpr. +- Option _bigintcalc_ loads package bigintcalc [^2] and uses + its arithmetic macros rather than those from xintcore. -By default, bnumexpr.sty loads xint.sty for its arithmetic macros -doing addition, subtraction, multiplication, division. +- Option _l3bigint_ loads rather package l3bigint [^3], + which is in the experimental trunk of the on-going + [LaTeX3 project](http://latex-project.org). -- 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 _allowpower_ enables `^` as power operator. -- option l3bigint similarly with package l3bigint, which is -downloadable from the development repository of the on-going -LaTeX3 project. +[^1]: <http://www.ctan.org/pkg/xint> -Option allowpower enables ^ as power operator (only for xint and -bigintcalc currently). +[^2]: <http://www.ctan.org/pkg/bigintcalc> + +[^3]: <http://latex-project.org/svnroot/experimental/trunk/l3trial/l3bigint>, +or from <https://github.com/latex3/svn-mirror>. Installation -============ +------------ -Obtain bnumexpr.dtx (and possibly, 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: -To generate files from the source bnumexpr.dtx: +> <http://www.ctan.org/pkg/bnumexpr> - - with bnumexpr.ins: "tex bnumexpr.ins" in the same repertory as - bnumexpr.dtx will create (or overwrite) the files in this repertory. +Both `"tex bnumexpr.ins"` and `"tex bnumexpr.dtx"` extract from +`bnumexpr.dtx` the following files: - - without bnumexpr.ins: "tex bnumexpr.dtx" also extracts the files. +`bnumexpr.sty` + : this is the style file. - * bnumexpr.sty is the style file +`bnumexprReadme.md` + : reconstitutes this README. - * bnumexpr.readme reconstitutes this README. +`bnumexpr.changes` + : lists changes from the initial version. - * bnumexpr.changes lists changes since last version. +`bnumexpr.tex` + : can be used to generate the documentation: - * bnumexpr.tex is used for generating the documentation: + - with latex+dvipdfmx: `"latex bnumexpr.tex"` (thrice) then + `"dvipdfmx bnumexpr.dvi"`. - - 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. + 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). + - with pdflatex: set the suitable toggle in `bnumexpr.tex` to + disable dvipdfmx settings then `"pdflatex bnumexpr.tex"` (thrice). - * without bnumexpr.tex: + In both cases files `bnumexprReadme.md` and `bnumexpr.changes` must + be present in the same repertory. - pdflatex bnumexpr.dtx (thrice) generates simultaneously the style - file and the pdf documentation. +Without `bnumexpr.tex`: + : `"pdflatex bnumexpr.dtx"` (thrice) extracts all files and + simultaneously generates the pdf documentation. Finishing the installation: - bnumexpr.sty --> TDS:tex/latex/bnumexpr/ + bnumexpr.sty --> TDS:tex/latex/bnumexpr/ bnumexpr.dtx --> TDS:source/latex/bnumexpr/ bnumexpr.ins --> TDS:source/latex/bnumexpr/ @@ -102,44 +116,60 @@ Finishing the installation: bnumexpr.pdf --> TDS:doc/latex/bnumexpr/ README --> TDS:doc/latex/bnumexpr/ -Files bnumexpr.tex, bnumexpr.changes, bnumexpr.readme may be discarded. +Files `bnumexpr.tex`, `bnumexpr.changes`, `bnumexprReadme.md` may be +discarded. License -======= +------- + +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> -Copyright (C) 2014 by Jean-Francois Burnol (jfbu at free dot fr) +| and the latest version of this license is in -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. +> <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 +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. + bnumexpr.sty, bnumexpr.pdf, bnumexpr.ins, bnumexpr.tex, + bnumexpr.changes, bnumexprReadme.md + %</readme>-------------------------------------------------------- -%<*changes>------------------------------------------------------- -%% This is a generated file. -%% -%% For distribution see the terms in the source file bnumexpr.dtx. +%<*!readme> +%% --------------------------------------------------------------- +%% The bnumexpr package: Expressions with big integers +%% Copyright (C) 2014 by Jean-Francois Burnol %% -\item[1.1a (2014/09/22)] \begin{itemize} +%</!readme> +%<*changes>------------------------------------------------------- +\item[1.1b (2014/10/28)] + \begin{itemize} + \item README converted to |markdown/pandoc| syntax, + \item the package now loads only |xintcore|, which belongs to |xint| bundle + version |1.1| and extracts from the earlier |xint| package the core arithmetic + operations as used by |bnumexpr|. + \end{itemize} + +\item[1.1a (2014/09/22)] + \begin{itemize} \item added |l3bigint| option to use experimental \LaTeX3 - package of the same name. + package of the same name, - \item added Changes and Readme sections to the documentation. + \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, @@ -149,6 +179,7 @@ End of README file. |\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. @@ -157,19 +188,18 @@ End of README file. the power operator |^| as an option. %</changes>------------------------------------------------------- %<*drv>----------------------------------------------------------- -%% This is a generated file. -%% -%% latex bnumexpr.tex (thrice) && dvipdfmx bnumexpr.dvi --> bnumexpr.dtx -%% for pdflatex, set the \Withdvipdfmx toggle below to 0 -%% -%% For distribution see the terms in the source file bnumexpr.dtx. +%% latex bnumexpr.tex (thrice) && dvipdfmx bnumexpr.dvi +%% to produce bnumexpr.pdf +%% +%% alternative: pdflatex bnumexpr.tex, but the \Withdvipdfmx toggle +%% below must be set to 0 first. %% \NeedsTeXFormat{LaTeX2e} \ProvidesFile{bnumexpr.tex}% [\bnepackdate\space v\bneversion\space driver file for % bnumexpr documentation (jfB)]% \PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc} -\chardef\Withdvipdfmx 1 % replace 1 by 0 for using pdflatex +\chardef\Withdvipdfmx 1 % \chardef\NoSourceCode 0 % replace 0 by 1 for not including source code \input bnumexpr.dtx %%% Local Variables: @@ -177,20 +207,16 @@ End of README file. %%% End: %</drv>----------------------------------------------------------- %<*ins>----------------------------------------------------------- -%% This is a generated file. -%% %% tex bnumexpr.ins will extract bnumexpr.sty from bnumexpr.dtx %% -%% For distribution see the terms in the source file bnumexpr.dtx. -%% \input docstrip.tex \askforoverwritefalse \generate{\nopreamble\nopostamble -\file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} -\file{bnumexpr.readme}{\from{bnumexpr.dtx}{readme}} +\file{bnumexprReadme.md}{\from{bnumexpr.dtx}{readme}} +\usepreamble\defaultpreamble \usepostamble\defaultpostamble +\file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} -\usepreamble\defaultpreamble \file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} \catcode32=13\relax% active space \let =\space% @@ -212,17 +238,17 @@ End of README file. %<*dtx> \fi % end of \iffalse block around generated files \chardef\noetex 0 -\expandafter\ifx\csname numexpr\endcsname\relax \chardef\noetex 1 \fi +\ifx\numexpr\undefined \chardef\noetex 1 \fi \ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop \else - \expandafter\ifx\csname ProvidesFile\endcsname\relax - \chardef\extractfiles 0 % etex etc.. on bnumexpr.dtx + \ifx\ProvidesFile\undefined + \chardef\extractfiles 0 % no LaTeX2e; etex, ... on bnumexpr.dtx \else % latex/pdflatex on bnumexpr.tex or on bnumexpr.dtx - \expandafter\ifx\csname Withdvipdfmx\endcsname\relax + \ifx\Withdvipdfmx\undefined % 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\NoSourceCode 0 % 1 = do not include source code + \chardef\Withdvipdfmx 0 % 0 = pdflatex or latex+dvips, 1 = dvipdfmx + \chardef\NoSourceCode 0 % 0 = include source code, 1 = do note \NeedsTeXFormat{LaTeX2e}% \PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}% \else % latex run is on bnumexpr.tex, @@ -252,12 +278,12 @@ End of README file. \input docstrip.tex \askforoverwritefalse \generate{\nopreamble\nopostamble - \file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} - \file{bnumexpr.readme}{\from{bnumexpr.dtx}{readme}} + \file{bnumexprReadme.md}{\from{bnumexpr.dtx}{readme}} + \usepreamble\defaultpreamble \usepostamble\defaultpostamble + \file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} \file{bnumexpr.ins}{\from{bnumexpr.dtx}{ins}} \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} - \usepreamble\defaultpreamble \file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} \endgroup \fi % end of file extraction @@ -270,6 +296,8 @@ End of README file. %------------------------------------------------------------------------------- \documentclass {scrdoc} \ifnum\NoSourceCode=1 \OnlyDescription\fi +\usepackage{ifpdf} +\ifpdf\chardef\Withdvipdfmx 0 \fi \makeatletter \ifnum\Withdvipdfmx=1 \@for\@tempa:=hyperref,bookmark,graphicx,xcolor,pict2e\do @@ -316,6 +344,22 @@ End of README file. \definecolor{niceone}{RGB}{38,128,192} \colorlet{jfverbcolor}{yellow!5} +% transféré de xint-manual.tex +\DeclareFontFamily{U}{MdSymbolC}{} +\DeclareFontShape {U}{MdSymbolC}{m}{n}{<-> MdSymbolC-Regular}{} + +\makeatletter +\newbox\cdbx@SoftWrapIcon +\colorlet {softwrapicon}{blue} + +\def\cdbx@SetSoftWrapBox{% + \setbox\cdbx@SoftWrapIcon\hb@xt@\z@ + {\hb@xt@\fontdimen2\font + {\hss{\color{softwrapicon}\usefont{U}{MdSymbolC}{m}{n}\char"97}\hss}% + \hss}% + } +\makeatother + \usepackage[english]{babel} \usepackage[pdfencoding=pdfdoc]{hyperref} @@ -334,9 +378,9 @@ pdfpagemode=UseOutlines} \usepackage{bookmark} %---- \verb, and verbatim like `environments'. \MicroFont et \MacroFont -\def\MicroFont {\ttfamily } -\def\MacroFont {\ttfamily\baselineskip12pt\relax} \makeatletter +\def\MicroFont {\ttfamily \cdbx@SetSoftWrapBox} +\def\MacroFont {\ttfamily\baselineskip12pt\relax} \def\lowast{\raisebox{-.25\height}{*}} \begingroup @@ -369,11 +413,13 @@ pdfpagemode=UseOutlines} \def\@@@jfverb #1{\ifcat\noexpand#1$% $ \endgroup\else - \penalty\z@ +% \penalty\z@ + \discretionary{\copy\cdbx@SoftWrapIcon}{}{}% \colorbox{jfverbcolor}{\strut #1}% \expandafter\@@@jfverb\fi } \makeatother + \catcode`\_=11 \def\csa_aux #1{\ttfamily\hyphenchar\font45 \char`\\% @@ -437,13 +483,14 @@ pdfpagemode=UseOutlines} \begingroup \makeatletter\def\x{\baselineskip10pt \ttfamily\settowidth\dimen@{X}% - %\parindent \dimexpr.5\linewidth-33\dimen@\relax + %\parindent \dimexpr.5\linewidth-34\dimen@\relax + \parindent\z@ \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 + \noindent\kern\parindent\input bnumexprReadme.md \endgroup }\x @@ -475,34 +522,25 @@ integers. Important items: The parser |\bnumexpr| is a scaled-down version of parser |\xintiiexpr| from package \href{http://www.ctan.org/pkg/xint}{xintexpr}: support for boolean -operators, functions such as |abs|, |max|, |lcm|, the |!| as factorial, -handling of hexadecimal numbers, etc\dots has -been removed. The goal here is to extend |\numexpr| only to the extent of -accepting big integers. Thus by default, the syntax allows |+,-,*,/|, -parentheses, and also |\count| or |\dimen| registers or variables. Option -|allowpower| enables |^| as power operator. - -Of course, one -needs some underlying big integer engine to provide the macros doing the -actual computations. By default, \bnename uses package |xint| and its -|\xintiiAdd|, |\xintiiSub|, and |\xintiiMul| macros (also |\xintiiPow| if -option |allowpower| is made use of). As we want here |/| to do -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|, |l3bigint| and |custom| in -\autoref{sec:options} for alternatives. - -The starting point for the |\bnumexpr| parser was not the |\xintiiexpr| version -|1.09n| as available (at the time of writing) on CTAN, but a development -version for future release |1.1|. This is why the version number of package -|bnumexpr| is |1.1|. -It may well be that the code of the parser is in some places quite sub-optimal -from the fact that it was derived from code handling much more stuff. +operators, functions such as |abs|, |max|, |lcm|, the |!| as factorial, handling +of hexadecimal numbers, etc\dots has been removed. The goal here is to extend +|\numexpr| only to the extent of accepting big integers. Thus by default, the +syntax allows |+,-,*,/|, parentheses, and also |\count| or |\dimen| registers or +variables. Option |allowpower| enables |^| as power operator. It may well be +that the code of the parser is in some places quite sub-optimal from the fact +that it was derived from code handling much more stuff. The |\xintNewExpr| construct has been left out. +The package \bnename needs some underlying big integer engine to provide the +macros doing the actual computations. By default, it loads package |xintcore| (a +subset of \href{http://www.ctan.org/pkg/xint}{xint}) and its |\xintiiAdd|, +|\xintiiSub|, |\xintiiMul|, and |\xintiiDivRound| macros (also |\xintiiPow| if +option |allowpower| is made use of). +See the discussion of options |bigintcalc|, |l3bigint| and |custom| in +the next section %\autoref{sec:options} +for alternatives. + I recall from documentation of |xintexpr| that there is a potential impact on the memory of \TeX{} (the hash table) because each arithmetic operation is done inside a dummy |\csname...\endcsname| used as single token to move @@ -512,17 +550,18 @@ around in one-go the possibly hundreds of digits composing a number. The package does by default: \begin{verbatim} -\RequirePackage{xint} +\RequirePackage{xintcore} \let\bnumexprAdd\xintiiAdd \let\bnumexprSub\xintiiSub \let\bnumexprMul\xintiiMul -%% \bnumexprDiv has custom definition on top of macros from xint.sty +\let\bnumexprMul\xintiiDivRound \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. -Option |bigintcalc| says to not load \href{http://www.ctan.org/pkg/xint}{xint} +Option |bigintcalc| says to not load +\href{http://www.ctan.org/pkg/xint}{xintcore} 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| @@ -536,17 +575,14 @@ 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|) -must be expandable, and they must allow arguments in need to be first (`f'-) -expanded. They should produce on output (big) integers with no leading zeros, at -most one minus sign and no plus sign (else the \bnename macro used for -handling the |-| prefix operator may need to be modified). They will be -expanded inside |\csname...\endcsname|. The macros from |xint.sty| (as well as -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. +These macros must be expandable, and they must allow arguments in need to be +first (`f'-) expanded. They should produce on output (big) integers with no +leading zeros, at most one minus sign and no plus sign (else the \bnename macro +used for handling the |-| prefix operator may need to be modified). They will be +expanded inside |\csname...\endcsname|. The macros from |xintcore.sty| (as well +as 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. @@ -563,8 +599,8 @@ 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|. +|bnumexpr.sty|. Recall that |xintcore| is loaded by default, but is not loaded +in case of one of the options |custom|, |bigintcalc|, |l3bigint|. \section{Examples} @@ -620,6 +656,12 @@ An example with the power operator |^| (option |allowpower|, not compatible with \end{flushleft} +\section{Changes} +%\small +\begin{description} +\input bnumexpr.changes +\end{description} + \StopEventually{\end{document}\endinput} \newgeometry{hscale=0.75,vscale=0.75}% ATTENTION \newgeometry fait @@ -647,14 +689,18 @@ An example with the power operator |^| (option |allowpower|, not compatible with % \subsection{Package identification and catcode setup} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}% -\ProvidesPackage{bnumexpr}[2014/09/22 v1.1a Expressions with big integers (jfB)]% +\ProvidesPackage{bnumexpr}[2014/10/28 v1.1b 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 % 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`\noexpand\:\the\catcode`\: + \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 % \end{macrocode} % \subsection{Package options} @@ -662,7 +708,7 @@ An example with the power operator |^| (option |allowpower|, not compatible with \def\BNE_tmpa {0}% \DeclareOption {custom}{\def\BNE_tmpa {1}% \PackageWarningNoLine{bnumexpr}{^^J - Option custom: package xint not loaded. Definitions are needed for:^^J + Option custom: package xintcore not loaded. Definitions are needed for:^^J \protect\bnumexprAdd, \protect\bnumexprSub, \protect\bnumexprMul\space and \protect\bnumexprDiv }% }% @@ -705,7 +751,7 @@ An example with the power operator |^| (option |allowpower|, not compatible with \let\bnumexprAdd\xintiiAdd \let\bnumexprSub\xintiiSub \let\bnumexprMul\xintiiMul - \let\bnumexprDiv\BNE_xintiiDivRound + \let\bnumexprDiv\xintiiDivRound \let\bnumexprPow\xintiiPow }% \def\bnumexprUsesbigintcalc {% @@ -722,59 +768,8 @@ An example with the power operator |^| (option |allowpower|, not compatible with \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|, 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, which we follow here. -% \begin{macrocode} -\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. -{% - \if0#2\xint_dothis\BNE_div_divbyzero\fi - \if0#1\xint_dothis\BNE_div_aiszero\fi - \if-#2\xint_dothis{\BNE_div_bneg #1}\fi - \xint_orthat{\BNE_div_bpos #1#2}% -}% -\def\BNE_div_divbyzero #1\Z #2\Z {\BNE:DivisionByZero\space 0}% -\def\BNE_div_aiszero #1\Z #2\Z { 0}% -\def\BNE_div_bpos #1% -{% - \xint_UDsignfork - #1{\xintiiopp\BNE_div_pos {}}% - -{\BNE_div_pos #1}% - \krof -}% -\def\BNE_div_bneg #1% -{% - \xint_UDsignfork - #1{\BNE_div_pos {}}% - -{\xintiiopp\BNE_div_pos #1}% - \krof -}% -\def\BNE_div_pos #1#2\Z #3\Z{\expandafter\BNE_div_pos_a - \romannumeral0\XINT_div_prepare {#2}{#1#30}}% -\def\BNE_div_pos_a #1#2{\xintReverseOrder {#1\BNE_div_pos_b}\Z }% -\def\BNE_div_pos_b #1#2{\xint_gob_til_Z #2\BNE_div_pos_small\Z - \BNE_div_pos_c #1#2}% -\def\BNE_div_pos_c #1#2\Z {\ifnum #1>\xint_c_iv - \expandafter\BNE_div_pos_up - \else \expandafter\xintreverseorder - \fi {#2}}% -\def\BNE_div_pos_up #1{\xintinc {\xintReverseOrder{#1}}}% -\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}% +\if0\BNE_tmpa % Toggle to load xintcore.sty + \RequirePackage{xintcore}% \bnumexprUsesxint \fi \if2\BNE_tmpa % Toggle to load bigintcalc.sty @@ -1192,11 +1187,6 @@ An example with the power operator |^| (option |allowpower|, not compatible with % \MakePercentComment %</package> %<*dtx> -\section{Changes} -\small -\begin{description} -\input bnumexpr.changes -\end{description} \DeleteShortVerb{\|} \CharacterTable @@ -1214,7 +1204,7 @@ An example with the power operator |^| (option |allowpower|, not compatible with Right bracket \] Circumflex \^ Underscore \_ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum {915} +\CheckSum {833} \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 7441aae10fb..370e450b64f 100644 --- a/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins +++ b/Master/texmf-dist/source/latex/bnumexpr/bnumexpr.ins @@ -1,21 +1,39 @@ -%%---------------------------------------------------------------- +%% +%% This is file `bnumexpr.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% bnumexpr.dtx (with options: `ins') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from bnumexpr.ins. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file bnumexpr.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% --------------------------------------------------------------- %% The bnumexpr package: Expressions with big integers %% Copyright (C) 2014 by Jean-Francois Burnol -%%---------------------------------------------------------------- -%% This is a generated file. %% %% tex bnumexpr.ins will extract bnumexpr.sty from bnumexpr.dtx %% -%% For distribution see the terms in the source file bnumexpr.dtx. -%% \input docstrip.tex \askforoverwritefalse \generate{\nopreamble\nopostamble -\file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} -\file{bnumexpr.readme}{\from{bnumexpr.dtx}{readme}} +\file{bnumexprReadme.md}{\from{bnumexpr.dtx}{readme}} +\usepreamble\defaultpreamble \usepostamble\defaultpostamble +\file{bnumexpr.changes}{\from{bnumexpr.dtx}{changes}} \file{bnumexpr.tex}{\from{bnumexpr.dtx}{drv}} -\usepreamble\defaultpreamble \file{bnumexpr.sty}{\from{bnumexpr.dtx}{package}}} \catcode32=13\relax% active space \let =\space% |