diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:01:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:01:03 +0000 |
commit | fd257bd5c75a905dfa0ca6e3e507d9ed29338e1f (patch) | |
tree | c757616e23785687107982ba45f86c5c4ac79147 /Master | |
parent | 26b8ca05f501c6e8522a05042c3b433a90112054 (diff) |
numprint
git-svn-id: svn://tug.org/texlive/trunk@1149 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/numprint/nbaseprt.sty | 190 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/numprint/numprint.sty | 1274 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/numprint/numprint032.sty | 559 |
3 files changed, 2023 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/numprint/nbaseprt.sty b/Master/texmf-dist/tex/latex/numprint/nbaseprt.sty new file mode 100644 index 00000000000..fa6d570a341 --- /dev/null +++ b/Master/texmf-dist/tex/latex/numprint/nbaseprt.sty @@ -0,0 +1,190 @@ +%% +%% This is file `nbaseprt.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% nbaseprt.dtx (with options: `package') +%% +%% numprint package +%% +%% Copyright 2000--2005 Harald Harders +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% +%% h.harders@tu-bs.de +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{nbaseprt} + [2004/12/14 v0.11 Print numbers with numerical bases (HH)] +\typeout{^^J*************************************************************} +\PackageWarningNoLine{nbaseprt}{This version of nbaseprt.sty is a BETA + VERSION.\MessageBreak + The main command \string\nbaseprint\space will stay stable + but\MessageBreak + all configuration commands and the output of\MessageBreak + \string\nbaseprint\space may change in future.\MessageBreak + Please give me feedback what can be improved and if\MessageBreak + the abbreviations for the different number bases are\MessageBreak + correct} +\typeout{*************************************************************^^J} +\DeclareOption{np}{% + \newcommand*\nbp{\nbaseprint}% + \PassOptionsToPackage{np}{numprint}% +} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{numprint}} +\ProcessOptions\relax +\RequirePackage{numprint} +\RequirePackage{ifthen} +\newcommand*\nbprt@base{} +\newcommand*\nbprt@number{} +\newcommand*\nbprt@testbase{} +\def\nbprt@testbase#1#2#3\@empty{% + \ifthenelse{\equal{#1#2}{0x}\or\equal{#1#2}{0X}\or\equal{#1}{"}}{% + \gdef\nbprt@base{hex}% + \ifthenelse{\equal{#1}{"}}{% + \edef\nbprt@number{#2#3}% + }{% + \edef\nbprt@number{#3}% + }% + }{% + \ifthenelse{\equal{#1#2}{0o}\or\equal{#1#2}{0O}\or\equal{#1}{'}}{% + \gdef\nbprt@base{oct}% + \ifthenelse{\equal{#1}{'}}{% + \edef\nbprt@number{#2#3}% + }{% + \edef\nbprt@number{#3}% + }% + }{% + \ifthenelse{\equal{#1#2}{0d}\or\equal{#1#2}{0D}}{% + \gdef\nbprt@base{dec}% + \edef\nbprt@number{#3}% + }{% + \ifthenelse{\equal{#1#2}{0b}\or\equal{#1#2}{0B}}{% + \gdef\nbprt@base{bin}% + \edef\nbprt@number{#3}% + }{% + \def\nbprt@base{dec}% + \edef\nbprt@number{#1#2#3}% + \nbprt@ishex#1#2#3h\@empty\@empty + \nbprt@isHex#1#2#3H\@empty\@empty + \nbprt@isoct#1#2#3o\@empty\@empty + \nbprt@isOct#1#2#3O\@empty\@empty + }% + }% + }% + }% + \expandafter\nbprt@testsign\nbprt@number\@empty\@empty\@empty + \def\nbprt@string{}% + \@tempcnta=0 + \@tempcntb=0 + \expandafter\nbprt@parsenum\nbprt@number\@empty + \whiledo{\the\@tempcntb<\nprt@lpaddigits}{% + \ifnum\@tempcnta=\csname nbprt@digitgroup@\nbprt@base\endcsname\relax + \edef\nbprt@string{\nprt@separator@before\nbprt@string}% + \@tempcnta=0 + \fi + \edef\nbprt@string{\nprt@lpadchar\nbprt@string}% + \advance\@tempcntb 1 + \advance\@tempcnta 1 + }% + \ifnbprt@pretext + \csname nbprt@pretext@\nbprt@base\endcsname + \nbprt@presep + \fi + \nprt@printsign{mantissa}\nbprt@sign\@empty + \nbprt@string + \ifnbprt@pretext + \else + \nbprt@postsep + \csname nbprt@posttext@\nbprt@base\endcsname + \fi +} +\def\nbprt@testsign#1#2#3\@empty{% + \nprt@IfCharInString{#1}{\nprt@signlist}{% + \edef\nbprt@number{#2#3}% + \edef\nbprt@sign{#1}% + \ifx\nbprt@sign\nprt@plus@test + \def\nprt@tmp{#2}% + \ifx\nprt@tmp\nprt@minus@test + \edef\nbprt@sign{+-}% + \edef\nbprt@number{#3}% + \fi + \else + \ifx\nbprt@sign\nprt@plusminus@test + \edef\nbprt@sign{+-}% + \fi + \fi + }{% + \edef\nbprt@number{#1#2#3}% + }% +} +\def\nbprt@ishex#1h#2\@empty{% + \ifthenelse{\equal{#2}{h}}{% + \def\nbprt@base{hex}% + \edef\nbprt@number{#1}% + }{}% +} +\def\nbprt@isHex#1H#2\@empty{% + \ifthenelse{\equal{#2}{H}}{% + \def\nbprt@base{hex}% + \edef\nbprt@number{#1}% + }{}% +} +\def\nbprt@isoct#1o#2\@empty{% + \ifthenelse{\equal{#2}{o}}{% + \def\nbprt@base{oct}% + \edef\nbprt@number{#1}% + }{}% +} +\def\nbprt@isOct#1O#2\@empty{% + \ifthenelse{\equal{#2}{O}}{% + \def\nbprt@base{oct}% + \edef\nbprt@number{#1}% + }{}% +} +\def\nbprt@parsenum#1#2\@empty{% + \ifthenelse{\equal{#2}{\@empty}}{}{% + \expandafter\nbprt@parsenum#2\@empty + }% + \ifnum\@tempcnta=\csname nbprt@digitgroup@\nbprt@base\endcsname\relax + \edef\nbprt@string{\nprt@separator@before\nbprt@string}% + \@tempcnta=0 + \fi + \edef\nbprt@string{% + \uppercase{\ifmmode\mathrm{#1}\else#1\fi}% + \nbprt@string}% + \advance\@tempcntb 1 + \advance\@tempcnta 1 +} +\newif\ifnbprt@pretext +\newcommand*\nbasepretext{\nbprt@pretexttrue} +\newcommand*\nbaseposttext{\nbprt@pretextfalse} +\def\nbprt@pretext@hex{0\ifmmode\mathrm{x}\else x\fi}% +\def\nbprt@pretext@oct{0\ifmmode\mathrm{o}\else o\fi}% +\def\nbprt@pretext@dec{0\ifmmode\mathrm{d}\else d\fi}% +\def\nbprt@pretext@bin{0\ifmmode\mathrm{b}\else b\fi}% +\def\nbprt@presep{\,}% +\def\nbprt@posttext@hex{\ifmmode\mathrm{h}\else h\fi}% +\def\nbprt@posttext@oct{\ifmmode\mathrm{o}\else o\fi}% +\def\nbprt@posttext@dec{\ifmmode\mathrm{d}\else d\fi}% +\def\nbprt@posttext@bin{\ifmmode\mathrm{b}\else b\fi}% +\def\nbprt@postsep{\,}% +\nbasepretext +\def\nbprt@digitgroup@hex{2}% +\def\nbprt@digitgroup@oct{3}% +\def\nbprt@digitgroup@dec{3}% +\def\nbprt@digitgroup@bin{4}% +\DeclareRobustCommand*\nbaseprint[1]{% + \edef\nbprt@number{#1}% + \def\nbprt@sign{}% + \expandafter\nbprt@testsign\nbprt@number\@empty\@empty\@empty + \expandafter\nbprt@testbase\nbprt@number\@empty\@empty\@empty +} + +\endinput +%% +%% End of file `nbaseprt.sty'. diff --git a/Master/texmf-dist/tex/latex/numprint/numprint.sty b/Master/texmf-dist/tex/latex/numprint/numprint.sty new file mode 100644 index 00000000000..45aee534a95 --- /dev/null +++ b/Master/texmf-dist/tex/latex/numprint/numprint.sty @@ -0,0 +1,1274 @@ +%% +%% This is file `numprint.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% numprint.dtx (with options: `package') +%% +%% numprint package +%% +%% Copyright 2000--2005 Harald Harders +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% +%% h.harders@tu-bs.de +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{numprint} + [2005/07/11 v1.35 Print numbers (HH)] +\RequirePackage{array} +\newif\ifnprt@numsepfour +\newif\ifnprt@errormessage +\newif\ifnprt@addmissingzero +\newif\ifnprt@addplus@mantissa +\newif\ifnprt@addplus@exponent +\newif\ifnprt@autolanguage +\newif\ifnprt@newcolumntype +\newif\ifnprt@npbold +\newcommand*\npfourdigitsep{\nprt@numsepfourtrue}% +\newcommand*\npfourdigitnosep{\nprt@numsepfourfalse}% +\newcommand*\npaddmissingzero{\nprt@addmissingzerotrue}% +\newcommand*\npnoaddmissingzero{\nprt@addmissingzerofalse}% +\newcommand*\npaddplus{\nprt@addplus@mantissatrue}% +\newcommand*\npnoaddplus{\nprt@addplus@mantissafalse}% +\newcommand*\npaddplusexponent{\nprt@addplus@exponenttrue}% +\newcommand*\npnoaddplusexponent{\nprt@addplus@exponentfalse}% +\DeclareOption{nosepfour}{\npfourdigitnosep} +\DeclareOption{sepfour}{\npfourdigitsep} +\DeclareOption{noaddmissingzero}{\npnoaddmissingzero} +\DeclareOption{addmissingzero}{\npaddmissingzero} +\DeclareOption{noaddplus}{\npnoaddplus} +\DeclareOption{addplus}{\npaddplus} +\DeclareOption{noaddplusexponent}{\npnoaddplusexponent} +\DeclareOption{addplusexponent}{\npaddplusexponent} +\DeclareOption{noautolanguage}{\nprt@autolanguagefalse} +\DeclareOption{autolanguage}{\nprt@autolanguagetrue} +\DeclareOption{np}{\newcommand*\np{\numprint}} +\DeclareOption{oldcolumntypes}{\nprt@newcolumntypefalse} +\DeclareOption{newcolumntypes}{\nprt@newcolumntypetrue} +\DeclareOption{boldmath}{\nprt@npboldtrue} +\DeclareOption{warning}{\nprt@errormessagefalse} +\DeclareOption{error}{\nprt@errormessagetrue} +\newcommand*\nprt@debug[1]{} +\DeclareOption{debug}{% + \renewcommand*\nprt@debug[1]{\PackageInfo{numprint}{#1}}% +} +\ExecuteOptions{sepfour,addmissingzero,error,noautolanguage,newcolumntypes} +\ProcessOptions\relax +\newcommand*\npdecimalsign[1]{\def\nprt@decimal{{#1}}} +\newcommand*\npthousandsep[1]{\def\nprt@separator@before{{#1}}% + \def\nprt@separator@after{{#1}}} +\newcommand*\npthousandthpartsep[1]{\def\nprt@separator@after{{#1}}} +\newcommand*\npproductsign[1]{\def\nprt@prod{\ensuremath{{}#1{}}}} +\newcommand*\npunitseparator[1]{\def\nprt@unitsep{{#1}}} +\newcommand*\npdegreeseparator[1]{\def\nprt@degreesep{{#1}}} +\newcommand*\nppercentseparator[1]{\def\nprt@percentsep{{#1}}} +\def\nprt@fillnull#1#2{% + \@tempcnta=-1 + \loop + \g@addto@macro{#1}{0}% + \advance\@tempcnta by 1 + \ifnum\@tempcnta<#2 + \repeat +} +\newcommand\nprounddigits[1]{% + \def\nprt@rounddigits{#1}% + \def\nprt@roundnull{}% + \nprt@fillnull{\nprt@roundnull}{#1}% +} +\newcommand\npnoround{\nprounddigits{-1}} +\npnoround +\newcommand\nproundexpdigits[1]{% + \def\nprt@roundexpdigits{#1}% + \def\nprt@roundexpnull{}% + \nprt@fillnull{\nprt@roundexpnull}{#1}% + } +\newcommand\npnoroundexp{\nproundexpdigits{-1}} +\npnoroundexp +\newcommand\nplpadding[2][0]{% + \def\nprt@lpaddigits{#2}% + \def\nprt@lpadchar{#1}% +} +\newcommand*\npnolpadding{\nplpadding[\@empty]{-1}} +\npnolpadding +\newcommand*\npreplacenull[1]{\def\nprt@replacenull{#1}} +\newcommand*\npprintnull{\let\nprt@replacenull=\@empty} +\npprintnull +\newcommand*\npunitcommand[1]{\ensuremath{\mathrm{#1}}} +\newif\ifnprt@mantissa@fixeddigits +\newcommand*\npdigits[2]{% + \edef\nprt@mantissa@fixeddigits@before{#1}% + \edef\nprt@mantissa@fixeddigits@after{#2}% + \nprt@mantissa@fixeddigitstrue +} +\def\nprt@mantissa@fixeddigits@before{-1}% +\def\nprt@mantissa@fixeddigits@after{-1}% +\newcommand*\npnodigits{\nprt@mantissa@fixeddigitsfalse} +\newif\ifnprt@exponent@fixeddigits +\newcommand*\npexponentdigits[2][0]{% + \edef\nprt@exponent@fixeddigits@before{#2}% + \edef\nprt@exponent@fixeddigits@after{#1}% + \nprt@exponent@fixeddigitstrue +} +\def\nprt@exponent@fixeddigits@before{-1}% +\def\nprt@exponent@fixeddigits@after{-1}% +\newcommand*\npnoexponentdigits{\nprt@exponent@fixeddigitsfalse} +\newif\ifnprt@argumenterror +\newcommand\nprt@error[2]{% + \ifnprt@errormessage + \PackageError{numprint}{#1}{#2}% + \else + \PackageWarning{numprint}{#1}% + \fi + \nprt@argumenterrortrue +} +\newif\ifnprt@charfound +\newcommand*\nprt@IfCharInString[2]{% + \nprt@charfoundfalse + \begingroup + \def\nprt@searchfor{#1}% + \edef\nprt@argtwo{#2}% + \expandafter\nprt@@IfCharInString\nprt@argtwo\@empty\@empty + \endgroup + \ifnprt@charfound + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} + \def\nprt@@IfCharInString#1#2\@empty{% + \def\nprt@argone{#1}% + \edef\nprt@argtwo{#2}% + \ifx\nprt@searchfor\nprt@argone + \global\nprt@charfoundtrue + \else + \ifx\nprt@argtwo\@empty + \else + \nprt@@IfCharInString#2\@empty + \fi + \fi + } +\newcommand*\nprt@plus@test{+} +\newcommand*\nprt@minus@test{-} +\newcommand*\nprt@plusminus@test{\pm} +\newcommand*\nprt@numberlist{0123456789} +\newcommand*\nprt@dotlist{.,} +\newcommand*\nprt@explist{eEdD} +\newcommand*\nprt@signlist{+-\pm} +\newcommand*\nprt@ignorelist{} +\newcounter{nprt@mantissa@digitsbefore}% +\newcounter{nprt@mantissa@digitsafter}% +\newcounter{nprt@exponent@digitsbefore}% +\newcounter{nprt@exponent@digitsafter}% +\newif\ifnprt@expfound +\newif\ifnprt@mantissa@decimalfound +\newif\ifnprt@exponent@decimalfound +\newcommand*\nprt@testsign[2]{% + \edef\nprt@commandname{#1}% + \edef\nprt@tmp{#2}% + \expandafter\nprt@@testsign\expandafter{% + \expandafter\nprt@commandname\expandafter}% + \nprt@tmp\@empty\@empty\@empty\@empty +} +\def\nprt@@testsign#1#2#3#4\@empty{% + \edef\nprt@commandname{#1}% + \expandafter\xdef\csname nprt@#1@before\endcsname{\@empty}% + \expandafter\xdef\csname nprt@#1@after\endcsname{\@empty}% + \setcounter{nprt@#1@digitsbefore}{0}% + \setcounter{nprt@#1@digitsafter}{0}% + \nprt@IfCharInString{#2}{\nprt@signlist}{% + \expandafter\xdef\csname nprt@#1@sign\endcsname{#2}% + \expandafter\ifx\csname nprt@#1@sign\endcsname\nprt@plus@test + \def\nprt@tmp{#3}% + \ifx\nprt@tmp\nprt@minus@test + \expandafter\xdef\csname nprt@#1@sign\endcsname{+-}% + \def\nprt@tmp{#4}% + \ifx\nprt@tmp\@empty + \expandafter\edef\csname nprt@#1\endcsname{\@empty}% + \else + \expandafter\nprt@testnumber\expandafter\nprt@commandname#4\@empty + \fi + \else + \ifx#3\@empty + \expandafter\edef\csname nprt@#1\endcsname{\@empty}% + \else + \expandafter\nprt@testnumber\expandafter\nprt@commandname#3#4\@empty + \fi + \fi + \else + \expandafter\ifx\csname nprt@#1@sign\endcsname\nprt@plusminus@test + \expandafter\xdef\csname nprt@#1@sign\endcsname{+-}% + \fi + \ifx#3\@empty + \expandafter\edef\csname nprt@#1\endcsname{\@empty}% + \else + \expandafter\nprt@testnumber\expandafter\nprt@commandname#3#4\@empty + \fi + \fi + }{% + \expandafter\xdef\csname nprt@#1@sign\endcsname{\@empty}% + \expandafter\nprt@testnumber\expandafter\nprt@commandname#2#3#4\@empty + }% +} +\def\nprt@testnumber#1#2#3\@empty{% + \edef\nprt@commandname{#1}% + \edef\nprt@argthree{#3}% + \nprt@IfCharInString{#2}{\nprt@numberlist\nprt@dotlist}{% + \nprt@IfCharInString{#2}{\nprt@dotlist}{% + \csname ifnprt@#1@decimalfound\endcsname + \nprt@error{More than one decimal sign used}{The mantissa + or the exponent may only contain a maximum of one decimal + sign (one of the list `\nprt@dotlist')}% + \else + \csname nprt@#1@decimalfoundtrue\endcsname + \fi + }{% + \csname ifnprt@#1@decimalfound\endcsname + \expandafter\g@addto@macro\csname nprt@#1@after\endcsname{#2}% + \stepcounter{nprt@#1@digitsafter}% + \else + \expandafter\g@addto@macro\csname nprt@#1@before\endcsname{#2}% + \stepcounter{nprt@#1@digitsbefore}% + \fi + }% + \ifx\nprt@argthree\@empty + \else + \expandafter\nprt@testnumber\expandafter\nprt@commandname#3\@empty + \fi + }{% + \nprt@error{Invalid number format. Printing the + argument\MessageBreak + verbatim}{Something is wrong in the format of the number}% + }% +} +\def\nprt@testcharacter#1#2\@empty{% + \edef\nprt@argtwo{#2}% + \nprt@IfCharInString{#1}{% + \nprt@numberlist\nprt@dotlist\nprt@explist\nprt@signlist\nprt@ignorelist}{% + \nprt@IfCharInString{#1}{\nprt@ignorelist}{% + \nprt@debug{Character `\noexpand#1' ignored}% + }{% + \nprt@IfCharInString{#1}{\nprt@explist}{% + \ifnprt@expfound + \nprt@error{Character for exponent (`\nprt@explist') used + more than once}{The argument of \string\numprint\space may + only contain one of following characters: `\nprt@explist'}% + \fi + \nprt@expfoundtrue + }{% + \ifnprt@expfound + \g@addto@macro\nprt@exponent{#1}% + \else + \g@addto@macro\nprt@mantissa{#1}% + \fi + }% + }% + \ifx\nprt@argtwo\@empty + \else + \nprt@testcharacter#2\@empty\@empty\@empty + \fi + }{% + \nprt@error{Invalid characters `#1' in mandatory argument + of\MessageBreak + \string\numprint. Allowed are\MessageBreak + `\nprt@numberlist\nprt@dotlist\nprt@explist\nprt@signlist\nprt@ignorelist'}{% + You may only use the specified characters in the argument.}% + }% +} +\newlength{\nprt@digitwidth}% +\newlength{\nprt@sepwidth}% +\newlength{\nprt@decimalwidth}% +\newlength{\nprt@blockwidth}% +\newcommand*\nprt@calcblockwidth[3]{% + \edef\nprt@argone{#1}% + \edef\nprt@argtwo{#2}% + \edef\nprt@argthree{#3}% + \edef\nprt@mantissaname{mantissa}% + \edef\nprt@aftername{after}% + \ifx\nprt@argone\nprt@mantissaname + \ifmmode + \settowidth{\nprt@digitwidth}{$#3% + 0$}% + \settowidth{\nprt@sepwidth}{$#3% + \csname nprt@separator@#2\endcsname$}% + \settowidth{\nprt@decimalwidth}{$#3% + \nprt@decimal$}% + \else + \settowidth{\nprt@digitwidth}{0}% + \settowidth{\nprt@sepwidth}{\csname nprt@separator@#2\endcsname}% + \settowidth{\nprt@decimalwidth}{\nprt@decimal}% + \fi + \else + \ifmmode + \settowidth{\nprt@digitwidth}{$#3% + {}^{0}$}% + \settowidth{\nprt@sepwidth}{$#3% + {}^{\csname nprt@separator@#2\endcsname}$}% + \settowidth{\nprt@decimalwidth}{$#3% + {}^{\nprt@decimal}$}% + \else + \settowidth{\nprt@digitwidth}{\textsuperscript{0}}% + \settowidth{\nprt@sepwidth}{% + \textsuperscript{\csname nprt@separator@#2\endcsname}}% + \settowidth{\nprt@decimalwidth}{\textsuperscript{\nprt@decimal}}% + \fi + \fi + \nprt@debug{Widths for #1 #2 decimal sign + (\ifx\nprt@argthree\@empty text mode\else math mode #3\fi):\MessageBreak + digits \the\nprt@digitwidth, + separators \the\nprt@sepwidth,\MessageBreak + decimal sign \the\nprt@decimalwidth}% + \ifnum\csname nprt@#1@fixeddigits@#2\endcsname<% + \csname thenprt@#1@digits#2\endcsname + \PackageWarning{numprint}{#1 exceeds reserved space + #2\MessageBreak + decimal sign}% + \fi + \setlength{\nprt@blockwidth}{% + \csname nprt@#1@fixeddigits@#2\endcsname\nprt@digitwidth}% + \setcounter{nprt@blockcnt}{\csname nprt@#1@fixeddigits@#2\endcsname}% + \addtocounter{nprt@blockcnt}{-1}% + \divide\c@nprt@blockcnt 3% + \ifnprt@numsepfour + \else + \ifnum\csname nprt@#1@fixeddigits@before\endcsname<5 + \ifnum\csname nprt@#1@fixeddigits@after\endcsname<5 + \setcounter{nprt@blockcnt}{0}% + \fi + \fi + \fi + \addtolength{\nprt@blockwidth}{\thenprt@blockcnt\nprt@sepwidth}% + \ifx\nprt@argtwo\nprt@aftername + \expandafter\ifnum\csname nprt@#1@fixeddigits@after\endcsname>0 + \addtolength{\nprt@blockwidth}{\the\nprt@decimalwidth}% + \fi + \fi +} +\newcommand*\npunit[1]{\def\nprt@unit{#1}} +\edef\nprt@unit{\@empty} +\newcommand*\npafternum[1]{\def\nprt@afternum{#1}} +\edef\nprt@afternum{\@empty} +\DeclareRobustCommand*\npmakebox{% + \@ifnextchar[% ] + {\nprt@makebox}{\makebox}% +} +\newcommand*\nprt@makebox{} +\def\nprt@makebox[#1]{% + \settowidth\@tempdima{#1}% + \makebox[\@tempdima]% +} +\ifnprt@npbold + \DeclareMathVersion{npbold} + \SetSymbolFont{operators}{npbold}{OT1}{cmr} {b}{n} + \SetSymbolFont{letters} {npbold}{OML}{cmm} {b}{it} + \SetSymbolFont{symbols} {npbold}{OMS}{cmsy}{b}{n} + \SetMathAlphabet\mathsf{npbold}{OT1}{cmss}{b}{n} + \SetMathAlphabet\mathit{npbold}{OT1}{cmr}{b}{it} + \def\npboldmath{\@nomath\npboldmath + \mathversion{npbold}} +\fi +\newtoks\nprt@digittoks +\newtoks\nprt@pretoks +\newtoks\nprt@posttoks +\newif\ifnprt@numfound +\def\nprt@begin{% + \nprt@digittoks={}% + \nprt@pretoks={}% + \nprt@posttoks={}% + \edef\nprt@unit{\@empty}% + \edef\nprt@afternum{\@empty}% + \nprt@numfoundfalse + \edef\nprt@allowedchars{\nprt@numberlist\nprt@dotlist\nprt@explist + \nprt@signlist\nprt@ignorelist}% + \nprt@getnexttok +} +\def\nprt@saveothertok#1{% + \ifnprt@numfound + \def\nprt@allowedchars{}% + \nprt@posttoks=\expandafter{\the\nprt@posttoks#1}% + \else + \nprt@pretoks=\expandafter{\the\nprt@pretoks#1}% + \fi +} +\def\nprt@getnexttok#1{% + \ifx\tabularnewline#1% + \let\nprt@next\tabularnewline + \else + \ifx\end#1% + \let\nprt@next\end + \else + \ifx\nprt@end#1% + \let\nprt@next\nprt@end + \else + \ifx\endtabular#1% + \let\nprt@next\endtabular + \else + \ifx\csname#1% + \let\nprt@next\csname + \else + \ifx\relax#1% + \let\nprt@next\relax + \else + \let\nprt@next\nprt@getnexttok + \nprt@IfCharInString{#1}{\nprt@allowedchars}{% + \nprt@numfoundtrue + \nprt@digittoks=\expandafter{\the\nprt@digittoks#1}% + }{% + \nprt@saveothertok{#1}% + }% + \fi % \relax + \fi % \csname + \fi % \endtabular + \fi % \nprt@end + \fi % \end + \fi % \tabularnewline + \nprt@next +} +\newif\ifnprt@mathtabular +\def\nprt@end#1#2#3#4#5#6{% + \the\nprt@pretoks + \begingroup + \npdigits{#1}{#2}% + \npnoexponentdigits + \ifnum#3<0 + \nprt@debug{no exponent alignment in tabular}% + \else + \ifnum#4<0 + \nprt@debug{exponent alignment in tabular with #3 digits}% + \npexponentdigits{#3}% + \else + \nprt@debug{exponent alignment in tabular with #3.#4 digits}% + \npexponentdigits[#4]{#3}% + \fi + \fi + \ifnprt@numfound + \ifmmode + \nprt@mathtabulartrue + \else + \nprt@mathtabularfalse + #5% + \fi + \ifx\nprt@unit\@empty + \numprint{\the\nprt@digittoks}% + \else + \numprint[\nprt@unit]{\the\nprt@digittoks}% + \fi + \ifnprt@mathtabular + \else + #6% + \fi + \else + \PackageInfo{numprint}{No number in tabular cell}% + \fi + \endgroup + \the\nprt@posttoks + \ifx\nprt@afternum\@empty + \else + \nprt@afternum + \fi +} +\ifnprt@newcolumntype + \newcolumntype{N}{} + \def\NC@rewrite@N{% + \nprt@digittoks{}% + \nprt@pretoks{}% + \@ifnextchar[{% ] + \nprt@rewrite@{}{}% + }{% + \nprt@rewrite@@{}{}{-1}[-1]% + }% + } + \newcolumntype{n}{} + \def\NC@rewrite@n{% + \nprt@digittoks{}% + \nprt@pretoks{}% + \@ifnextchar[{% ] + \nprt@rewrite@{$}{$}% + }{% + \nprt@rewrite@@{$}{$}{-1}[-1]% + }% + } + \def\nprt@rewrite@#1#2[#3]{% + \@ifnextchar[{%] + \nprt@rewrite@@{#1}{#2}{#3}% + }{% + \nprt@rewrite@@{#1}{#2}{#3}[-1]% + }% + } + \def\nprt@rewrite@@#1#2#3[#4]#5#6{% + \edef\nprt@rewrite@scratch{\the\@temptokena + >{\noexpand\nprt@begin\noexpand\ignorespaces}l% + <{\noexpand\nprt@end{#5}{#6}{#3}{#4}{#1}{#2}}% + }% + \@temptokena\expandafter{\nprt@rewrite@scratch}% + \NC@find + } +\else + \newcolumntype{n}[2]{>{\npdigits{#1}{#2}$}l<{$}} + \newcolumntype{N}[3]{% + >{\npdigits{#1}{#2}\npexponentdigits{#3}$}l<{$}} +\fi +\newif\ifnprt@roundup +\newcount\nprt@thisdigit +\def\nprt@round@after#1#2\@empty{% + \edef\nprt@argone{#1}% + \edef\nprt@argtwo{#2}% + \advance \nprt@curpos by 1 + \ifx\nprt@argone\@empty + \nprt@error{Rounding: End of number has been reached}{This may + not happen}% + \else + \ifnum\nprt@curpos>\nprt@rndpos + \ifnum\nprt@argone>4 + \nprt@rounduptrue + \fi + \else + \expandafter\nprt@round@after#2\@empty\@empty + \nprt@thisdigit=#1 + \ifnprt@roundup + \advance \nprt@thisdigit by 1 + \nprt@roundupfalse + \ifnum\nprt@thisdigit=10 + \nprt@thisdigit=0 + \nprt@rounduptrue + \fi + \fi + \expandafter\xdef\expandafter\nprt@newnum{% + \the\nprt@thisdigit\nprt@newnum}% + \fi + \fi +} +\def\nprt@round@before#1#2\@empty{% + \edef\nprt@argone{#1}% + \edef\nprt@argtwo{#2}% + \ifx\nprt@argtwo\@empty + \else + \expandafter\nprt@round@before#2\@empty + \fi + \ifx\nprt@argone\@empty + \nprt@thisdigit=0 + \else + \nprt@thisdigit=#1 + \fi + \ifnprt@roundup + \advance \nprt@thisdigit by 1 + \nprt@roundupfalse + \ifnum\nprt@thisdigit=10 + \nprt@thisdigit=0 + \nprt@rounduptrue + \fi + \fi + \ifx\nprt@argone\@empty + \xdef\nprt@newnum{\the\nprt@thisdigit}% + \stepcounter{nprt@\nprt@numname @digitsbefore}% + \else + \expandafter\xdef\expandafter\nprt@newnum{% + \the\nprt@thisdigit\nprt@newnum}% + \fi +} +\newcommand*\nprt@round[2]{% + \begingroup + \edef\nprt@numname{#1}% + \ifnum#2<0 + \else + \nprt@debug{\string\nprt@round: Round after #2 digits for #1}% + \setcounter{nprt@#1@digitsafter}{#2}% + \expandafter\g@addto@macro\csname nprt@#1@after\endcsname{% + \nprt@roundnull}% + \newcount\nprt@curpos + \newcount\nprt@rndpos + \nprt@rndpos=#2 + \nprt@roundupfalse + \edef\nprt@tmpnum{\csname nprt@#1@after\endcsname}% + \edef\nprt@newnum{}% + \expandafter\nprt@round@after\nprt@tmpnum\@empty\@empty + \expandafter\xdef\csname nprt@#1@after\endcsname{\nprt@newnum}% + \ifnprt@roundup + \edef\nprt@tmpnum{\csname nprt@#1@before\endcsname}% + \edef\nprt@newnum{}% + \expandafter\nprt@round@before\nprt@tmpnum\@empty\@empty + \ifnprt@roundup + \expandafter\xdef\expandafter\nprt@newnum{1\nprt@newnum}% + \stepcounter{nprt@#1@digitsbefore}% + \fi + \expandafter\xdef\csname nprt@#1@before\endcsname{\nprt@newnum}% + \fi + \fi + \endgroup + \ifnum#2<0 + \else + \ifnum#2=0 + \csname nprt@#1@decimalfoundfalse\endcsname + \else + \csname nprt@#1@decimalfoundtrue\endcsname + \fi + \fi +}% +\newcommand*\nprt@lpad[3]{% + \ifnum#2<0 + \else + \nprt@debug{\string\nprt@lpad: Padding #1 with #3 to a length of #2}% + \ifnum\csname thenprt@#1@digitsbefore\endcsname<#2 + \expandafter\xdef\csname nprt@#1@before\endcsname{% + #3\csname nprt@#1@before\endcsname}% + \stepcounter{nprt@#1@digitsbefore}% + \nprt@lpad{#1}{#2}{#3}% + \fi + \fi +}% +\expandafter\newcommand\csname nprt@sign@+\endcsname{\ensuremath{+}} +\expandafter\newcommand\csname nprt@sign@-\endcsname{\ensuremath{-}} +\expandafter\newcommand\csname nprt@sign@+-\endcsname{\ensuremath{\pm}} +\newcommand*\nprt@printsign[2]{% + \nprt@debug{\string\nprt@printsign: `#2'}% + \edef\nprt@marg{#2}% + \csname ifnprt@addplus@#1\endcsname + \ifx\nprt@marg\@empty + \edef\nprt@marg{+}% + \fi + \fi + \ifx\nprt@marg\@empty + \else + \@ifundefined{nprt@sign@\nprt@marg}{% + \PackageWarning{numprint}{% + Unknown sign `\nprt@marg'. Print as typed in}% + \nprt@marg + }{% + {\csname nprt@sign@\nprt@marg\endcsname}% + }% + \fi +} +\newcounter{nprt@digitsfirstblock} +\newcounter{nprt@blockcnt} +\newif\ifnprt@shortnumber +\newcommand*\nprt@printbefore[1]{% + \ifnprt@addmissingzero + \ifnum\csname thenprt@#1@digitsbefore\endcsname=0 + \expandafter\edef\csname nprt@#1@before\endcsname{0}% + \stepcounter{nprt@#1@digitsbefore}% + \fi + \fi + \begingroup + \edef\nprt@numbertoprint{\csname nprt@#1@before\endcsname}% + \ifnprt@numsepfour + \else + \ifnum\csname thenprt@#1@digitsbefore\endcsname<5 + \ifnum\csname thenprt@#1@digitsafter\endcsname<5 + \nprt@shortnumbertrue + \fi + \fi + \fi + \ifnprt@shortnumber + \nprt@numbertoprint + \else + % ganze Bloecke + \setcounter{nprt@blockcnt}{% + \csname thenprt@#1@digitsbefore\endcsname}% + \addtocounter{nprt@blockcnt}{-1}% + \divide\c@nprt@blockcnt 3% + \setcounter{nprt@digitsfirstblock}{% + \csname thenprt@#1@digitsbefore\endcsname}% + \setcounter{nprt@cntprint}{\thenprt@blockcnt}% + \multiply \c@nprt@cntprint 3% + \addtocounter{nprt@digitsfirstblock}{-\thenprt@cntprint}% + \ifnum\thenprt@digitsfirstblock=1 + \expandafter\nprt@printone\nprt@numbertoprint\@empty + \else + \ifnum\thenprt@digitsfirstblock=2 + \expandafter\nprt@printtwo\nprt@numbertoprint\@empty + \else + \ifnum\thenprt@digitsfirstblock=3 + \expandafter\nprt@printthree\nprt@numbertoprint\@empty + \else + \ifnum\thenprt@digitsfirstblock=0 + \else + \PackageError{numprint}{internal error}{}% + \fi + \fi + \fi + \fi + \fi + \endgroup +} +\def\nprt@printthree#1#2#3#4\@empty{% + #1#2#3% + \def\nprt@tmp{#4}% + \ifx\nprt@tmp\empty + \else + \nprt@separator@before% + \nprt@printthree#4\@empty\@empty\@empty + \fi +} +\def\nprt@printtwo#1#2#3\@empty{% + #1#2% + \def\nprt@tmp{#3}% + \ifx\nprt@tmp\empty + \else + \nprt@separator@before% + \nprt@printthree#3\@empty\@empty\@empty + \fi +} +\def\nprt@printone#1#2\@empty{% + #1% + \def\nprt@tmp{#2}% + \ifx\nprt@tmp\empty + \else + \nprt@separator@before% + \nprt@printthree#2\@empty\@empty\@empty + \fi +} +\newcommand*\nprt@printafter[1]{% + \csname ifnprt@#1@decimalfound\endcsname + \ifnprt@addmissingzero + \ifnum\csname thenprt@#1@digitsafter\endcsname=0 + \expandafter\edef\csname nprt@#1@after\endcsname{0}% + \stepcounter{nprt@#1@digitsafter}% + \fi + \fi + \ifx\nprt@replacenull\@empty + \else + \ifnum\csname thenprt@#1@digitsafter\endcsname=0 + \expandafter\edef\csname nprt@#1@after\endcsname{0}% + \stepcounter{nprt@#1@digitsafter}% + \fi + \fi + \fi + \begingroup + \edef\nprt@numbertoprint{\csname nprt@#1@after\endcsname}% + \ifx\nprt@numbertoprint\@empty + \else + \ifnprt@numsepfour + \else + \ifnum\csname thenprt@#1@digitsbefore\endcsname<5 + \ifnum\csname thenprt@#1@digitsafter\endcsname<5 + \nprt@shortnumbertrue + \fi + \fi + \fi + \ifx\nprt@replacenull\@empty + \else + \ifnum\nprt@numbertoprint=0 + \nprt@shortnumbertrue + \edef\nprt@numbertoprint{\nprt@replacenull}% + \fi + \fi + \ifnprt@shortnumber + \nprt@numbertoprint + \else + \expandafter\nprt@printthree@after% + \nprt@numbertoprint\@empty\@empty\@empty + \fi + \fi + \endgroup +} +\def\nprt@printthree@after#1#2#3#4\@empty{% + #1#2#3% + \def\nprt@tmp{#4}% + \ifx\nprt@tmp\empty + \else + \nprt@separator@after + \nprt@printthree@after#4\@empty\@empty\@empty + \fi +} +\DeclareRobustCommand*\numprint[2][\@empty]{% + \nprt@argumenterrorfalse + \xdef\nprt@exponent{\@empty}% + \xdef\nprt@mantissa{\@empty}% + \begingroup + \begingroup + \def\,{}% + \catcode`\~=\active % tilde is active + \def~{}% + \xdef\nprt@marg{#2}% + \endgroup + \def\nprt@oarg{#1}% + \def\nprt@@empty{\@empty}% + \def\nprt@nix{}% + \def\nprt@nixleer{ }% + \ifx\nprt@oarg\nprt@@empty + \nprt@debug{\string\numprint{\protect#2}}% + \else + \nprt@debug{\string\numprint[\protect#1]{\protect#2}}% + \fi + \ifx\nprt@marg\nprt@nix + \nprt@error{empty argument}{You have to specify a number in + the argument of \string\numprint}% + \fi + \ifx\nprt@marg\nprt@nixleer + \nprt@error{empty argument}{You have to specify a number in + the argument of \string\numprint}% + \fi + \expandafter\nprt@testcharacter\nprt@marg\@empty\@empty + \ifnprt@argumenterror + \begingroup\def\pm{+-}#2\endgroup + \else + \ifx\nprt@mantissa\@empty + \def\nprt@mantissa@sign{\@empty}% + \else + \nprt@testsign{mantissa}{\nprt@mantissa}% + \fi + \ifx\nprt@mantissa\@empty + \ifx\nprt@exponent\@empty + \nprt@error{Invalid number format. Printing the + argument\MessageBreak + verbatim}{Something is wrong in the format of the number}% + \else + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \fi + \else + \nprt@round{mantissa}{\nprt@rounddigits}% + \nprt@lpad{mantissa}{\nprt@lpaddigits}{\nprt@lpadchar}% + \fi + \ifnprt@expfound + \ifx\nprt@exponent\@empty + \nprt@error{Empty exponent}{If you specify an exponent + using one of the characters `\nprt@explist' you + have\MessageBreak + to give an exponent, too.}% + \else + \nprt@testsign{exponent}{\nprt@exponent}% + \nprt@round{exponent}{\nprt@roundexpdigits}% + \fi + \fi + \ifnprt@argumenterror + \begingroup\def\pm{+-}#2\endgroup + \else + \ifx\nprt@mantissa\@empty + \else + \ifnprt@mantissa@fixeddigits + \ifmmode + \mathchoice{% + \nprt@calcblockwidth{mantissa}{before}{\displaystyle}% + \makebox[\the\nprt@blockwidth][r]{$\displaystyle + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \nprt@printbefore{mantissa}$}% + }{% + \nprt@calcblockwidth{mantissa}{before}{\textstyle}% + \makebox[\the\nprt@blockwidth][r]{$\textstyle + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \nprt@printbefore{mantissa}$}% + }{% + \nprt@calcblockwidth{mantissa}{before}{\scriptstyle}% + \makebox[\the\nprt@blockwidth][r]{$\scriptstyle + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \nprt@printbefore{mantissa}$}% + }{% + \nprt@calcblockwidth{mantissa}{before}{\scriptscriptstyle}% + \makebox[\the\nprt@blockwidth][r]{$\scriptscriptstyle + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \nprt@printbefore{mantissa}$}% + }% + \else + \nprt@calcblockwidth{mantissa}{before}{\@empty}% + \makebox[\the\nprt@blockwidth][r]{% + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \nprt@printbefore{mantissa}% + }% + \fi + \else + \nprt@printsign{mantissa}{\nprt@mantissa@sign}% + \nprt@printbefore{mantissa}% + \fi + \ifnprt@mantissa@fixeddigits + \ifmmode + \mathchoice{% + \nprt@calcblockwidth{mantissa}{after}{\displaystyle}% + \makebox[\the\nprt@blockwidth][l]{$\displaystyle + \ifnprt@mantissa@decimalfound + \nprt@decimal + \fi + \nprt@printafter{mantissa}$}% + }{% + \nprt@calcblockwidth{mantissa}{after}{\textstyle}% + \makebox[\the\nprt@blockwidth][l]{$\textstyle + \ifnprt@mantissa@decimalfound + \nprt@decimal + \fi + \nprt@printafter{mantissa}$}% + }{% + \nprt@calcblockwidth{mantissa}{after}{\scriptstyle}% + \makebox[\the\nprt@blockwidth][l]{$\scriptstyle + \ifnprt@mantissa@decimalfound + \nprt@decimal + \fi + \nprt@printafter{mantissa}$}% + }{% + \nprt@calcblockwidth{mantissa}{after}{\scriptscriptstyle}% + \makebox[\the\nprt@blockwidth][l]{$\scriptscriptstyle + \ifnprt@mantissa@decimalfound + \nprt@decimal + \fi + \nprt@printafter{mantissa}$}% + }% + \else + \nprt@calcblockwidth{mantissa}{after}{\@empty}% + \makebox[\the\nprt@blockwidth][l]{% + \ifnprt@mantissa@decimalfound + \nprt@decimal + \fi + \nprt@printafter{mantissa}% + }% + \fi + \else + \ifnprt@mantissa@decimalfound + \nprt@decimal + \fi + \nprt@printafter{mantissa}% + \fi + \fi + \ifnprt@expfound + \def\nprt@printexp##1{##1}% + \ifx\nprt@exponent\@empty + \nprt@error{Invalid number format in + exponent. Printing\MessageBreak + garbage}{Something is wrong in the format of the exponent}% + \fi + \else + \ifnprt@exponent@fixeddigits + \def\nprt@printexp##1{\hphantom{##1}}% + \else + \def\nprt@printexp##1{}% + \fi + \fi + \begingroup + \def\color##1{}% + \nprt@printexp{% + \ifx\nprt@mantissa\@empty + \else + \nprt@prod + \fi + \ifmmode 10^\else 10\expandafter\textsuperscript\fi{% + \ifnprt@exponent@fixeddigits + \ifmmode + \mathchoice{% + \nprt@calcblockwidth{exponent}{before}{\displaystyle}% + \makebox[\the\nprt@blockwidth][r]{$\displaystyle + \nprt@printsign{exponent}{\nprt@exponent@sign}% + \nprt@printbefore{exponent}$}% + }{% + \nprt@calcblockwidth{exponent}{before}{\textstyle}% + \makebox[\the\nprt@blockwidth][r]{$\textstyle + \nprt@printsign{exponent}{\nprt@exponent@sign}% + \nprt@printbefore{exponent}$}% + }{% + \nprt@calcblockwidth{exponent}{before}{\scriptstyle}% + \makebox[\the\nprt@blockwidth][r]{$\scriptstyle + \nprt@printsign{exponent}{\nprt@exponent@sign}% + \nprt@printbefore{exponent}$}% + }{% + \nprt@calcblockwidth{exponent}{before}{\scriptscriptstyle}% + \makebox[\the\nprt@blockwidth][r]{$\scriptscriptstyle + \nprt@printsign{exponent}{\nprt@exponent@sign}% + \nprt@printbefore{exponent}$}% + }% + \else + \nprt@calcblockwidth{exponent}{before}{\@empty}% + \makebox[\the\nprt@blockwidth][r]{% + \nprt@printsign{exponent}{\nprt@exponent@sign}% + \nprt@printbefore{exponent}% + }% + \fi + \else + \nprt@printsign{exponent}{\nprt@exponent@sign}% + \nprt@printbefore{exponent}% + \fi + \ifnprt@exponent@decimalfound + \PackageWarning{numprint}{Non-integer exponent}% + \fi + \ifnprt@exponent@fixeddigits + \ifmmode + \mathchoice{% + \nprt@calcblockwidth{exponent}{after}{\displaystyle}% + \makebox[\the\nprt@blockwidth][l]{$\displaystyle + \ifnprt@exponent@decimalfound + \nprt@decimal + \fi + \nprt@printafter{exponent}$}% + }{% + \nprt@calcblockwidth{exponent}{after}{\textstyle}% + \makebox[\the\nprt@blockwidth][l]{$\textstyle + \ifnprt@exponent@decimalfound + \nprt@decimal + \fi + \nprt@printafter{exponent}$}% + }{% + \nprt@calcblockwidth{exponent}{after}{\scriptstyle}% + \makebox[\the\nprt@blockwidth][l]{$\scriptstyle + \ifnprt@exponent@decimalfound + \nprt@decimal + \fi + \nprt@printafter{exponent}$}% + }{% + \nprt@calcblockwidth{exponent}{after}{\scriptscriptstyle}% + \makebox[\the\nprt@blockwidth][l]{$\scriptscriptstyle + \ifnprt@exponent@decimalfound + \nprt@decimal + \fi + \nprt@printafter{exponent}$}% + }% + \else + \nprt@calcblockwidth{exponent}{after}{\@empty}% + \makebox[\the\nprt@blockwidth][l]{% + \ifnprt@exponent@decimalfound + \nprt@decimal + \fi + \nprt@printafter{exponent}% + }% + \fi + \else + \ifnprt@exponent@decimalfound + \nprt@decimal + \fi + \nprt@printafter{exponent}% + \fi + }% 10^ + }% \nprt@printexp + \endgroup + \fi + \fi + \ifx\nprt@oarg\nprt@@empty + \else + \def\textdegree{% + \PackageWarning{numprint}{The unit is typeset in mathmode. Use + \string\tcdegree\space of\MessageBreak + the mathcomp package or \string\degree\space of the + gensymb\MessageBreak + package}% + \csname tcdegree\endcsname + }% + \def\nprt@PackageError##1##2{\PackageWarning{numprint}{##1}}% + \def\textcelsius{% + \begingroup + \@ifundefined{tccelsius}{\@ifundefined{celsius}{% + \def\nprt@PackageError####1####2{% + \PackageError{numprint}{####1}{####2}}% + }{\celsius}}{\tccelsius}% + \nprt@PackageError{The unit is typeset in + mathmode. Use \string\tccelsius\space of\MessageBreak + the mathcomp package or \string\celsius\space of the + gensymb\MessageBreak + package}{If you load the mathcomp package + \string\textcelsius\space is substituted by + \string\tccelsius. If you load the gensymb package + \string\textcelsius\space is substituted by \string\celsius.}% + \endgroup + }% + \def\textohm{% + \begingroup + \@ifundefined{tcohm}{\@ifundefined{ohm}{% + \def\nprt@PackageError####1####2{% + \PackageError{numprint}{####1}{####2}}% + }{\ohm}}{\tcohm}% + \nprt@PackageError{The unit is typeset in + mathmode. Use \string\tcohm\space of\MessageBreak + the mathcomp package or \string\ohm\space of the + gensymb\MessageBreak + package}{If you load the mathcomp package + \string\textohm\space is substituted by + \string\tcohm. If you load the gensymb package + \string\textohm\space is substituted by \string\ohm.}% + \endgroup + }% + \def\textmu{% + \begingroup + \@ifundefined{tcmu}{% + \def\nprt@PackageError####1####2{% + \PackageError{numprint}{####1}{####2}}% + }{\tcmu}% + \nprt@PackageError{The unit is typeset in + mathmode. Use \string\tcmu\space of\MessageBreak + the mathcomp package}{If you load the mathcomp package + \string\textmu\space is substituted by \string\tcmu.}% + \endgroup + }% + \def\textperthousand{% + \begingroup + \@ifundefined{tcperthousand}{\@ifundefined{perthousand}{% + \def\nprt@PackageError####1####2{% + \PackageError{numprint}{####1}{####2}}% + }{\perthousand}}{\tcperthousand}% + \nprt@PackageError{The unit is typeset in + mathmode. Use \string\tcperthousand\MessageBreak + of the mathcomp package or \string\perthousand\space of + the\MessageBreak + gensymb package}{If you load the mathcomp package + \string\textperthousand\space is substituted by + \string\tcperthousand. If you load the gensymb package + \string\textperthousand\space is substituted by + \string\perthousand.}% + \endgroup + }% + \def\nprt@tmpunit{\tcdegree}% + \ifx\nprt@oarg\nprt@tmpunit + \ensuremath{\nprt@degreesep}% + \else + \def\nprt@tmpunit{\degree}% + \ifx\nprt@oarg\nprt@tmpunit + \ensuremath{\nprt@degreesep}% + \else + \def\nprt@tmpunit{\textdegree}% + \ifx\nprt@oarg\nprt@tmpunit + \ensuremath{\nprt@degreesep}% + \else + \def\nprt@tmpunit{\%}% + \ifx\nprt@oarg\nprt@tmpunit + \ensuremath{\nprt@percentsep}% + \else + \ensuremath{\nprt@unitsep}% + \fi + \fi + \fi + \fi + \npunitcommand{\nprt@oarg}% + \fi + \endgroup +} +\newcounter{nprt@cntprint} +\DeclareRobustCommand*\cntprint[2][\@empty]{% + \@ifundefined{c@#2}{\@nocounterr{#2}}{% + \numprint[#1]{\arabic{#2}}% + }% +} +\DeclareRobustCommand*\lenprint[2][\@empty]{% + \begingroup + \edef\nprt@oarg{#1}% + \edef\nprt@tmp{\@empty}% + \ifx\nprt@oarg\nprt@tmp + \def\nprt@oarg{pt}% + \fi + \@ifundefined{nprt@factor@\nprt@oarg}{% + \PackageError{numprint}{Invalid unit `#1'}{% + The requested unit is not defined using \string\npdefunit.^^J% + Using `pt' instead.}% + \def\nprt@oarg{pt}% + }{}% + \setlength{\@tempdima}{#2}% + \setlength{\@tempdima}{\csname nprt@factor@\nprt@oarg\endcsname\@tempdima}% + \@ifundefined{nprt@unit@\nprt@oarg}{% + \PackageError{numprint}{Unknown unit name `\nprt@oarg'}{% + Send a bug report to harald.harders@tu-bs.de with a short + example showing this bug.}% + }{% + \edef\nprt@oarg{\csname nprt@unit@\nprt@oarg\endcsname}% + }% + \expandafter\numprint\expandafter[\nprt@oarg]{\strip@pt\@tempdima}% + \endgroup +} +\newcommand*\npdefunit[3]{% + \if#3* + \else + \expandafter\def\csname nprt@factor@#1\endcsname{#3}% + \fi + \expandafter\def\csname nprt@unit@#1\endcsname{#2}% +} +\npdefunit{pt}{pt}{1.00000000000} +\npdefunit{bp}{bp}{0.99626400996} +\npdefunit{in}{in}{0.01383700013} +\npdefunit{ft}{ft}{0.00115308334} +\npdefunit{mm}{mm}{0.35145980351} +\npdefunit{cm}{cm}{0.03514598035} +\npdefunit{m}{m}{0.0003514598035} +\npdefunit{km}{km}{0.0000003514598035} +\newcommand*\nprt@ifundefined[1]{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname #1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +\newcommand\nprt@addto[2]{% + \expandafter\nprt@ifundefined{#1}{}{% + \expandafter\addto\expandafter{\csname #1\endcsname}{#2}% + }% +} +\newcommand\npaddtolanguage[2]{% + \nprt@addto{extras#1}{\csname npstyle#2\endcsname}% + \nprt@addto{noextras#1}{\npstyledefault}% +} +\newcommand*\npstyledefault{% + \npthousandsep{\,}% + \npdecimalsign{,}% + \npproductsign{\cdot}% + \npunitseparator{\,}% + \npdegreeseparator{}% + \nppercentseparator{\nprt@unitsep}% +} + \npstyledefault +\newcommand*\npstylegerman{% + \npthousandsep{\,}% + \npdecimalsign{,}% + \npproductsign{\cdot}% + \npunitseparator{\,}% + \npdegreeseparator{}% + \nppercentseparator{\nprt@unitsep}% +} +\newcommand*\npstyleenglish{% + \npthousandsep{,}% + \npdecimalsign{.}% + \npproductsign{\times}% + \npunitseparator{\,}% + \npdegreeseparator{}% + \nppercentseparator{\nprt@unitsep}% +} +\newcommand*\npstyleportuguese{% + \npthousandsep{\,}% + \npdecimalsign{,}% + \npproductsign{\cdot}% + \npunitseparator{\,}% + \npdegreeseparator{}% + \nppercentseparator{\nprt@unitsep}% +} +\AtBeginDocument{% + \ifnprt@autolanguage + \@ifpackageloaded{babel}{% + \npaddtolanguage{UKenglish}{english}% + \npaddtolanguage{USenglish}{english}% + \npaddtolanguage{american}{english}% + \npaddtolanguage{austrian}{german}% + \npaddtolanguage{british}{english}% + \npaddtolanguage{canadian}{english}% + \npaddtolanguage{english}{english}% + \npaddtolanguage{german}{german}% + \npaddtolanguage{naustrian}{german}% + \npaddtolanguage{ngerman}{german}% + \npaddtolanguage{brazil}{portuguese} + \npaddtolanguage{brazilian}{portuguese} + \npaddtolanguage{portuges}{portuguese} + \npaddtolanguage{portuguese}{portuguese} + \expandafter\selectlanguage\expandafter{\languagename}% + }{% + \npstyleenglish + }% + \fi +} +\InputIfFileExists{numprint.cfg}{% + \message{Configuration file `numprint.cfg' loaded.}% +}{% + \message{No configuration file `numprint.cfg' found.}% +} +\newcommand*\nprt@renameerror[1]{% + \expandafter\def\csname #1\endcsname{% + \PackageError{numprint}{This command has been renamed + to\MessageBreak + \string\np #1}{In order to avoid problems with other + packages and for consistency, this\MessageBreak + command has been renamed in this version.}% + }% +} +\nprt@renameerror{fourdigitsep} +\nprt@renameerror{fourdigitnosep} +\nprt@renameerror{addmissingzero} +\nprt@renameerror{noaddmissingzero} +\nprt@renameerror{digits} +\nprt@renameerror{nodigits} +\nprt@renameerror{exponentdigits} +\nprt@renameerror{noexponentdigits} + +\endinput +%% +%% End of file `numprint.sty'. diff --git a/Master/texmf-dist/tex/latex/numprint/numprint032.sty b/Master/texmf-dist/tex/latex/numprint/numprint032.sty new file mode 100644 index 00000000000..77f1aa9495d --- /dev/null +++ b/Master/texmf-dist/tex/latex/numprint/numprint032.sty @@ -0,0 +1,559 @@ +%% +%% This is file `numprint032.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% numprint032.dtx (with options: `package') +%% +%% numprint package +%% +%% Copyright 2000--2005 Harald Harders +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN +%% archives in directory macros/latex/base/lppl.txt; either +%% version 1 of the License, or any later version. +%% +%% h.harders@tu-bs.de +%% +\def\packagename{numprint} +\def\nprtfileversion{0.32} +\def\nprtfiledate{2003/09/18} +\def\nprtdocdate{2003/09/18} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{numprint032}[\nprtfiledate\space v\nprtfileversion\space + Print numbers] +\message{Package `numprint032', Version \nprtfileversion\space of \nprtfiledate.} +\message{Compatiblity version of numprint for versions prior 1.00} +\RequirePackage{calc} +\RequirePackage{array} +\newif\if@numsepfour +\newcommand\@addmissingzero{} +\newcommand*{\fourdigitsep}{\@numsepfourtrue}% +\newcommand*{\fourdigitnosep}{\@numsepfourfalse}% +\newcommand*{\addmissingzero}{\def\@addmissingzero{0}}% +\newcommand*{\noaddmissingzero}{\def\@addmissingzero{}}% +\DeclareOption{nosepfour}{\fourdigitnosep} +\DeclareOption{sepfour}{\fourdigitsep} +\DeclareOption{noaddmissingzero}{\noaddmissingzero} +\DeclareOption{addmissingzero}{\addmissingzero} +\ExecuteOptions{sepfour,addmissingzero} +\ProcessOptions\relax +\newcommand{\npdecimalsign}[1]{\def\nprt@decimal{{#1}}} +\newcommand{\npthousandsep}[1]{\def\nprt@thousand{{#1}}% + \def\nprt@thousandthpart{{#1}}} +\newcommand{\npthousandthpartsep}[1]{\def\nprt@thousandthpart{{#1}}} +\newcommand{\npproductsign}[1]{\def\nprt@prod{\ensuremath{{}#1{}}}} +\newcommand{\npunitseparator}[1]{\def\nprt@unitsep{{#1}}} +\npthousandsep{\,}% +\npthousandthpartsep{\,}% +\npdecimalsign{,}% +\npproductsign{{}\cdot{}}% +\npunitseparator{\,}% +\def\@fillnull#1#2{% + \@tempcnta=0 + \loop + \g@addto@macro{#1}{0}% + \advance\@tempcnta by 1 + \ifnum\@tempcnta<#2 + \repeat +} +\newcommand\nprounddigits[1]{% + \def\nprt@rounddigits{#1}% + \def\nprt@roundnull{}% + \@fillnull{\nprt@roundnull}{#1}% +} +\newcommand\npnoround{\nprounddigits{-1}} +\npnoround +\newcommand\nproundexpdigits[1]{% + \def\nprt@roundexpdigits{#1}% + \def\nprt@roundexpnull{}% + \@fillnull{\nprt@roundexpnull}{#1}% + } +\newcommand\npnoroundexp{\nproundexpdigits{-1}} +\npnoroundexp +\newcommand\npreplacenull[1]{\def\nprt@replacenull{#1}} +\newcommand\npprintnull{\let\nprt@replacenull=\@empty} +\npprintnull +\def\nprt@plus@test{+} +\def\nprt@minus@test{-} +\def\nprt@plusminus@test{\pm} +\def\nprt@plus{\ensuremath{+}} +\def\nprt@minus{\ensuremath{-}} +\def\nprt@plusminus{\ensuremath{\pm}} +\def\nprt@printdigit#1{% + \def\nprt@tmp{#1}% + \ifx\nprt@tmp\nprt@plus@test + \nprt@plus + \else + \ifx\nprt@tmp\nprt@minus@test + \nprt@minus + \else + \ifx\nprt@tmp\nprt@plusminus@test + \nprt@plusminus + \else + #1% + \fi + \fi + \fi +} +\newif\ifnprt@block +\newif\ifnprt@blockexp +\newif\ifnprt@exponent +\newif\ifnprt@inmath +\newcommand{\digits}[2]{% + \xdef\nprt@blockbefore{#1}% + \xdef\nprt@blockafter{#2}% + \nprt@blocktrue}% +\newcommand{\nodigits}{\nprt@blockfalse}% +\newcommand{\exponentdigits}[1]{% + \xdef\nprt@blockexpbefore{#1}% + \nprt@blockexptrue}% +\newcommand{\noexponentdigits}{\nprt@blockexpfalse}% +\def\nprt@three#1#2#3#4\@empty{% + \nprt@printdigit#1% + \nprt@printdigit#2% + \nprt@printdigit#3% + \def\nprt@tmp{#4}% + \ifx\nprt@tmp\empty + \else + \nprt@thousand% + \nprt@three#4\@empty\@empty\@empty + \fi +} +\def\nprt@threeafter#1#2#3#4\@empty{% + \nprt@printdigit#1% + \nprt@printdigit#2% + \nprt@printdigit#3% + \def\nprt@tmp{#4}% + \ifx\nprt@tmp\empty + \else + \nprt@thousandthpart% + \nprt@threeafter#4\@empty\@empty\@empty + \fi +} +\def\nprt@two#1#2#3\@empty{% + \nprt@printdigit#1% + \nprt@printdigit#2% + \def\nprt@tmp{#3}% + \ifx\nprt@tmp\empty + \else + \nprt@thousand\nprt@three#3\@empty\@empty\@empty + \fi +} +\def\nprt@one#1#2\@empty{% + \nprt@printdigit#1% + \def\nprt@tmp{#2}% + \ifx\nprt@tmp\empty + \else + \def\nprt@tmp{#1}% + \ifx\nprt@tmp\nprt@plus@test + \else + \ifx\nprt@tmp\nprt@minus@test + \else + \ifx\nprt@tmp\nprt@plusminus@test + \else + \nprt@thousand + \fi + \fi + \fi + \nprt@three#2\@empty\@empty\@empty + \fi +} +\def\nprt@exptest#1e#2\@empty{\gdef\nprt@tmp{#2}} +\def\nprt@Exptest#1E#2\@empty{\gdef\nprt@tmp{#2}} +\def\nprt@commatest#1,#2\@empty{\gdef\nprt@tmp{#2}} +\def\nprt@dottest#1.#2\@empty{\gdef\nprt@tmp{#2}} +\def\nprt@exp#1e#2\@empty{\expnumprint{#1}{#2}} +\def\nprt@Exp#1E#2\@empty{\expnumprint{#1}{#2}} +\def\nprt@comma#1,#2\@empty{% + \nprt@dotcomma{#1}{#2}} +\def\nprt@dot#1.#2\@empty{% + \nprt@dotcomma{#1}{#2}} +\def\nprt@dotcomma#1#2{% + \begingroup + \ifnprt@exponent + \edef\nprt@rounddigits{\nprt@roundexpdigits}% + \edef\nprt@roundnull{\nprt@roundexpnull}% + \fi + \ifnum\nprt@rounddigits<0 + \def\nprt@charsbeforecomma{#1}% + \def\nprt@charsaftercomma{#2}% + \else + \def\nprt@charsbeforecomma{}% + \def\nprt@charsaftercomma{}% + \edef\zwei{#2\nprt@roundnull}% + \expandafter\nprt@roundaftercomma\zwei\empty + \if@@roundup + \nprt@roundbeforecomma#1\empty + \if@@roundup + \expandafter\xdef\expandafter\nprt@charsbeforecomma{% + 1\nprt@charsbeforecomma}% + \fi + \else + \def\nprt@charsbeforecomma{#1}% + \fi + \fi + \nprt@@hassignfalse + \expandafter\nprt@count\nprt@charsaftercomma\@empty\@empty\@empty + \setcounter{nprt@digitsafterdecimal}{\thenprt@digitsbeforedecimal}% + \expandafter\nprt@hassign\nprt@charsbeforecomma\@empty\@empty + \expandafter\nprt@count\nprt@charsbeforecomma\@empty\@empty\@empty + \ifnum\the\c@nprt@digitsbeforedecimal=0 + \@addmissingzero + \else + \expandafter\beforecomma\nprt@charsbeforecomma\@empty\@empty + \fi + \ifnum\nprt@rounddigits=0 + \else + \nprt@decimal + \ifnum\the\c@nprt@digitsafterdecimal>0 + \aftercomma{\nprt@charsaftercomma}% + \else + \ifx\nprt@replacenull\@empty + \@addmissingzero + \else + \nprt@replacenull + \fi + \fi + \fi + \endgroup +} +\newcommand{\expnumprint}[2]{% + \def\nprt@tmp{#1}% + \ifx\nprt@tmp\@empty + \nprt@exponenttrue + \ifmmode + 10^{\numprint{#2}}% + \else + 10\textsuperscript{\numprint{#2}}% + \fi + \else + \ifmmode + \numprint{#1}% + \nprt@exponenttrue + \nprt@prod 10^{\numprint{#2}}% + \else + \numprint{#1}% + \nprt@exponenttrue + \nprt@prod 10\textsuperscript{\numprint{#2}}% + \fi + \fi + \nprt@exponentfalse +} +\def\nprt@empty{\@empty}% +\DeclareRobustCommand*\numprint[2][\@empty]{% + \setcounter{nprt@digitsafterdecimal}{0}% + \setcounter{nprt@digitsbeforedecimal}{0}% + \edef\nprt@marg{#2}% + \expandafter\nprt@Exptest\nprt@marg E\@empty + \ifx\nprt@tmp\empty + \expandafter\nprt@exptest\nprt@marg e\@empty + \ifx\nprt@tmp\empty + \expandafter\nprt@commatest\nprt@marg,\@empty + \ifx\nprt@tmp\empty + \expandafter\nprt@dottest\nprt@marg.\@empty + \ifx\nprt@tmp\empty + \expandafter\nprt@hassign\nprt@marg\@empty + \expandafter\nprt@count\nprt@marg\@empty\@empty\@empty + \begingroup + \ifnprt@exponent + \def\nprt@rounddigits{\nprt@roundexpdigits}% + \def\nprt@roundnull{\nprt@roundexpnull}% + \fi + \ifnum\nprt@rounddigits>0 + \setcounter{nprt@digitsafterdecimal}{\nprt@rounddigits}% + \fi + \expandafter\beforecomma\nprt@marg\@empty\@empty + \ifnum\nprt@rounddigits>0 + \nprt@decimal + \aftercomma{\nprt@roundnull}% + \fi + \endgroup + \else + \expandafter\nprt@dot\nprt@marg\@empty + \fi + \else + \expandafter\nprt@comma\nprt@marg\@empty + \fi + \else + \expandafter\nprt@exp\nprt@marg\@empty + \fi + \else + \expandafter\nprt@Exp\nprt@marg\@empty + \fi + \def\nprt@unit{#1}% + \ifx\nprt@unit\nprt@empty + \else + \ensuremath{\nprt@unitsep\mathrm{\nprt@unit}}% + \fi +} +\newcounter{nprt@countblocksbefore}% +\newcounter{nprt@digitsfirstblock}% +\newcounter{nprt@digitsafterdecimal}% +\newcounter{nprt@digitsbeforedecimal}% +\newif\ifnprt@@hassign +\def\nprt@hassign#1#2\@empty{% + \ifnum-9>-1#1 + \nprt@@hassignfalse + \else + \nprt@@hassigntrue + \fi +} +\def\nprt@count#1#2\@empty{% + \setcounter{nprt@digitsbeforedecimal}{0}% + \edef\nprt@arg{#1}% + \ifx\nprt@arg\@empty + \else + \ifnprt@@hassign + \nprt@@count#2\@empty\@empty + \else + \nprt@@count#1#2\@empty\@empty + \fi + \fi + \setcounter{nprt@countblocksbefore}{\arabic{nprt@digitsbeforedecimal}/3}% + \setcounter{nprt@digitsfirstblock}{% + \arabic{nprt@digitsbeforedecimal}-3*\arabic{nprt@countblocksbefore}}% +} +\def\nprt@@count#1#2\@empty{% + \ifnum-9>-1#1 + \addtocounter{nprt@digitsbeforedecimal}{1}% + \def\nprt@tmp{#2}% + \ifx\nprt@tmp\empty + \else + \nprt@@count#2\@empty\@empty + \fi + \else + \PackageError{numprint}{Incorrect number format in + \string\numprint}{% + The main argument of the \string\numprint\space command may only + be started\MessageBreak + with \string"+\string", \string"-\string", or + \string"\string\pm\string" and then contain of\MessageBreak + digits \string"0\string" to \string"9\string", + \string",\string", \string".\string", \string"e\string", and + \string"E\string".}% + \fi +} +\newlength{\nprt@digitwidth}% +\newlength{\nprt@sepwidth}% +\newcounter{nprt@digitcount}% +\newcounter{nprt@sepcount}% +\newlength{\nprt@blockwidth}% +\def\beforecomma#1#2\@empty{% + \ifnprt@block + \ifnprt@exponent + \else + \settowidth{\nprt@digitwidth}{1}% + \settowidth{\nprt@sepwidth}{\nprt@thousand}% + \setcounter{nprt@digitcount}{\nprt@blockbefore}% + \setcounter{nprt@sepcount}{(\nprt@blockbefore-1)/3}% + \setlength{\nprt@blockwidth}{% + \arabic{nprt@digitcount}\nprt@digitwidth+% + \arabic{nprt@sepcount}\nprt@sepwidth}% + \if@numsepfour + \else + \ifnum\nprt@blockbefore=4 + \ifnum\nprt@blockafter<5 + \setlength{\nprt@blockwidth}{4\nprt@digitwidth}% + \fi + \fi + \fi + \ifmmode\nprt@inmathtrue\fi + \makebox[\nprt@blockwidth][r]{% + \ifnprt@inmath$\fi %$ (only for syntax highlighing in emacs) + \fi + \fi + \ifnprt@blockexp + \ifnprt@exponent + \settowidth{\nprt@digitwidth}{1}% + \settowidth{\nprt@sepwidth}{\nprt@thousand}% + \setcounter{nprt@digitcount}{\nprt@blockexpbefore}% + \setcounter{nprt@sepcount}{(\nprt@blockexpbefore-1)/3}% + \setlength{\nprt@blockwidth}{% + \arabic{nprt@digitcount}\nprt@digitwidth+% + \arabic{nprt@sepcount}\nprt@sepwidth}% + \if@numsepfour + \else + \ifnum\nprt@blockexpbefore=4 + \setlength{\nprt@blockwidth}{4\nprt@digitwidth}% + \fi + \fi + \ifmmode\nprt@inmathtrue\fi + \makebox[\nprt@blockwidth][r]{% + \ifnprt@inmath$\scriptstyle\fi %$ (only for syntax highlighing in emacs) + \fi + \fi + \ifnprt@@hassign + \nprt@printdigit{#1}% + \edef\nprt@tmp{#2}% + \else + \edef\nprt@tmp{#1#2}% + \fi + \ifnum\thenprt@digitsfirstblock=1 + \ifnum\thenprt@digitsbeforedecimal=4 + \if@numsepfour + \expandafter\nprt@one\nprt@tmp\@empty\@empty\@empty + \else + \ifnum\thenprt@digitsafterdecimal<5 + \nprt@tmp\ignorespaces + \else + \expandafter\nprt@one\nprt@tmp\@empty\@empty\@empty + \fi + \fi + \else + \expandafter\nprt@one\nprt@tmp\@empty\@empty\@empty + \fi + \fi + \ifnum\thenprt@digitsfirstblock=2 + \expandafter\nprt@two\nprt@tmp\@empty\@empty\@empty + \fi + \ifnum\thenprt@digitsfirstblock=0 + \expandafter\nprt@three\nprt@tmp\@empty\@empty\@empty\@empty + \fi + \ifnprt@blockexp + \ifnprt@exponent + \ifnprt@inmath$\fi %$ (only for syntax highlighing in emacs) + }% + \fi + \fi + \ifnprt@block + \ifnprt@exponent + \else + \ifnprt@inmath$\fi %$ (only for syntax highlighing in emacs) + }% + \fi + \fi +} +\newcommand{\aftercomma}[1]{% + \ifnprt@block + \ifnprt@exponent + \else + \settowidth{\nprt@digitwidth}{1}% + \settowidth{\nprt@sepwidth}{\nprt@thousand}% + \setcounter{nprt@digitcount}{\nprt@blockafter}% + \setcounter{nprt@sepcount}{(\nprt@blockafter-1)/3}% + \setlength{\nprt@blockwidth}{% + \arabic{nprt@digitcount}\nprt@digitwidth+% + \arabic{nprt@sepcount}\nprt@sepwidth}% + \if@numsepfour + \else + \ifnum\nprt@blockafter=4 + \ifnum\nprt@blockbefore<5 + \setlength{\nprt@blockwidth}{4\nprt@digitwidth}% + \fi + \fi + \fi + \ifmmode\nprt@inmathtrue\fi + \makebox[\nprt@blockwidth][l]{% + \ifnprt@inmath$\fi %$ (only for syntax highlighing in emacs) + \fi + \fi + \ifx\nprt@replacenull\@empty + \else + \ifnum#1=0 + \setcounter{nprt@digitsafterdecimal}{0}% + \fi + \fi + \ifnum\thenprt@digitsafterdecimal=4 + \if@numsepfour + \expandafter\nprt@threeafter#1\@empty\@empty\@empty + \else + \ifnum\thenprt@digitsbeforedecimal<5 + #1\ignorespaces + \else + \expandafter\nprt@threeafter#1\@empty\@empty\@empty + \fi + \fi + \else + \ifx\nprt@replacenull\@empty + \expandafter\nprt@threeafter#1\@empty\@empty\@empty + \else + \ifnum#1=0 + \nprt@replacenull + \else + \expandafter\nprt@threeafter#1\@empty\@empty\@empty + \fi + \fi + \fi + \ifnprt@block + \ifnprt@exponent + \else + \ifnprt@inmath$\fi %$ (only for syntax highlighing in emacs) + }% + \fi + \fi +} +\newcounter{nprt@position} +\newif\if@@roundup +\newcounter{nprt@thisdigit} +\def\nprt@roundaftercomma#1#2\empty{% + \addtocounter{nprt@position}{1}% + \edef\zwei{#2}% + \ifx\zwei\empty + \else + \expandafter\ifnum\thenprt@position<\nprt@rounddigits + \nprt@roundaftercomma#2\empty + \else + \nprt@roundup#2\empty + \fi + \fi + \setcounter{nprt@thisdigit}{#1}% + \if@@roundup + \addtocounter{nprt@thisdigit}{1}% + \ifnum\thenprt@thisdigit>9 + \@@rounduptrue + \setcounter{nprt@thisdigit}{0}% + \else + \@@roundupfalse + \fi + \fi + \expandafter\xdef\expandafter\nprt@charsaftercomma{% + \thenprt@thisdigit\nprt@charsaftercomma}% + \addtocounter{nprt@position}{-1}% +} +\def\nprt@roundup#1#2\empty{% + \ifnum#1>4 + \@@rounduptrue + \else + \@@roundupfalse + \fi +} +\def\nprt@roundbeforecomma#1#2\empty{% + \edef\zwei{#2}% + \ifx\zwei\empty + \else + \nprt@roundbeforecomma#2\empty + \fi + \edef\eins{#1}% + \ifnum-9>-1#1 + \setcounter{nprt@thisdigit}{#1}% + \if@@roundup + \addtocounter{nprt@thisdigit}{1}% + \ifnum\thenprt@thisdigit>9 + \@@rounduptrue + \setcounter{nprt@thisdigit}{0}% + \else + \@@roundupfalse + \fi + \fi + \expandafter\xdef\expandafter\nprt@charsbeforecomma{% + \thenprt@thisdigit\nprt@charsbeforecomma}% + \else + \if@@roundup + \expandafter\xdef\expandafter\nprt@charsbeforecomma{% + 1\nprt@charsbeforecomma}% + \@@roundupfalse + \fi + \expandafter\xdef\expandafter\nprt@charsbeforecomma{% + #1\nprt@charsbeforecomma}% + \fi +} +\newcolumntype{n}[2]{>{\digits{#1}{#2}$}l<{$\nodigits}} +\newcolumntype{N}[3]{% + >{\digits{#1}{#2}\exponentdigits{#3}$}l<{$\nodigits\noexponentdigits}} + +\endinput +%% +%% End of file `numprint032.sty'. |