diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xint.sty')
-rw-r--r-- | Master/texmf-dist/tex/generic/xint/xint.sty | 95 |
1 files changed, 62 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xint.sty b/Master/texmf-dist/tex/generic/xint/xint.sty index 3b0f6239b6d..ead0a68fb9c 100644 --- a/Master/texmf-dist/tex/generic/xint/xint.sty +++ b/Master/texmf-dist/tex/generic/xint/xint.sty @@ -22,7 +22,7 @@ %% in the same archive or directory.) %% %%---------------------------------------------------------------- -%% The xint bundle (version 1.09a of September 22, 2013) +%% The xint bundle (version 1.09b of October 3, 2013) %% xint: Expandable operations on long numbers %% Copyright (C) 2013 by Jean-Francois Burnol %%---------------------------------------------------------------- @@ -33,7 +33,7 @@ \catcode123=1 % { \catcode125=2 % } \catcode64=11 % @ - \catcode95=11 % _ (starting with 1.06b, used inside cs names) + \catcode95=11 % _ \catcode35=6 % # \catcode44=12 % , \catcode45=12 % - @@ -65,8 +65,16 @@ \def\ChangeCatcodesIfInputNotAborted {% \endgroup - \edef\XINT_restorecatcodes_endinput - {% + \def\XINT_storecatcodes + {% takes care of all, to allow more economical code in modules + \catcode63=\the\catcode63 % ? xintexpr + \catcode124=\the\catcode124 % | xintexpr + \catcode38=\the\catcode38 % & xintexpr + \catcode64=\the\catcode64 % @ xintexpr + \catcode33=\the\catcode33 % ! xintexpr + \catcode93=\the\catcode93 % ] -, xintfrac, xintseries, xintcfrac + \catcode91=\the\catcode91 % [ -, xintfrac, xintseries, xintcfrac + \catcode36=\the\catcode36 % $ xintgcd only \catcode94=\the\catcode94 % ^ \catcode96=\the\catcode96 % ` \catcode47=\the\catcode47 % / @@ -88,7 +96,10 @@ \catcode13=\the\catcode13 % ^^M \catcode32=\the\catcode32 % \catcode61=\the\catcode61\relax % = - \noexpand\endinput + }% + \edef\XINT_restorecatcodes_endinput + {% + \XINT_storecatcodes\noexpand\endinput % }% \def\XINT_setcatcodes {% @@ -113,34 +124,39 @@ \catcode47=12 % / \catcode96=12 % ` \catcode94=11 % ^ + \catcode36=3 % $ + \catcode91=12 % [ + \catcode93=12 % ] + \catcode33=11 % ! + \catcode64=11 % @ + \catcode38=12 % & + \catcode124=12 % | + \catcode63=11 % ? }% \XINT_setcatcodes }% \ChangeCatcodesIfInputNotAborted +\def\XINTsetupcatcodes {% for use by other modules + \edef\XINT_restorecatcodes_endinput + {% + \XINT_storecatcodes\noexpand\endinput % + }% + \XINT_setcatcodes +}% \begingroup - \catcode64=11 % @ - \catcode91=12 % [ - \catcode93=12 % ] - \catcode58=12 % : (does not really matter, was letter) + \catcode58=12 % : (does not matter, actually) \expandafter\ifx\csname ProvidesPackage\endcsname\relax - \def\x#1#2#3[#4]{\endgroup - \immediate\write-1{Package: #3 #4}% - \xdef#1{#4}% - }% + \def\x{\endgroup + \def\XINT_providespackage ##1##2[##3]% + {\immediate\write-1{Package: ##2 ##3}% + \expandafter\xdef\csname ver@##2.sty\endcsname{##3}}}% \else - \def\x#1#2[#3]{\endgroup - #2[{#3}]% - \ifx#1\@undefined - \xdef#1{#3}% - \fi - \ifx#1\relax - \xdef#1{#3}% - \fi - }% + \def\x{\endgroup\let\XINT_providespackage\relax }% \fi -\expandafter\x\csname ver@xint.sty\endcsname -\ProvidesPackage{xint}% - [2013/09/24 v1.09a Expandable operations on long numbers (jfB)]% +\x +\XINT_providespackage +\ProvidesPackage {xint}% + [2013/10/03 v1.09b Expandable operations on long numbers (jfB)]% \def\xint_gobble_ {}% \def\xint_gobble_i #1{}% \def\xint_gobble_ii #1#2{}% @@ -165,6 +181,7 @@ \def\xint_gob_til_zero #10{}% \def\xint_gob_til_one #11{}% \def\xint_gob_til_G #1G{}% +\def\xint_gob_til_minus #1-{}% was missing since 1.06b, \xintDSR could not work. \def\xint_gob_til_zeros_iii #1000{}% \def\xint_gob_til_zeros_iv #10000{}% \def\xint_gob_til_relax #1\relax {}% @@ -394,20 +411,32 @@ \def\xintNthEltNoExpand {\romannumeral0\xintntheltnoexpand }% \def\xintnthelt #1#2% {% - \expandafter\XINT_nthelt\expandafter {\romannumeral-`0#2}% - {\numexpr #1\relax }% + \expandafter\XINT_nthelt_a\expandafter {\the\numexpr #1\expandafter}% + \expandafter {\romannumeral-`0#2}% }% \def\xintntheltnoexpand #1#2% {% - \XINT_nthelt {#2}{\numexpr #1\relax}% + \expandafter\XINT_nthelt_a\expandafter {\the\numexpr #1}{#2}% }% -\def\XINT_nthelt #1#2% +\def\XINT_nthelt_a #1% {% - \ifnum #2>\xint_c_ - \xint_afterfi {\XINT_nthelt_loop_a {#2}}% + \ifnum #1<0 + \expandafter\XINT_nthelt_b\else\expandafter\XINT_nthelt_c + \fi {#1}% +}% +\def\XINT_nthelt_b #1#2% +{% + \expandafter\XINT_nthelt_c\expandafter + {\the\numexpr -#1\expandafter}\expandafter + {\romannumeral0\xintrevwithbraces {#2}}% +}% +\def\XINT_nthelt_c #1#2% +{% + \ifnum #1>\xint_c_ + \xint_afterfi {\XINT_nthelt_loop_a {#1}}% \else \xint_afterfi {\XINT_length_loop {0}}% - \fi #1\xint_relax\xint_relax\xint_relax\xint_relax + \fi #2\xint_relax\xint_relax\xint_relax\xint_relax \xint_relax\xint_relax\xint_relax\xint_relax\Z }% \def\XINT_nthelt_loop_a #1% @@ -3214,7 +3243,7 @@ \def\XINT_dsr_b #1#2#3\Z {% \xint_gob_til_W #2\xint_dsr_onedigit\W - \xint_minus #2\xint_dsr_onedigit-% + \xint_gob_til_minus #2\xint_dsr_onedigit-% \expandafter\XINT_dsr_removew \romannumeral0\XINT_rev {#2#3}% }% |