%%
%% This is file `thepdfnumber.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% thepdfnumber.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Project: thepdfnumber
%% Version: 2016/05/16 v1.1
%% 
%% Copyright (C) 2011 by
%%    Heiko Oberdiek <heiko.oberdiek at googlemail.com>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any later
%% version. This version of this license is in
%%    http://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% The Base Interpreter refers to any `TeX-Format',
%% because some files are installed in TDS:tex/generic//.
%% 
%% This work consists of the main source file thepdfnumber.dtx
%% and the derived files
%%    thepdfnumber.sty, thepdfnumber.pdf, thepdfnumber.ins, thepdfnumber.drv,
%%    thepdfnumber-test1.tex, thepdfnumber-test2.tex,
%%    thepdfnumber-test3.tex.
%% 
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode35=6 % #
  \catcode39=12 % '
  \catcode44=12 % ,
  \catcode45=12 % -
  \catcode46=12 % .
  \catcode58=12 % :
  \catcode64=11 % @
  \catcode123=1 % {
  \catcode125=2 % }
  \expandafter\let\expandafter\x\csname ver@thepdfnumber.sty\endcsname
  \ifx\x\relax % plain-TeX, first loading
  \else
    \def\empty{}%
    \ifx\x\empty % LaTeX, first loading,
      % variable is initialized, but \ProvidesPackage not yet seen
    \else
      \expandafter\ifx\csname PackageInfo\endcsname\relax
        \def\x#1#2{%
          \immediate\write-1{Package #1 Info: #2.}%
        }%
      \else
        \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
      \fi
      \x{thepdfnumber}{The package is already loaded}%
      \aftergroup\endinput
    \fi
  \fi
\endgroup%
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode35=6 % #
  \catcode39=12 % '
  \catcode40=12 % (
  \catcode41=12 % )
  \catcode44=12 % ,
  \catcode45=12 % -
  \catcode46=12 % .
  \catcode47=12 % /
  \catcode58=12 % :
  \catcode64=11 % @
  \catcode91=12 % [
  \catcode93=12 % ]
  \catcode123=1 % {
  \catcode125=2 % }
  \expandafter\ifx\csname ProvidesPackage\endcsname\relax
    \def\x#1#2#3[#4]{\endgroup
      \immediate\write-1{Package: #3 #4}%
      \xdef#1{#4}%
    }%
  \else
    \def\x#1#2[#3]{\endgroup
      #2[{#3}]%
      \ifx#1\@undefined
        \xdef#1{#3}%
      \fi
      \ifx#1\relax
        \xdef#1{#3}%
      \fi
    }%
  \fi
\expandafter\x\csname ver@thepdfnumber.sty\endcsname
\ProvidesPackage{thepdfnumber}%
  [2016/05/16 v1.1 Print PDF numbers with minimal digits (HO)]%
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode123=1 % {
  \catcode125=2 % }
  \catcode64=11 % @
  \def\x{\endgroup
    \expandafter\edef\csname ThPdNu@AtEnd\endcsname{%
      \endlinechar=\the\endlinechar\relax
      \catcode13=\the\catcode13\relax
      \catcode32=\the\catcode32\relax
      \catcode35=\the\catcode35\relax
      \catcode61=\the\catcode61\relax
      \catcode64=\the\catcode64\relax
      \catcode123=\the\catcode123\relax
      \catcode125=\the\catcode125\relax
    }%
  }%
\x\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
\catcode35=6 % #
\catcode64=11 % @
\catcode123=1 % {
\catcode125=2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\ThPdNu@AtEnd{%
    \ThPdNu@AtEnd
    \catcode#1=\the\catcode#1\relax
  }%
  \catcode#1=#2\relax
}
\TMP@EnsureCode{33}{12}% !
\TMP@EnsureCode{36}{3}% $
\TMP@EnsureCode{38}{4}% &
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{43}{12}% +
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{60}{12}% <
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{96}{12}% `
\edef\ThPdNu@AtEnd{\ThPdNu@AtEnd\noexpand\endinput}
\def\ThPdNu@FIN{\thepdfnumber@ErrorEndMarker}
\def\ThPdNu@space{ }
\chardef\ThPdNu@zero=0 %
\chardef\ThPdNu@one=1 %
\long\def\ThPdNu@firstoftwo#1#2{#1}
\long\def\ThPdNu@secondoftwo#1#2{#2}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname detokenize\endcsname\relax
  \catcode`\&=14 %
  \catcode`\$=9 %
\else
  \catcode`\&=9 %
  \catcode`\$=14 %
\fi
\def\thepdfnumber#1{%
  \romannumeral
& \iftrue\expandafter\ThPdNu@State@Plus\expandafter\fi
& \detokenize\expandafter{#1}%
& \ThPdNu@FIN
$ \ifx\ThPdNu@FIN#1\ThPdNu@FIN
$   \expandafter\ThPdNu@firstoftwo
$ \else
$   \expandafter\ThPdNu@secondoftwo
$ \fi
$ {%
$   \ThPdNu@zero
$   0\thepdfnumber@ErrorUnexpectedEnd
$ }{%
$   \iftrue\expandafter\ThPdNu@State@Plus\expandafter\fi#1\ThPdNu@FIN
$ }%
}
\def\ThPdNu@State@Plus#1\fi#2{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#2%
           0%
&        \else\ifx-#2%
$        \else\ifnum`#2=45 % -
           1%
         \else\ifx0#2%
           2%
         \else\ifnum`#2>48 %
           \ifnum`#2<58 %
             3%
           \else
             9%
           \fi
&        \else\ifx.#2%
$        \else\ifnum`#2=46 % .
           4%
&        \else\ifx+#2%
$        \else\ifnum`#2=43 % +
           5%
         \else
           9%
         \fi\fi\fi\fi\fi\fi\ThPdNu@space
    \expandafter\ThPdNu@zero
    \expandafter0%
    \expandafter\thepdfnumber@ErrorUnexpectedEnd
  \or
    \ThPdNu@State@Minus
  \or
    \ThPdNu@State@SkipZeros!%
  \or
    \ThPdNu@State@Int!#2!%
  \or
    \ThPdNu@State@Dot!\ThPdNu@zero*\ThPdNu@zero!!%
  \or
    \ThPdNu@State@Plus
  \else
    \ThPdNu@ReturnError{0}%
  \fi
}
\def\ThPdNu@State@Minus#1\fi#2{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#2%
           0%
         \else\ifx0#2%
           1%
         \else\ifnum`#2>48 %
           \ifnum`#2<58 %
             2%
           \else
             9%
           \fi
&        \else\ifx.#2%
$        \else\ifnum`#2=46 % .
           3%
&        \else\ifx-#2%
$        \else\ifnum`#2=45 % -
           4%
&        \else\ifx+#2%
$        \else\ifnum`#2=43 % +
           5%
         \else
           9%
         \fi\fi\fi\fi\fi\fi\ThPdNu@space
    \expandafter\ThPdNu@zero
    \expandafter0%
    \expandafter\thepdfnumber@ErrorUnexpectedEnd
  \or
    \ThPdNu@State@SkipZeros-!%
  \or
    \ThPdNu@State@Int-!#2!%
  \or
    \ThPdNu@State@Dot-!\ThPdNu@zero*\ThPdNu@zero!!%
  \or
    \ThPdNu@State@Plus
  \or
    \ThPdNu@State@Minus
  \else
    \ThPdNu@ReturnError{0}%
  \fi
}
\def\ThPdNu@ReturnError#1#2\fi#3\ThPdNu@FIN{%
  \fi
  \ThPdNu@zero
  #1%
  \thepdfnumber@ErrorInvalidToken
}
\def\ThPdNu@State@SkipZeros#1!#2\fi#3{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#3%
           0%
         \else\ifx0#3%
           1%
         \else\ifnum`#3>48 %
           \ifnum`#3<58 %
             2%
           \else
             9%
           \fi
&        \else\ifx.#3%
$        \else\ifnum`#3=46 % .
           3%
         \else
           9%
         \fi\fi\fi\fi\ThPdNu@space
    \expandafter\ThPdNu@zero
    \expandafter0%
  \or
   \ThPdNu@State@SkipZeros#1!%
  \or
    \ThPdNu@State@Int#1!#3!%
  \or
    \ThPdNu@State@Dot#1!\ThPdNu@zero*\ThPdNu@zero!!%
  \else
    \ThPdNu@ReturnError{0}%
  \fi
}
\def\ThPdNu@State@Int#1!#2!#3\fi#4{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#4%
           0%
         \else\ifnum`#4>47 %
           \ifnum`#4<58 %
             1%
           \else
             9%
           \fi
&        \else\ifx.#4%
$        \else\ifnum`#4=46 % .
           2%
         \else
           9%
         \fi\fi\fi\ThPdNu@space
    \ThPdNu@ReturnInt{#1#2}%
  \or
    \ThPdNu@State@Int#1!#2#4!%
  \or
    \ThPdNu@State@Dot#1!\ThPdNu@one#2*\ThPdNu@zero!!%
  \else
    \ThPdNu@ReturnError{#1#2}%
  \fi
}
\def\ThPdNu@ReturnInt#1#2\fi{%
  \fi
  \ThPdNu@zero
  #1%
}
\def\ThPdNu@State@Dot#1*#2#3!#4!#5\fi#6{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#6%
           0%
         \else\ifnum`#6>48 %
           \ifnum`#6<58 %
             1%
           \else
             9%
           \fi
         \else\ifx0#6%
           2%
         \else
           9%
         \fi\fi\fi\ThPdNu@space
    \ThPdNu@ReturnNumber#1*#2#3!%
  \or
    \ThPdNu@State@Dot#1*\ThPdNu@one#3#4#6!!%
  \or
    \ThPdNu@State@DotZero#1*#2#3!#4#6!%
  \else
    \ThPdNu@ReturnNumberInvalid#1*#2#3!%
  \fi
}
\def\ThPdNu@State@DotZero#1*#2#3!#4!#5\fi#6{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#6%
           0%
         \else\ifnum`#6>48 %
           \ifnum`#6<58 %
             1%
           \else
             9%
           \fi
         \else\ifx0#6%
           2%
         \else
           9%
         \fi\fi\fi\ThPdNu@space
    \ThPdNu@ReturnNumber#1*#2#3!%
  \or
    \ThPdNu@State@Dot#1*\ThPdNu@one#3#4#6!!%
  \or
    \ThPdNu@State@DotZero#1*#2#3!#4#6!%
  \else
    \ThPdNu@ReturnNumber#1*#2#3!%
  \fi
}
\def\ThPdNu@ReturnNumber#1!#2#3*#4#5!#6\fi{%
  \fi
  \ifcase#2%
    \expandafter\ThPdNu@firstoftwo
  \else
    \expandafter\ThPdNu@secondoftwo
  \fi
  {%
    \ifcase#4%
      \expandafter\ThPdNu@firstoftwo
    \else
      \expandafter\ThPdNu@secondoftwo
    \fi
    {\ThPdNu@zero 0}%
    {\ThPdNu@zero #1.#5}%
  }{%
    \ifcase#4%
      \expandafter\ThPdNu@firstoftwo
    \else
      \expandafter\ThPdNu@secondoftwo
    \fi
    {\ThPdNu@zero #1#3}%
    {\ThPdNu@zero #1#3.#5}%
  }%
}
\def\ThPdNu@ReturnNumberInvalid#1*#2!#3\fi#4\ThPdNu@FIN{%
  \fi
  \iftrue\ThPdNu@ReturnNumber#1*#2!\fi
  \thepdfnumber@ErrorInvalidToken
}
\def\thepdfnumberNormZeroOne#1{%
  \romannumeral
& \iftrue\expandafter\ThPbNu@StateN@Plus\expandafter\fi
& \detokenize\expandafter{#1}%
& \ThPdNu@FIN
$ \ifx\ThPdNu@FIN#1\ThPdNu@FIN
$   \expandafter\ThPdNu@firstoftwo
$ \else
$   \expandafter\ThPdNu@secondoftwo
$ \fi
$ {%
$   \ThPdNu@zero
$   0\thepdfnumber@ErrorUnexpectedEnd
$ }{%
$   \iftrue\expandafter\ThPbNu@StateN@Plus\expandafter\fi#1\ThPdNu@FIN
$ }%
}
\def\ThPbNu@StateN@Plus#1\fi#2{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#2%
           0%
&        \else\ifx-#2%
$        \else\ifnum`#2=45 % -
           1%
         \else\ifx0#2%
           2%
         \else\ifnum`#2>48 %
           \ifnum`#2<58 %
             3%
           \else
             9%
           \fi
&        \else\ifx.#2%
$        \else\ifnum`#2=46 % .
           4%
&        \else\ifx+#2%
$        \else\ifnum`#2=43 % +
           5%
         \else
           9%
         \fi\fi\fi\fi\fi\fi\ThPdNu@space
    \expandafter\ThPdNu@zero
    \expandafter0%
    \expandafter\thepdfnumber@ErrorUnexpectedEnd
  \or
    \ThPbNu@StateN@Minus
  \or
    \ThPbNu@StateN@SkipZeros
  \or
    \ThPdNu@ReturnAndSkip{1}%
  \or
    \ThPbNu@StateN@Dot\ThPdNu@zero!!%
  \or
    \ThPbNu@StateN@Plus
  \else
    \ThPdNu@ReturnError{0}%
  \fi
}
\def\ThPbNu@StateN@Minus#1\fi#2{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#2%
           0%
         \else\ifnum`#2>47 %
           \ifnum`#2<58 %
             1%
           \else
             9%
           \fi
&        \else\ifx.#2%
$        \else\ifnum`#2=46 % .
           1%
&        \else\ifx-#2%
$        \else\ifnum`#2=45 % -
           2%
&        \else\ifx+#2%
$        \else\ifnum`#2=43 % +
           3%
         \else
           9%
         \fi\fi\fi\fi\fi\ThPdNu@space
    \expandafter\ThPdNu@zero
    \expandafter0%
    \expandafter\thepdfnumber@ErrorUnexpectedEnd
  \or
    \ThPdNu@ReturnAndSkip{0}%
  \or
    \ThPbNu@StateN@Plus
  \or
    \ThPbNu@StateN@Minus
  \else
    \ThPdNu@ReturnError{0}%
  \fi
}
\def\ThPdNu@ReturnAndSkip#1#2\fi#3\ThPdNu@FIN{%
  \fi
  \ThPdNu@zero
  #1%
}
\def\ThPbNu@StateN@SkipZeros#1\fi#2{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#2%
           0%
         \else\ifx0#2%
           1%
         \else\ifnum`#2>48 %
           \ifnum`#2<58 %
             2%
           \else
             9%
           \fi
&        \else\ifx.#2%
$        \else\ifnum`#2=46 % .
           3%
         \else
           9%
         \fi\fi\fi\fi\ThPdNu@space
    \expandafter\ThPdNu@zero
    \expandafter0%
  \or
   \ThPbNu@StateN@SkipZeros%
  \or
    \ThPdNu@ReturnAndSkip{1}%
  \or
    \ThPbNu@StateN@Dot\ThPdNu@zero!!%
  \else
    \ThPdNu@ReturnError{0}%
  \fi
}
\def\ThPbNu@StateN@Dot#1#2!#3!#4\fi#5{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#5%
           0%
         \else\ifnum`#5>48 %
           \ifnum`#5<58 %
             1%
           \else
             9%
           \fi
         \else\ifx0#5%
           2%
         \else
           9%
         \fi\fi\fi\ThPdNu@space
    \ThPdNu@ReturnFracNumber#1#2!%
  \or
    \ThPbNu@StateN@Dot\ThPdNu@one#2#3#5!!%
  \or
    \ThPbNu@StateN@DotZero#1#2!#3#5!%
  \else
    \ThPdNu@ReturnFracNumberInvalid#1#2!%
  \fi
}
\def\ThPbNu@StateN@DotZero#1#2!#3!#4\fi#5{%
  \fi
  \ifcase\ifx\ThPdNu@FIN#5%
           0%
         \else\ifnum`#5>48 %
           \ifnum`#5<58 %
             1%
           \else
             9%
           \fi
         \else\ifx0#5%
           2%
         \else
           9%
         \fi\fi\fi\ThPdNu@space
    \ThPdNu@ReturnFracNumber#1#2!%
  \or
    \ThPbNu@StateN@Dot\ThPdNu@one#2#3#5!!%
  \or
    \ThPbNu@StateN@DotZero#1#2!#3#5!%
  \else
    \ThPdNu@ReturnFracNumberInvalid#1#2!%
  \fi
}
\def\ThPdNu@ReturnFracNumber#1#2!#3\fi{%
  \fi
  \ifcase#1%
    \expandafter\ThPdNu@firstoftwo
  \else
    \expandafter\ThPdNu@secondoftwo
  \fi
  {\ThPdNu@zero 0}%
  {\ThPdNu@zero .#2}%
}
\def\ThPdNu@ReturnFracNumberInvalid#1!#2\fi#3\ThPdNu@FIN{%
  \fi
  \iftrue\ThPdNu@ReturnFracNumber#1!\fi
  \thepdfnumber@ErrorInvalidToken
}
\ThPdNu@AtEnd%
\endinput
%%
%% End of file `thepdfnumber.sty'.
