%%
%% 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, 2007, 2008, 2012 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.
%% 
%%   harald.harders@gmx.de
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{numprint}
  [2012/08/20  v1.39  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*\npcelsiusseparator[1]{\def\nprt@celsiussep{{#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}%
        \advance\csname c@nprt@#1@digitsafter\endcsname by 1\relax
      \else
        \expandafter\g@addto@macro\csname nprt@#1@before\endcsname{#2}%
        \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax
      \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}%
  \advance\c@nprt@blockcnt by -1\relax
  \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}%
    \advance\csname c@nprt@\nprt@numname @digitsbefore\endcsname 1\relax
  \else
    \expandafter\xdef\expandafter\nprt@newnum{%
      \the\nprt@thisdigit\nprt@newnum}%
  \fi
}
\newcount\nprt@curpos
\newcount\nprt@rndpos
\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}%
      \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}%
          \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax
        \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}%
      \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax
      \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}%
      \advance\csname c@nprt@#1@digitsbefore\endcsname by 1\relax
    \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}%
      \advance\c@nprt@blockcnt by -1\relax
      \divide\c@nprt@blockcnt 3%
      \setcounter{nprt@digitsfirstblock}{%
        \csname thenprt@#1@digitsbefore\endcsname}%
      \setcounter{nprt@cntprint}{\thenprt@blockcnt}%
      \multiply \c@nprt@cntprint 3%
      \advance\c@nprt@digitsfirstblock by -\thenprt@cntprint\relax
      \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{%
  \def\nprt@tmp{#4}%
  #1#2#3%
  \ifx\nprt@tmp\empty
  \else
    \nprt@separator@before%
    \nprt@printthree#4\@empty\@empty\@empty
  \fi
}
\def\nprt@printtwo#1#2#3\@empty{%
  \def\nprt@tmp{#3}%
  #1#2%
  \ifx\nprt@tmp\empty
  \else
    \nprt@separator@before%
    \nprt@printthree#3\@empty\@empty\@empty
  \fi
}
\def\nprt@printone#1#2\@empty{%
  \def\nprt@tmp{#2}%
  #1%
  \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}%
        \advance\csname c@nprt@#1@digitsafter\endcsname by 1\relax
      \fi
    \fi
    \ifx\nprt@replacenull\@empty
    \else
      \ifnum\csname thenprt@#1@digitsafter\endcsname=0
        \expandafter\edef\csname nprt@#1@after\endcsname{0}%
        \advance\csname c@nprt@#1@digitsafter\endcsname by 1\relax
      \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{%
  \def\nprt@tmp{#4}%
  #1#2#3%
  \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{\tccelsius}%
            \ifx\nprt@oarg\nprt@tmpunit
              \ensuremath{\nprt@celsiussep}%
            \else
              \def\nprt@tmpunit{\celsius}%
              \ifx\nprt@oarg\nprt@tmpunit
                \ensuremath{\nprt@celsiussep}%
              \else
                \def\nprt@tmpunit{\textcelsius}%
                \ifx\nprt@oarg\nprt@tmpunit
                  \ensuremath{\nprt@celsiussep}%
                \else
                  \def\nprt@tmpunit{\%}%
                  \ifx\nprt@oarg\nprt@tmpunit
                    \ensuremath{\nprt@percentsep}%
                  \else
                    \def\nprt@tmpunit{\tcperthousand}%
                    \ifx\nprt@oarg\nprt@tmpunit
                      \ensuremath{\nprt@percentsep}%
                    \else
                      \def\nprt@tmpunit{\perthousand}%
                      \ifx\nprt@oarg\nprt@tmpunit
                        \ensuremath{\nprt@percentsep}%
                      \else
                        \def\nprt@tmpunit{\textperthousand}%
                        \ifx\nprt@oarg\nprt@tmpunit
                          \ensuremath{\nprt@percentsep}%
                        \else
                          \ensuremath{\nprt@unitsep}%
                        \fi
                      \fi
                    \fi
                  \fi
                \fi
              \fi
            \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{}%
  \npcelsiusseparator{\nprt@unitsep}%
  \nppercentseparator{\nprt@unitsep}%
}
    \npstyledefault
\newcommand*\npstylegerman{%
  \npthousandsep{\,}%
  \npdecimalsign{,}%
  \npproductsign{\cdot}%
  \npunitseparator{\,}%
  \npdegreeseparator{}%
  \npcelsiusseparator{\nprt@unitsep}%
  \nppercentseparator{\nprt@unitsep}%
}
\newcommand*\npstyleenglish{%
  \npthousandsep{,}%
  \npdecimalsign{.}%
  \npproductsign{\times}%
  \npunitseparator{\,}%
  \npdegreeseparator{}%
  \npcelsiusseparator{\nprt@unitsep}%
  \nppercentseparator{\nprt@unitsep}%
}
\newcommand*\npstyleportuguese{%
  \npthousandsep{.}%
  \npdecimalsign{,}%
  \npproductsign{\cdot}%
  \npunitseparator{\,}%
  \npdegreeseparator{}%
  \npcelsiusseparator{\nprt@unitsep}%
  \nppercentseparator{\nprt@unitsep}%
}
\newcommand*\npstyledutch{%
  \npthousandsep{\,}%
  \npdecimalsign{,}%
  \npproductsign{\cdot}%
  \npunitseparator{\,}%
  \npdegreeseparator{}%
  \npcelsiusseparator{\nprt@unitsep}%
  \nppercentseparator{}%
}
\newcommand*\npstylefrench{%
  \npthousandsep{~}%
  \npdecimalsign{,}%
  \npproductsign{\cdot}%
  \npunitseparator{\,}%
  \npdegreeseparator{}%
  \npcelsiusseparator{\nprt@unitsep}%
  \nppercentseparator{\nprt@unitsep}%
}
\AtBeginDocument{%
  \ifnprt@autolanguage
    \@ifpackageloaded{babel}{%
      \npaddtolanguage{UKenglish}{english}%
      \npaddtolanguage{USenglish}{english}%
      \npaddtolanguage{afrikaans}{dutch}%
      \npaddtolanguage{american}{english}%
      \npaddtolanguage{austrian}{german}%
      \npaddtolanguage{british}{english}%
      \npaddtolanguage{canadian}{english}%
      \npaddtolanguage{dutch}{dutch}%
      \npaddtolanguage{english}{english}%
      \npaddtolanguage{german}{german}%
      \npaddtolanguage{naustrian}{german}%
      \npaddtolanguage{ngerman}{german}%
      \npaddtolanguage{brazil}{portuguese}%
      \npaddtolanguage{brazilian}{portuguese}%
      \npaddtolanguage{portuges}{portuguese}%
      \npaddtolanguage{portuguese}{portuguese}%
      \npaddtolanguage{francais}{french}%
      \npaddtolanguage{canadien}{french}%
      \npaddtolanguage{acadian}{french}%
      \npaddtolanguage{french}{french}%
      \npaddtolanguage{frenchb}{french}%
      \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'.
