| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: thepdfnumber.dtx |
| 4 |
% Version: 2016/05/16 v1.1 |
| 5 |
% Info: Print PDF numbers with minimal digits |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 2011 Heiko Oberdiek |
| 9 |
% 2016-2019 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/oberdiek/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/oberdiek/issues |
| 27 |
% |
| 28 |
% The Base Interpreter refers to any `TeX-Format', |
| 29 |
% because some files are installed in TDS:tex/generic//. |
| 30 |
% |
| 31 |
% This work consists of the main source file thepdfnumber.dtx |
| 32 |
% and the derived files |
| 33 |
% thepdfnumber.sty, thepdfnumber.pdf, thepdfnumber.ins, thepdfnumber.drv, |
| 34 |
% thepdfnumber-test1.tex, thepdfnumber-test2.tex, |
| 35 |
% thepdfnumber-test3.tex. |
| 36 |
% |
| 37 |
% Distribution: |
| 38 |
% CTAN:macros/latex/contrib/oberdiek/thepdfnumber.dtx |
| 39 |
% CTAN:macros/latex/contrib/oberdiek/thepdfnumber.pdf |
| 40 |
% |
| 41 |
% Unpacking: |
| 42 |
% (a) If thepdfnumber.ins is present: |
| 43 |
% tex thepdfnumber.ins |
| 44 |
% (b) Without thepdfnumber.ins: |
| 45 |
% tex thepdfnumber.dtx |
| 46 |
% (c) If you insist on using LaTeX |
| 47 |
% latex \let\install=y\input{thepdfnumber.dtx} |
| 48 |
% (quote the arguments according to the demands of your shell) |
| 49 |
% |
| 50 |
% Documentation: |
| 51 |
% (a) If thepdfnumber.drv is present: |
| 52 |
% latex thepdfnumber.drv |
| 53 |
% (b) Without thepdfnumber.drv: |
| 54 |
% latex thepdfnumber.dtx; ... |
| 55 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 56 |
% if available. Here you can specify further options, e.g. |
| 57 |
% use A4 as paper format: |
| 58 |
% \PassOptionsToClass{a4paper}{article} |
| 59 |
% |
| 60 |
% Program calls to get the documentation (example): |
| 61 |
% pdflatex thepdfnumber.dtx |
| 62 |
% makeindex -s gind.ist thepdfnumber.idx |
| 63 |
% pdflatex thepdfnumber.dtx |
| 64 |
% makeindex -s gind.ist thepdfnumber.idx |
| 65 |
% pdflatex thepdfnumber.dtx |
| 66 |
% |
| 67 |
% Installation: |
| 68 |
% TDS:tex/generic/oberdiek/thepdfnumber.sty |
| 69 |
% TDS:doc/latex/oberdiek/thepdfnumber.pdf |
| 70 |
% TDS:source/latex/oberdiek/thepdfnumber.dtx |
| 71 |
% |
| 72 |
%<*ignore> |
| 73 |
\begingroup |
| 74 |
\catcode123=1 % |
| 75 |
\catcode125=2 % |
| 76 |
\def\x{LaTeX2e}% |
| 77 |
\expandafter\endgroup |
| 78 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 79 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 80 |
\ifx\fmtname\x\else 1\fi\relax |
| 81 |
\else\csname fi\endcsname |
| 82 |
%</ignore> |
| 83 |
%<*install> |
| 84 |
\input docstrip.tex |
| 85 |
\Msg{************************************************************************} |
| 86 |
\Msg{* Installation} |
| 87 |
\Msg{* Package: thepdfnumber 2016/05/16 v1.1 Print PDF numbers with minimal digits (HO)} |
| 88 |
\Msg{************************************************************************} |
| 89 |
|
| 90 |
\keepsilent |
| 91 |
\askforoverwritefalse |
| 92 |
|
| 93 |
\let\MetaPrefix\relax |
| 94 |
\preamble |
| 95 |
|
| 96 |
This is a generated file. |
| 97 |
|
| 98 |
Project: thepdfnumber |
| 99 |
Version: 2016/05/16 v1.1 |
| 100 |
|
| 101 |
Copyright (C) |
| 102 |
2011 Heiko Oberdiek |
| 103 |
2016-2019 Oberdiek Package Support Group |
| 104 |
|
| 105 |
This work may be distributed and/or modified under the |
| 106 |
conditions of the LaTeX Project Public License, either |
| 107 |
version 1.3c of this license or (at your option) any later |
| 108 |
version. This version of this license is in |
| 109 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 110 |
and the latest version of this license is in |
| 111 |
https://www.latex-project.org/lppl.txt |
| 112 |
and version 1.3 or later is part of all distributions of |
| 113 |
LaTeX version 2005/12/01 or later. |
| 114 |
|
| 115 |
This work has the LPPL maintenance status "maintained". |
| 116 |
|
| 117 |
The Current Maintainers of this work are |
| 118 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 119 |
https://github.com/ho-tex/oberdiek/issues |
| 120 |
|
| 121 |
|
| 122 |
The Base Interpreter refers to any `TeX-Format', |
| 123 |
because some files are installed in TDS:tex/generic//. |
| 124 |
|
| 125 |
This work consists of the main source file thepdfnumber.dtx |
| 126 |
and the derived files |
| 127 |
thepdfnumber.sty, thepdfnumber.pdf, thepdfnumber.ins, thepdfnumber.drv, |
| 128 |
thepdfnumber-test1.tex, thepdfnumber-test2.tex, |
| 129 |
thepdfnumber-test3.tex. |
| 130 |
|
| 131 |
\endpreamble |
| 132 |
\let\MetaPrefix\DoubleperCent |
| 133 |
|
| 134 |
\generate{% |
| 135 |
\file{thepdfnumber.ins}{\from{thepdfnumber.dtx}{install}}% |
| 136 |
\file{thepdfnumber.drv}{\from{thepdfnumber.dtx}{driver}}% |
| 137 |
\usedir{tex/generic/oberdiek}% |
| 138 |
\file{thepdfnumber.sty}{\from{thepdfnumber.dtx}{package}}% |
| 139 |
% \usedir{doc/latex/oberdiek/test}% |
| 140 |
% \file{thepdfnumber-test1.tex}{\from{thepdfnumber.dtx}{test1}}% |
| 141 |
% \file{thepdfnumber-test2.tex}{\from{thepdfnumber.dtx}{test2}}% |
| 142 |
% \file{thepdfnumber-test3.tex}{\from{thepdfnumber.dtx}{test2,active}}% |
| 143 |
} |
| 144 |
|
| 145 |
\catcode32=13\relax% active space |
| 146 |
\let =\space% |
| 147 |
\Msg{************************************************************************} |
| 148 |
\Msg{*} |
| 149 |
\Msg{* To finish the installation you have to move the following} |
| 150 |
\Msg{* file into a directory searched by TeX:} |
| 151 |
\Msg{*} |
| 152 |
\Msg{* thepdfnumber.sty} |
| 153 |
\Msg{*} |
| 154 |
\Msg{* To produce the documentation run the file `thepdfnumber.drv'} |
| 155 |
\Msg{* through LaTeX.} |
| 156 |
\Msg{*} |
| 157 |
\Msg{* Happy TeXing!} |
| 158 |
\Msg{*} |
| 159 |
\Msg{************************************************************************} |
| 160 |
|
| 161 |
\endbatchfile |
| 162 |
%</install> |
| 163 |
%<*ignore> |
| 164 |
\fi |
| 165 |
%</ignore> |
| 166 |
%<*driver> |
| 167 |
\NeedsTeXFormat{LaTeX2e} |
| 168 |
\ProvidesFile{thepdfnumber.drv}% |
| 169 |
[2016/05/16 v1.1 Print PDF numbers with minimal digits (HO)]% |
| 170 |
\documentclass{ltxdoc} |
| 171 |
\usepackage{holtxdoc}[2011/11/22] |
| 172 |
\usepackage{csquotes} |
| 173 |
\usepackage[ |
| 174 |
backend=bibtex, |
| 175 |
bibencoding=ascii, |
| 176 |
alldates=iso,seconds=true, |
| 177 |
]{biblatex}[2011/11/13] |
| 178 |
\bibliography{oberdiek-source} |
| 179 |
\begin{document} |
| 180 |
\DocInput{thepdfnumber.dtx}% |
| 181 |
\end{document} |
| 182 |
%</driver> |
| 183 |
% \fi |
| 184 |
% |
| 185 |
% |
| 186 |
% |
| 187 |
% \GetFileInfo{thepdfnumber.drv} |
| 188 |
% |
| 189 |
% \title{The \xpackage{thepdfnumber} package} |
| 190 |
% \date{2016/05/16 v1.1} |
| 191 |
% \author{Heiko Oberdiek\thanks |
| 192 |
% {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}} |
| 193 |
% |
| 194 |
% \maketitle |
| 195 |
% |
| 196 |
% \begin{abstract} |
| 197 |
% The package converts real numbers to a minimal representation |
| 198 |
% that is stripped from leading or trailing zeros, |
| 199 |
% plus signs and decimal point if not necessary. |
| 200 |
% \end{abstract} |
| 201 |
% |
| 202 |
% \tableofcontents |
| 203 |
% |
| 204 |
% \section{Documentation} |
| 205 |
% |
| 206 |
% \subsection{Introduction} |
| 207 |
% |
| 208 |
% Dealing with the PDF format, there is sometimes the need to write |
| 209 |
% some low level PDF stuff. In case of numbers, the numbers can |
| 210 |
% arise from user input (e.g. color or transparency specifications) |
| 211 |
% or can be calculated. For example, \hologo{LaTeX}'s \cs{strip@pt} |
| 212 |
% makes a good job to output a real number. It automatically suppresses |
| 213 |
% the decimal part if the number is an integer. However it leaves |
| 214 |
% a leading zero for numbers greater zero and smaller one. |
| 215 |
% Thus the package provides macros that can be used with different |
| 216 |
% formats, even with \hologo{iniTeX} and generates numbers that |
| 217 |
% are valid numbers of the PDF format and whose length is minimal. |
| 218 |
% |
| 219 |
% \subsection{Usage} |
| 220 |
% |
| 221 |
% The package \xpackage{thepdfnumber} can be used with \hologo{LaTeX}, |
| 222 |
% \hologo{plainTeX} or even with \hologo{iniTeX}: |
| 223 |
% \begin{quote} |
| 224 |
% |\RequirePackage{thepdfnumber}| \textit{\% \hologo{LaTeX}}\\ |
| 225 |
% |\input thepdfnumber.sty| \textit{\% \hologo{plainTeX}/\hologo{iniTeX}} |
| 226 |
% \end{quote} |
| 227 |
% The package does not need and have package options. |
| 228 |
% |
| 229 |
% \subsection{User macros} |
| 230 |
% |
| 231 |
% All user macros are expandable in exact two expansion steps. |
| 232 |
% |
| 233 |
% \begin{declcs}{thepdfnumber} \M{number} |
| 234 |
% \end{declcs} |
| 235 |
% Macro \cs{thepdfnumber} takes a number |
| 236 |
% as argument and expands to a minimal representation of that number. |
| 237 |
% Some examples: |
| 238 |
% \begin{quote} |
| 239 |
% \begin{tabular}{r@{.: }>{\ttfamily}l@{ $\rightarrow$\ }>{\ttfamily}l@{}} |
| 240 |
% 1& +123 & 123\\ |
| 241 |
% 2& --123 & 123\\ |
| 242 |
% 3& -01 & -1\\ |
| 243 |
% 4& 0045 & 45\\ |
| 244 |
% 5& 1.0 & 1\\ |
| 245 |
% 6& 1.20 & 1.2\\ |
| 246 |
% 7& 0.0 & 0\\ |
| 247 |
% 8& 0.78 & .78\\ |
| 248 |
% 9& +012.340 & 12.34\\ |
| 249 |
% \end{tabular} |
| 250 |
% \end{quote} |
| 251 |
% It reduces the length of the number representation: |
| 252 |
% \begin{itemize} |
| 253 |
% \item The signs are collapsed and only one minus sign |
| 254 |
% is output if the number is negative (see examples 1, 2, 3, 9). |
| 255 |
% \item Leading zeros are removed (4, 8, 9) unless the number is zero (7). |
| 256 |
% \item The decimal part is omitted, if the number is an integer (5, 7). |
| 257 |
% \item Trailing zeros from the decimal part are stripped (5, 6, 7, 9). |
| 258 |
% \end{itemize} |
| 259 |
% The resulting number representation can be caught with one of the |
| 260 |
% following Perl regular expressions: |
| 261 |
% \begin{itemize} |
| 262 |
% \item |^0$| (zero) |
| 263 |
% \item |^-?[1-9][0-9]*$| (integer) |
| 264 |
% \item |^-?[0-9]*\.[0-9]*[1-9]$| (real) |
| 265 |
% \end{itemize} |
| 266 |
% This is a valid numeric object of the PDF specification \cite[``7.3.3~Numeric Objects'']{pdfspec-iso32000-1}. |
| 267 |
% |
| 268 |
% \begin{declcs}{thepdfnumberNormZeroOne} |
| 269 |
% \end{declcs} |
| 270 |
% There are various places in the PDF specification where the |
| 271 |
% number is in the domain 0.0 upto 1.0. Macro thepdfnumberNormZeroOne |
| 272 |
% automatically adjusts the number to fit into that range. Negative |
| 273 |
% numbers are mapped to |0| and numbers greater than one are |
| 274 |
% replaced by |1|. Thus the result fits one of the following regular |
| 275 |
% expressions: |
| 276 |
% \begin{itemize} |
| 277 |
% \item |^0$| |
| 278 |
% \item |^\.[0-9]*[1-9]$| |
| 279 |
% \item |^1$| |
| 280 |
% \end{itemize} |
| 281 |
% Examples: |
| 282 |
% \begin{quote} |
| 283 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$\ }>{\ttfamily}l@{}} |
| 284 |
% -456 & 0\\ |
| 285 |
% -0.001 & 0\\ |
| 286 |
% 0.0 & 0\\ |
| 287 |
% 0.010 & .01\\ |
| 288 |
% 0.456 & .456\\ |
| 289 |
% 1.0 & 1\\ |
| 290 |
% 01.001 & 1\\ |
| 291 |
% 4 & 1\\ |
| 292 |
% \end{tabular} |
| 293 |
% \end{quote} |
| 294 |
% |
| 295 |
% \subsection{Input number} |
| 296 |
% |
| 297 |
% The user macros expect a number as argument. The number can either |
| 298 |
% be given explicitly or as macro that expands in one step |
| 299 |
% to an explicit number, because the first token of the argument |
| 300 |
% is expanded once. |
| 301 |
% |
| 302 |
% The explicit number consists of |
| 303 |
% \begin{itemize} |
| 304 |
% \item optional signs `\texttt{+}' and `\texttt{-}', |
| 305 |
% \item digits `\texttt{0}' upto `\texttt{9}' and |
| 306 |
% \item an optional dot `\texttt{.}'. |
| 307 |
% \end{itemize} |
| 308 |
% All tokens must have catcode 12 (other), the default catcodes |
| 309 |
% for these characters in \hologo{LaTeX}, \hologo{plainTeX} or |
| 310 |
% \hologo{iniTeX}. As Perl regular expression the number is expected |
| 311 |
% in one of the following forms: |
| 312 |
% \begin{itemize} |
| 313 |
% \item |^[+-]*[0-9]+$| |
| 314 |
% \item |^[+-]*[0-9]*\.[0-9]*$| |
| 315 |
% \end{itemize} |
| 316 |
% At least one digit or the dot must be present. |
| 317 |
% |
| 318 |
% \subsection{Error handling} |
| 319 |
% |
| 320 |
% The package is not intended for validating numbers or to |
| 321 |
% decide if an argument is a number. Therefore it is an usage |
| 322 |
% error to use the user macros with arguments that are not |
| 323 |
% explicit numbers as specified in the previous sections. |
| 324 |
% Nevertheless some error conditions are sometimes recognized. |
| 325 |
% Errors are given in form of an undefined command sequence. |
| 326 |
% It is the only way to notify \hologo{TeX} in expandable context. |
| 327 |
% Expanding to some error text would invalidate the output. |
| 328 |
% Currently the following errors are thrown: |
| 329 |
% \begin{description} |
| 330 |
% \item[\cs{thepdfnumber@ErrorEndMarker}:] |
| 331 |
% Internally the argument parsing uses an end marker that |
| 332 |
% is never called directly. If it is called with valid |
| 333 |
% user input, then this is a bug. Otherwise it means the user input |
| 334 |
% contains nasty stuff. |
| 335 |
% \item[\cs{thepdfnumber@ErrorUnexpectedEnd}:] The macros expect at least one digit |
| 336 |
% or the dot, otherwise if the argument is empty or only contains |
| 337 |
% signs, then this error is called. |
| 338 |
% \item[\cs{thepdfnumber@ErrorInvalidToken}:] It is called if the number |
| 339 |
% contains other tokens than signs, digits or the dot or the |
| 340 |
% token at the wrong place (e.g. a sign after a digit). |
| 341 |
% In case of \cs{thepdfnumberNormZeroOne} this error condition might |
| 342 |
% not always be detected, because the number parsing might stop |
| 343 |
% at an early point, when the result is already clear (e.g. |
| 344 |
% if the number is negative or will be greater than one). |
| 345 |
% \item[Improper alphabetic constant:] This error might be |
| 346 |
% thrown by \hologo{TeX}, if the number contains |
| 347 |
% command tokens instead of characters. |
| 348 |
% \end{description} |
| 349 |
% |
| 350 |
% \StopEventually{ |
| 351 |
% } |
| 352 |
% |
| 353 |
% \section{Implementation} |
| 354 |
% |
| 355 |
% \begin{macrocode} |
| 356 |
%<*package> |
| 357 |
% \end{macrocode} |
| 358 |
% |
| 359 |
% \subsection{Reload check and package identification} |
| 360 |
% Reload check, especially if the package is not used with \LaTeX. |
| 361 |
% \begin{macrocode} |
| 362 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 363 |
\catcode13=5 % ^^M |
| 364 |
\endlinechar=13 % |
| 365 |
\catcode35=6 % # |
| 366 |
\catcode39=12 % ' |
| 367 |
\catcode44=12 % , |
| 368 |
\catcode45=12 % - |
| 369 |
\catcode46=12 % . |
| 370 |
\catcode58=12 % : |
| 371 |
\catcode64=11 % @ |
| 372 |
\catcode123=1 % { |
| 373 |
\catcode125=2 % } |
| 374 |
\expandafter\let\expandafter\x\csname [email protected]\endcsname |
| 375 |
\ifx\x\relax % plain-TeX, first loading |
| 376 |
\else |
| 377 |
\def\empty{}% |
| 378 |
\ifx\x\empty % LaTeX, first loading, |
| 379 |
% variable is initialized, but \ProvidesPackage not yet seen |
| 380 |
\else |
| 381 |
\expandafter\ifx\csname PackageInfo\endcsname\relax |
| 382 |
\def\x#1#2{% |
| 383 |
\immediate\write-1{Package #1 Info: #2.}% |
| 384 |
}% |
| 385 |
\else |
| 386 |
\def\x#1#2{\PackageInfo{#1}{#2, stopped}}% |
| 387 |
\fi |
| 388 |
\x{thepdfnumber}{The package is already loaded}% |
| 389 |
\aftergroup\endinput |
| 390 |
\fi |
| 391 |
\fi |
| 392 |
\endgroup% |
| 393 |
% \end{macrocode} |
| 394 |
% Package identification: |
| 395 |
% \begin{macrocode} |
| 396 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 397 |
\catcode13=5 % ^^M |
| 398 |
\endlinechar=13 % |
| 399 |
\catcode35=6 % # |
| 400 |
\catcode39=12 % ' |
| 401 |
\catcode40=12 % ( |
| 402 |
\catcode41=12 % ) |
| 403 |
\catcode44=12 % , |
| 404 |
\catcode45=12 % - |
| 405 |
\catcode46=12 % . |
| 406 |
\catcode47=12 % / |
| 407 |
\catcode58=12 % : |
| 408 |
\catcode64=11 % @ |
| 409 |
\catcode91=12 % [ |
| 410 |
\catcode93=12 % ] |
| 411 |
\catcode123=1 % { |
| 412 |
\catcode125=2 % } |
| 413 |
\expandafter\ifx\csname ProvidesPackage\endcsname\relax |
| 414 |
\def\x#1#2#3[#4]{\endgroup |
| 415 |
\immediate\write-1{Package: #3 #4}% |
| 416 |
\xdef#1{#4}% |
| 417 |
}% |
| 418 |
\else |
| 419 |
\def\x#1#2[#3]{\endgroup |
| 420 |
#2[{#3}]% |
| 421 |
\ifx#1\@undefined |
| 422 |
\xdef#1{#3}% |
| 423 |
\fi |
| 424 |
\ifx#1\relax |
| 425 |
\xdef#1{#3}% |
| 426 |
\fi |
| 427 |
}% |
| 428 |
\fi |
| 429 |
\expandafter\x\csname [email protected]\endcsname |
| 430 |
\ProvidesPackage{thepdfnumber}% |
| 431 |
[2016/05/16 v1.1 Print PDF numbers with minimal digits (HO)]% |
| 432 |
% \end{macrocode} |
| 433 |
% |
| 434 |
% \subsection{Catcodes} |
| 435 |
% |
| 436 |
% \begin{macrocode} |
| 437 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 438 |
\catcode13=5 % ^^M |
| 439 |
\endlinechar=13 % |
| 440 |
\catcode123=1 % { |
| 441 |
\catcode125=2 % } |
| 442 |
\catcode64=11 % @ |
| 443 |
\def\x{\endgroup |
| 444 |
\expandafter\edef\csname ThPdNu@AtEnd\endcsname{% |
| 445 |
\endlinechar=\the\endlinechar\relax |
| 446 |
\catcode13=\the\catcode13\relax |
| 447 |
\catcode32=\the\catcode32\relax |
| 448 |
\catcode35=\the\catcode35\relax |
| 449 |
\catcode61=\the\catcode61\relax |
| 450 |
\catcode64=\the\catcode64\relax |
| 451 |
\catcode123=\the\catcode123\relax |
| 452 |
\catcode125=\the\catcode125\relax |
| 453 |
}% |
| 454 |
}% |
| 455 |
\x\catcode61\catcode48\catcode32=10\relax% |
| 456 |
\catcode13=5 % ^^M |
| 457 |
\endlinechar=13 % |
| 458 |
\catcode35=6 % # |
| 459 |
\catcode64=11 % @ |
| 460 |
\catcode123=1 % { |
| 461 |
\catcode125=2 % } |
| 462 |
\def\TMP@EnsureCode#1#2{% |
| 463 |
\edef\ThPdNu@AtEnd{% |
| 464 |
\ThPdNu@AtEnd |
| 465 |
\catcode#1=\the\catcode#1\relax |
| 466 |
}% |
| 467 |
\catcode#1=#2\relax |
| 468 |
} |
| 469 |
\TMP@EnsureCode{33}{12}% ! |
| 470 |
\TMP@EnsureCode{36}{3}% $ |
| 471 |
\TMP@EnsureCode{38}{4}% & |
| 472 |
\TMP@EnsureCode{42}{12}% * |
| 473 |
\TMP@EnsureCode{43}{12}% + |
| 474 |
\TMP@EnsureCode{45}{12}% - |
| 475 |
\TMP@EnsureCode{46}{12}% . |
| 476 |
\TMP@EnsureCode{60}{12}% < |
| 477 |
\TMP@EnsureCode{62}{12}% > |
| 478 |
\TMP@EnsureCode{96}{12}% ` |
| 479 |
\edef\ThPdNu@AtEnd{\ThPdNu@AtEnd\noexpand\endinput} |
| 480 |
% \end{macrocode} |
| 481 |
% |
| 482 |
% \subsection{Helper macros} |
| 483 |
% |
| 484 |
% \begin{macro}{\ThPdNu@FIN} |
| 485 |
% \begin{macrocode} |
| 486 |
\def\ThPdNu@FIN{\thepdfnumber@ErrorEndMarker} |
| 487 |
% \end{macrocode} |
| 488 |
% \end{macro} |
| 489 |
% |
| 490 |
% \begin{macro}{\ThPdNu@space} |
| 491 |
% \begin{macrocode} |
| 492 |
\def\ThPdNu@space{ } |
| 493 |
% \end{macrocode} |
| 494 |
% \end{macro} |
| 495 |
% |
| 496 |
% \begin{macro}{\ThPdNu@zero} |
| 497 |
% \begin{macrocode} |
| 498 |
\chardef\ThPdNu@zero=0 % |
| 499 |
% \end{macrocode} |
| 500 |
% \end{macro} |
| 501 |
% |
| 502 |
% \begin{macro}{\ThPdNu@one} |
| 503 |
% \begin{macrocode} |
| 504 |
\chardef\ThPdNu@one=1 % |
| 505 |
% \end{macrocode} |
| 506 |
% \end{macro} |
| 507 |
% |
| 508 |
% \begin{macro}{\ThPdNu@firstoftwo} |
| 509 |
% \begin{macrocode} |
| 510 |
\long\def\ThPdNu@firstoftwo#1#2{#1} |
| 511 |
% \end{macrocode} |
| 512 |
% \end{macro} |
| 513 |
% |
| 514 |
% \begin{macro}{\ThPdNu@secondoftwo} |
| 515 |
% \begin{macrocode} |
| 516 |
\long\def\ThPdNu@secondoftwo#1#2{#2} |
| 517 |
% \end{macrocode} |
| 518 |
% \end{macro} |
| 519 |
% |
| 520 |
% \subsection{Detect \hologo{eTeX}} |
| 521 |
% |
| 522 |
% \begin{macrocode} |
| 523 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 524 |
\expandafter\ifx\csname detokenize\endcsname\relax |
| 525 |
\catcode`\&=14 % |
| 526 |
\catcode`\$=9 % |
| 527 |
\else |
| 528 |
\catcode`\&=9 % |
| 529 |
\catcode`\$=14 % |
| 530 |
\fi |
| 531 |
% \end{macrocode} |
| 532 |
% |
| 533 |
% \subsection{User macro \cs{thepdfnumber}} |
| 534 |
% |
| 535 |
% \begin{macro}{\thepdfnumber} |
| 536 |
% \begin{macrocode} |
| 537 |
\def\thepdfnumber#1{% |
| 538 |
\romannumeral |
| 539 |
& \iftrue\expandafter\ThPdNu@State@Plus\expandafter\fi |
| 540 |
& \detokenize\expandafter{#1}% |
| 541 |
& \ThPdNu@FIN |
| 542 |
$ \ifx\ThPdNu@FIN#1\ThPdNu@FIN |
| 543 |
$ \expandafter\ThPdNu@firstoftwo |
| 544 |
$ \else |
| 545 |
$ \expandafter\ThPdNu@secondoftwo |
| 546 |
$ \fi |
| 547 |
$ {% |
| 548 |
$ \ThPdNu@zero |
| 549 |
$ 0\thepdfnumber@ErrorUnexpectedEnd |
| 550 |
$ }{% |
| 551 |
$ \iftrue\expandafter\ThPdNu@State@Plus\expandafter\fi#1\ThPdNu@FIN |
| 552 |
$ }% |
| 553 |
} |
| 554 |
% \end{macrocode} |
| 555 |
% \end{macro} |
| 556 |
% |
| 557 |
% \subsubsection{State definitions for sign} |
| 558 |
% |
| 559 |
% \begin{macro}{\ThPdNu@State@Plus} |
| 560 |
% \begin{macrocode} |
| 561 |
\def\ThPdNu@State@Plus#1\fi#2{% |
| 562 |
\fi |
| 563 |
\ifcase\ifx\ThPdNu@FIN#2% |
| 564 |
0% |
| 565 |
& \else\ifx-#2% |
| 566 |
$ \else\ifnum`#2=45 % - |
| 567 |
1% |
| 568 |
\else\ifx0#2% |
| 569 |
2% |
| 570 |
\else\ifnum`#2>48 % |
| 571 |
\ifnum`#2<58 % |
| 572 |
3% |
| 573 |
\else |
| 574 |
9% |
| 575 |
\fi |
| 576 |
& \else\ifx.#2% |
| 577 |
$ \else\ifnum`#2=46 % . |
| 578 |
4% |
| 579 |
& \else\ifx+#2% |
| 580 |
$ \else\ifnum`#2=43 % + |
| 581 |
5% |
| 582 |
\else |
| 583 |
9% |
| 584 |
\fi\fi\fi\fi\fi\fi\ThPdNu@space |
| 585 |
\expandafter\ThPdNu@zero |
| 586 |
\expandafter0% |
| 587 |
\expandafter\thepdfnumber@ErrorUnexpectedEnd |
| 588 |
\or |
| 589 |
\ThPdNu@State@Minus |
| 590 |
\or |
| 591 |
\ThPdNu@State@SkipZeros!% |
| 592 |
\or |
| 593 |
\ThPdNu@State@Int!#2!% |
| 594 |
\or |
| 595 |
\ThPdNu@State@Dot!\ThPdNu@zero*\ThPdNu@zero!!% |
| 596 |
\or |
| 597 |
\ThPdNu@State@Plus |
| 598 |
\else |
| 599 |
\ThPdNu@ReturnError{0}% |
| 600 |
\fi |
| 601 |
} |
| 602 |
% \end{macrocode} |
| 603 |
% \end{macro} |
| 604 |
% |
| 605 |
% \begin{macro}{\ThPdNu@State@Minus} |
| 606 |
% \begin{macrocode} |
| 607 |
\def\ThPdNu@State@Minus#1\fi#2{% |
| 608 |
\fi |
| 609 |
\ifcase\ifx\ThPdNu@FIN#2% |
| 610 |
0% |
| 611 |
\else\ifx0#2% |
| 612 |
1% |
| 613 |
\else\ifnum`#2>48 % |
| 614 |
\ifnum`#2<58 % |
| 615 |
2% |
| 616 |
\else |
| 617 |
9% |
| 618 |
\fi |
| 619 |
& \else\ifx.#2% |
| 620 |
$ \else\ifnum`#2=46 % . |
| 621 |
3% |
| 622 |
& \else\ifx-#2% |
| 623 |
$ \else\ifnum`#2=45 % - |
| 624 |
4% |
| 625 |
& \else\ifx+#2% |
| 626 |
$ \else\ifnum`#2=43 % + |
| 627 |
5% |
| 628 |
\else |
| 629 |
9% |
| 630 |
\fi\fi\fi\fi\fi\fi\ThPdNu@space |
| 631 |
\expandafter\ThPdNu@zero |
| 632 |
\expandafter0% |
| 633 |
\expandafter\thepdfnumber@ErrorUnexpectedEnd |
| 634 |
\or |
| 635 |
\ThPdNu@State@SkipZeros-!% |
| 636 |
\or |
| 637 |
\ThPdNu@State@Int-!#2!% |
| 638 |
\or |
| 639 |
\ThPdNu@State@Dot-!\ThPdNu@zero*\ThPdNu@zero!!% |
| 640 |
\or |
| 641 |
\ThPdNu@State@Plus |
| 642 |
\or |
| 643 |
\ThPdNu@State@Minus |
| 644 |
\else |
| 645 |
\ThPdNu@ReturnError{0}% |
| 646 |
\fi |
| 647 |
} |
| 648 |
% \end{macrocode} |
| 649 |
% \end{macro} |
| 650 |
% |
| 651 |
% \begin{macro}{\ThPdNu@ReturnError} |
| 652 |
% \begin{macrocode} |
| 653 |
\def\ThPdNu@ReturnError#1#2\fi#3\ThPdNu@FIN{% |
| 654 |
\fi |
| 655 |
\ThPdNu@zero |
| 656 |
#1% |
| 657 |
\thepdfnumber@ErrorInvalidToken |
| 658 |
} |
| 659 |
% \end{macrocode} |
| 660 |
% \end{macro} |
| 661 |
% |
| 662 |
% \subsubsection{State definitions for integer part} |
| 663 |
% |
| 664 |
% \begin{macro}{\ThPdNu@State@SkipZeros} |
| 665 |
% \begin{macrocode} |
| 666 |
\def\ThPdNu@State@SkipZeros#1!#2\fi#3{% |
| 667 |
\fi |
| 668 |
\ifcase\ifx\ThPdNu@FIN#3% |
| 669 |
0% |
| 670 |
\else\ifx0#3% |
| 671 |
1% |
| 672 |
\else\ifnum`#3>48 % |
| 673 |
\ifnum`#3<58 % |
| 674 |
2% |
| 675 |
\else |
| 676 |
9% |
| 677 |
\fi |
| 678 |
& \else\ifx.#3% |
| 679 |
$ \else\ifnum`#3=46 % . |
| 680 |
3% |
| 681 |
\else |
| 682 |
9% |
| 683 |
\fi\fi\fi\fi\ThPdNu@space |
| 684 |
\expandafter\ThPdNu@zero |
| 685 |
\expandafter0% |
| 686 |
\or |
| 687 |
\ThPdNu@State@SkipZeros#1!% |
| 688 |
\or |
| 689 |
\ThPdNu@State@Int#1!#3!% |
| 690 |
\or |
| 691 |
\ThPdNu@State@Dot#1!\ThPdNu@zero*\ThPdNu@zero!!% |
| 692 |
\else |
| 693 |
\ThPdNu@ReturnError{0}% |
| 694 |
\fi |
| 695 |
} |
| 696 |
% \end{macrocode} |
| 697 |
% \end{macro} |
| 698 |
% |
| 699 |
% \begin{macro}{\ThPdNu@State@Int} |
| 700 |
% \begin{macrocode} |
| 701 |
\def\ThPdNu@State@Int#1!#2!#3\fi#4{% |
| 702 |
\fi |
| 703 |
\ifcase\ifx\ThPdNu@FIN#4% |
| 704 |
0% |
| 705 |
\else\ifnum`#4>47 % |
| 706 |
\ifnum`#4<58 % |
| 707 |
1% |
| 708 |
\else |
| 709 |
9% |
| 710 |
\fi |
| 711 |
& \else\ifx.#4% |
| 712 |
$ \else\ifnum`#4=46 % . |
| 713 |
2% |
| 714 |
\else |
| 715 |
9% |
| 716 |
\fi\fi\fi\ThPdNu@space |
| 717 |
\ThPdNu@ReturnInt{#1#2}% |
| 718 |
\or |
| 719 |
\ThPdNu@State@Int#1!#2#4!% |
| 720 |
\or |
| 721 |
\ThPdNu@State@Dot#1!\ThPdNu@one#2*\ThPdNu@zero!!% |
| 722 |
\else |
| 723 |
\ThPdNu@ReturnError{#1#2}% |
| 724 |
\fi |
| 725 |
} |
| 726 |
% \end{macrocode} |
| 727 |
% \end{macro} |
| 728 |
% |
| 729 |
% \begin{macro}{\ThPdNu@ReturnInt} |
| 730 |
% \begin{macrocode} |
| 731 |
\def\ThPdNu@ReturnInt#1#2\fi{% |
| 732 |
\fi |
| 733 |
\ThPdNu@zero |
| 734 |
#1% |
| 735 |
} |
| 736 |
% \end{macrocode} |
| 737 |
% \end{macro} |
| 738 |
% |
| 739 |
% \subsubsection{State definitions for decimal digits} |
| 740 |
% |
| 741 |
% \begin{macro}{\ThPdNu@State@Dot} |
| 742 |
% \begin{macrocode} |
| 743 |
\def\ThPdNu@State@Dot#1*#2#3!#4!#5\fi#6{% |
| 744 |
\fi |
| 745 |
\ifcase\ifx\ThPdNu@FIN#6% |
| 746 |
0% |
| 747 |
\else\ifnum`#6>48 % |
| 748 |
\ifnum`#6<58 % |
| 749 |
1% |
| 750 |
\else |
| 751 |
9% |
| 752 |
\fi |
| 753 |
\else\ifx0#6% |
| 754 |
2% |
| 755 |
\else |
| 756 |
9% |
| 757 |
\fi\fi\fi\ThPdNu@space |
| 758 |
\ThPdNu@ReturnNumber#1*#2#3!% |
| 759 |
\or |
| 760 |
\ThPdNu@State@Dot#1*\ThPdNu@one#3#4#6!!% |
| 761 |
\or |
| 762 |
\ThPdNu@State@DotZero#1*#2#3!#4#6!% |
| 763 |
\else |
| 764 |
\ThPdNu@ReturnNumberInvalid#1*#2#3!% |
| 765 |
\fi |
| 766 |
} |
| 767 |
% \end{macrocode} |
| 768 |
% \end{macro} |
| 769 |
% |
| 770 |
% \begin{macro}{\ThPdNu@State@DotZero} |
| 771 |
% \begin{macrocode} |
| 772 |
\def\ThPdNu@State@DotZero#1*#2#3!#4!#5\fi#6{% |
| 773 |
\fi |
| 774 |
\ifcase\ifx\ThPdNu@FIN#6% |
| 775 |
0% |
| 776 |
\else\ifnum`#6>48 % |
| 777 |
\ifnum`#6<58 % |
| 778 |
1% |
| 779 |
\else |
| 780 |
9% |
| 781 |
\fi |
| 782 |
\else\ifx0#6% |
| 783 |
2% |
| 784 |
\else |
| 785 |
9% |
| 786 |
\fi\fi\fi\ThPdNu@space |
| 787 |
\ThPdNu@ReturnNumber#1*#2#3!% |
| 788 |
\or |
| 789 |
\ThPdNu@State@Dot#1*\ThPdNu@one#3#4#6!!% |
| 790 |
\or |
| 791 |
\ThPdNu@State@DotZero#1*#2#3!#4#6!% |
| 792 |
\else |
| 793 |
\ThPdNu@ReturnNumber#1*#2#3!% |
| 794 |
\fi |
| 795 |
} |
| 796 |
% \end{macrocode} |
| 797 |
% \end{macro} |
| 798 |
% |
| 799 |
% \begin{macro}{\ThPdNu@ReturnNumber} |
| 800 |
% \begin{macrocode} |
| 801 |
\def\ThPdNu@ReturnNumber#1!#2#3*#4#5!#6\fi{% |
| 802 |
\fi |
| 803 |
\ifcase#2% |
| 804 |
\expandafter\ThPdNu@firstoftwo |
| 805 |
\else |
| 806 |
\expandafter\ThPdNu@secondoftwo |
| 807 |
\fi |
| 808 |
{% |
| 809 |
\ifcase#4% |
| 810 |
\expandafter\ThPdNu@firstoftwo |
| 811 |
\else |
| 812 |
\expandafter\ThPdNu@secondoftwo |
| 813 |
\fi |
| 814 |
{\ThPdNu@zero 0}% |
| 815 |
{\ThPdNu@zero #1.#5}% |
| 816 |
}{% |
| 817 |
\ifcase#4% |
| 818 |
\expandafter\ThPdNu@firstoftwo |
| 819 |
\else |
| 820 |
\expandafter\ThPdNu@secondoftwo |
| 821 |
\fi |
| 822 |
{\ThPdNu@zero #1#3}% |
| 823 |
{\ThPdNu@zero #1#3.#5}% |
| 824 |
}% |
| 825 |
} |
| 826 |
% \end{macrocode} |
| 827 |
% \end{macro} |
| 828 |
% |
| 829 |
% \begin{macro}{\ThPdNu@ReturnNumberInvalid} |
| 830 |
% \begin{macrocode} |
| 831 |
\def\ThPdNu@ReturnNumberInvalid#1*#2!#3\fi#4\ThPdNu@FIN{% |
| 832 |
\fi |
| 833 |
\iftrue\ThPdNu@ReturnNumber#1*#2!\fi |
| 834 |
\thepdfnumber@ErrorInvalidToken |
| 835 |
} |
| 836 |
% \end{macrocode} |
| 837 |
% \end{macro} |
| 838 |
% |
| 839 |
% \subsection{Norm macro} |
| 840 |
% |
| 841 |
% \begin{macro}{\thepdfnumberNormZeroOne} |
| 842 |
% \begin{macrocode} |
| 843 |
\def\thepdfnumberNormZeroOne#1{% |
| 844 |
\romannumeral |
| 845 |
& \iftrue\expandafter\ThPbNu@StateN@Plus\expandafter\fi |
| 846 |
& \detokenize\expandafter{#1}% |
| 847 |
& \ThPdNu@FIN |
| 848 |
$ \ifx\ThPdNu@FIN#1\ThPdNu@FIN |
| 849 |
$ \expandafter\ThPdNu@firstoftwo |
| 850 |
$ \else |
| 851 |
$ \expandafter\ThPdNu@secondoftwo |
| 852 |
$ \fi |
| 853 |
$ {% |
| 854 |
$ \ThPdNu@zero |
| 855 |
$ 0\thepdfnumber@ErrorUnexpectedEnd |
| 856 |
$ }{% |
| 857 |
$ \iftrue\expandafter\ThPbNu@StateN@Plus\expandafter\fi#1\ThPdNu@FIN |
| 858 |
$ }% |
| 859 |
} |
| 860 |
% \end{macrocode} |
| 861 |
% \end{macro} |
| 862 |
% |
| 863 |
% \subsubsection{State definitions for sign} |
| 864 |
% |
| 865 |
% \begin{macro}{\ThPbNu@StateN@Plus} |
| 866 |
% \begin{macrocode} |
| 867 |
\def\ThPbNu@StateN@Plus#1\fi#2{% |
| 868 |
\fi |
| 869 |
\ifcase\ifx\ThPdNu@FIN#2% |
| 870 |
0% |
| 871 |
& \else\ifx-#2% |
| 872 |
$ \else\ifnum`#2=45 % - |
| 873 |
1% |
| 874 |
\else\ifx0#2% |
| 875 |
2% |
| 876 |
\else\ifnum`#2>48 % |
| 877 |
\ifnum`#2<58 % |
| 878 |
3% |
| 879 |
\else |
| 880 |
9% |
| 881 |
\fi |
| 882 |
& \else\ifx.#2% |
| 883 |
$ \else\ifnum`#2=46 % . |
| 884 |
4% |
| 885 |
& \else\ifx+#2% |
| 886 |
$ \else\ifnum`#2=43 % + |
| 887 |
5% |
| 888 |
\else |
| 889 |
9% |
| 890 |
\fi\fi\fi\fi\fi\fi\ThPdNu@space |
| 891 |
\expandafter\ThPdNu@zero |
| 892 |
\expandafter0% |
| 893 |
\expandafter\thepdfnumber@ErrorUnexpectedEnd |
| 894 |
\or |
| 895 |
\ThPbNu@StateN@Minus |
| 896 |
\or |
| 897 |
\ThPbNu@StateN@SkipZeros |
| 898 |
\or |
| 899 |
\ThPdNu@ReturnAndSkip{1}% |
| 900 |
\or |
| 901 |
\ThPbNu@StateN@Dot\ThPdNu@zero!!% |
| 902 |
\or |
| 903 |
\ThPbNu@StateN@Plus |
| 904 |
\else |
| 905 |
\ThPdNu@ReturnError{0}% |
| 906 |
\fi |
| 907 |
} |
| 908 |
% \end{macrocode} |
| 909 |
% \end{macro} |
| 910 |
% |
| 911 |
% \begin{macro}{\ThPbNu@StateN@Minus} |
| 912 |
% \begin{macrocode} |
| 913 |
\def\ThPbNu@StateN@Minus#1\fi#2{% |
| 914 |
\fi |
| 915 |
\ifcase\ifx\ThPdNu@FIN#2% |
| 916 |
0% |
| 917 |
\else\ifnum`#2>47 % |
| 918 |
\ifnum`#2<58 % |
| 919 |
1% |
| 920 |
\else |
| 921 |
9% |
| 922 |
\fi |
| 923 |
& \else\ifx.#2% |
| 924 |
$ \else\ifnum`#2=46 % . |
| 925 |
1% |
| 926 |
& \else\ifx-#2% |
| 927 |
$ \else\ifnum`#2=45 % - |
| 928 |
2% |
| 929 |
& \else\ifx+#2% |
| 930 |
$ \else\ifnum`#2=43 % + |
| 931 |
3% |
| 932 |
\else |
| 933 |
9% |
| 934 |
\fi\fi\fi\fi\fi\ThPdNu@space |
| 935 |
\expandafter\ThPdNu@zero |
| 936 |
\expandafter0% |
| 937 |
\expandafter\thepdfnumber@ErrorUnexpectedEnd |
| 938 |
\or |
| 939 |
\ThPdNu@ReturnAndSkip{0}% |
| 940 |
\or |
| 941 |
\ThPbNu@StateN@Plus |
| 942 |
\or |
| 943 |
\ThPbNu@StateN@Minus |
| 944 |
\else |
| 945 |
\ThPdNu@ReturnError{0}% |
| 946 |
\fi |
| 947 |
} |
| 948 |
% \end{macrocode} |
| 949 |
% \end{macro} |
| 950 |
% |
| 951 |
% \begin{macro}{\ThPdNu@ReturnAndSkip} |
| 952 |
% \begin{macrocode} |
| 953 |
\def\ThPdNu@ReturnAndSkip#1#2\fi#3\ThPdNu@FIN{% |
| 954 |
\fi |
| 955 |
\ThPdNu@zero |
| 956 |
#1% |
| 957 |
} |
| 958 |
% \end{macrocode} |
| 959 |
% \end{macro} |
| 960 |
% |
| 961 |
% \subsubsection{State definitions for integer part} |
| 962 |
% |
| 963 |
% \begin{macro}{\ThPbNu@StateN@SkipZeros} |
| 964 |
% \begin{macrocode} |
| 965 |
\def\ThPbNu@StateN@SkipZeros#1\fi#2{% |
| 966 |
\fi |
| 967 |
\ifcase\ifx\ThPdNu@FIN#2% |
| 968 |
0% |
| 969 |
\else\ifx0#2% |
| 970 |
1% |
| 971 |
\else\ifnum`#2>48 % |
| 972 |
\ifnum`#2<58 % |
| 973 |
2% |
| 974 |
\else |
| 975 |
9% |
| 976 |
\fi |
| 977 |
& \else\ifx.#2% |
| 978 |
$ \else\ifnum`#2=46 % . |
| 979 |
3% |
| 980 |
\else |
| 981 |
9% |
| 982 |
\fi\fi\fi\fi\ThPdNu@space |
| 983 |
\expandafter\ThPdNu@zero |
| 984 |
\expandafter0% |
| 985 |
\or |
| 986 |
\ThPbNu@StateN@SkipZeros% |
| 987 |
\or |
| 988 |
\ThPdNu@ReturnAndSkip{1}% |
| 989 |
\or |
| 990 |
\ThPbNu@StateN@Dot\ThPdNu@zero!!% |
| 991 |
\else |
| 992 |
\ThPdNu@ReturnError{0}% |
| 993 |
\fi |
| 994 |
} |
| 995 |
% \end{macrocode} |
| 996 |
% \end{macro} |
| 997 |
% |
| 998 |
% \subsubsection{State definitions for decimal digits} |
| 999 |
% |
| 1000 |
% \begin{macro}{\ThPbNu@StateN@Dot} |
| 1001 |
% \begin{macrocode} |
| 1002 |
\def\ThPbNu@StateN@Dot#1#2!#3!#4\fi#5{% |
| 1003 |
\fi |
| 1004 |
\ifcase\ifx\ThPdNu@FIN#5% |
| 1005 |
0% |
| 1006 |
\else\ifnum`#5>48 % |
| 1007 |
\ifnum`#5<58 % |
| 1008 |
1% |
| 1009 |
\else |
| 1010 |
9% |
| 1011 |
\fi |
| 1012 |
\else\ifx0#5% |
| 1013 |
2% |
| 1014 |
\else |
| 1015 |
9% |
| 1016 |
\fi\fi\fi\ThPdNu@space |
| 1017 |
\ThPdNu@ReturnFracNumber#1#2!% |
| 1018 |
\or |
| 1019 |
\ThPbNu@StateN@Dot\ThPdNu@one#2#3#5!!% |
| 1020 |
\or |
| 1021 |
\ThPbNu@StateN@DotZero#1#2!#3#5!% |
| 1022 |
\else |
| 1023 |
\ThPdNu@ReturnFracNumberInvalid#1#2!% |
| 1024 |
\fi |
| 1025 |
} |
| 1026 |
% \end{macrocode} |
| 1027 |
% \end{macro} |
| 1028 |
% |
| 1029 |
% \begin{macro}{\ThPbNu@StateN@DotZero} |
| 1030 |
% \begin{macrocode} |
| 1031 |
\def\ThPbNu@StateN@DotZero#1#2!#3!#4\fi#5{% |
| 1032 |
\fi |
| 1033 |
\ifcase\ifx\ThPdNu@FIN#5% |
| 1034 |
0% |
| 1035 |
\else\ifnum`#5>48 % |
| 1036 |
\ifnum`#5<58 % |
| 1037 |
1% |
| 1038 |
\else |
| 1039 |
9% |
| 1040 |
\fi |
| 1041 |
\else\ifx0#5% |
| 1042 |
2% |
| 1043 |
\else |
| 1044 |
9% |
| 1045 |
\fi\fi\fi\ThPdNu@space |
| 1046 |
\ThPdNu@ReturnFracNumber#1#2!% |
| 1047 |
\or |
| 1048 |
\ThPbNu@StateN@Dot\ThPdNu@one#2#3#5!!% |
| 1049 |
\or |
| 1050 |
\ThPbNu@StateN@DotZero#1#2!#3#5!% |
| 1051 |
\else |
| 1052 |
\ThPdNu@ReturnFracNumberInvalid#1#2!% |
| 1053 |
\fi |
| 1054 |
} |
| 1055 |
% \end{macrocode} |
| 1056 |
% \end{macro} |
| 1057 |
% |
| 1058 |
% \begin{macro}{\ThPdNu@ReturnFracNumber} |
| 1059 |
% \begin{macrocode} |
| 1060 |
\def\ThPdNu@ReturnFracNumber#1#2!#3\fi{% |
| 1061 |
\fi |
| 1062 |
\ifcase#1% |
| 1063 |
\expandafter\ThPdNu@firstoftwo |
| 1064 |
\else |
| 1065 |
\expandafter\ThPdNu@secondoftwo |
| 1066 |
\fi |
| 1067 |
{\ThPdNu@zero 0}% |
| 1068 |
{\ThPdNu@zero .#2}% |
| 1069 |
} |
| 1070 |
% \end{macrocode} |
| 1071 |
% \end{macro} |
| 1072 |
% |
| 1073 |
% \begin{macro}{\ThPdNu@ReturnFracNumberInvalid} |
| 1074 |
% \begin{macrocode} |
| 1075 |
\def\ThPdNu@ReturnFracNumberInvalid#1!#2\fi#3\ThPdNu@FIN{% |
| 1076 |
\fi |
| 1077 |
\iftrue\ThPdNu@ReturnFracNumber#1!\fi |
| 1078 |
\thepdfnumber@ErrorInvalidToken |
| 1079 |
} |
| 1080 |
% \end{macrocode} |
| 1081 |
% \end{macro} |
| 1082 |
% |
| 1083 |
% \begin{macrocode} |
| 1084 |
\ThPdNu@AtEnd% |
| 1085 |
%</package> |
| 1086 |
% \end{macrocode} |
| 1087 |
%% \section{Installation} |
| 1088 |
% |
| 1089 |
% \subsection{Download} |
| 1090 |
% |
| 1091 |
% \paragraph{Package.} This package is available on |
| 1092 |
% CTAN\footnote{\CTANpkg{thepdfnumber}}: |
| 1093 |
% \begin{description} |
| 1094 |
% \item[\CTAN{macros/latex/contrib/oberdiek/thepdfnumber.dtx}] The source file. |
| 1095 |
% \item[\CTAN{macros/latex/contrib/oberdiek/thepdfnumber.pdf}] Documentation. |
| 1096 |
% \end{description} |
| 1097 |
% |
| 1098 |
% |
| 1099 |
% \paragraph{Bundle.} All the packages of the bundle `oberdiek' |
| 1100 |
% are also available in a TDS compliant ZIP archive. There |
| 1101 |
% the packages are already unpacked and the documentation files |
| 1102 |
% are generated. The files and directories obey the TDS standard. |
| 1103 |
% \begin{description} |
| 1104 |
% \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}] |
| 1105 |
% \end{description} |
| 1106 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 1107 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 1108 |
% with \xfile{texmf} in their name are usually organized this way. |
| 1109 |
% |
| 1110 |
% \subsection{Bundle installation} |
| 1111 |
% |
| 1112 |
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the |
| 1113 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 1114 |
% Example (linux): |
| 1115 |
% \begin{quote} |
| 1116 |
% |unzip oberdiek.tds.zip -d ~/texmf| |
| 1117 |
% \end{quote} |
| 1118 |
% |
| 1119 |
% \subsection{Package installation} |
| 1120 |
% |
| 1121 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 1122 |
% \docstrip\ archive. The files are extracted by running the |
| 1123 |
% \xfile{.dtx} through \plainTeX: |
| 1124 |
% \begin{quote} |
| 1125 |
% \verb|tex thepdfnumber.dtx| |
| 1126 |
% \end{quote} |
| 1127 |
% |
| 1128 |
% \paragraph{TDS.} Now the different files must be moved into |
| 1129 |
% the different directories in your installation TDS tree |
| 1130 |
% (also known as \xfile{texmf} tree): |
| 1131 |
% \begin{quote} |
| 1132 |
% \def\t{^^A |
| 1133 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 1134 |
% thepdfnumber.sty & tex/generic/oberdiek/thepdfnumber.sty\\ |
| 1135 |
% thepdfnumber.pdf & doc/latex/oberdiek/thepdfnumber.pdf\\ |
| 1136 |
% thepdfnumber.dtx & source/latex/oberdiek/thepdfnumber.dtx\\ |
| 1137 |
% \end{tabular}^^A |
| 1138 |
% }^^A |
| 1139 |
% \sbox0{\t}^^A |
| 1140 |
% \ifdim\wd0>\linewidth |
| 1141 |
% \begingroup |
| 1142 |
% \advance\linewidth by\leftmargin |
| 1143 |
% \advance\linewidth by\rightmargin |
| 1144 |
% \edef\x{\endgroup |
| 1145 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 1146 |
% }\x |
| 1147 |
% \def\lwbox{^^A |
| 1148 |
% \leavevmode |
| 1149 |
% \hbox to \linewidth{^^A |
| 1150 |
% \kern-\leftmargin\relax |
| 1151 |
% \hss |
| 1152 |
% \usebox0 |
| 1153 |
% \hss |
| 1154 |
% \kern-\rightmargin\relax |
| 1155 |
% }^^A |
| 1156 |
% }^^A |
| 1157 |
% \ifdim\wd0>\lw |
| 1158 |
% \sbox0{\small\t}^^A |
| 1159 |
% \ifdim\wd0>\linewidth |
| 1160 |
% \ifdim\wd0>\lw |
| 1161 |
% \sbox0{\footnotesize\t}^^A |
| 1162 |
% \ifdim\wd0>\linewidth |
| 1163 |
% \ifdim\wd0>\lw |
| 1164 |
% \sbox0{\scriptsize\t}^^A |
| 1165 |
% \ifdim\wd0>\linewidth |
| 1166 |
% \ifdim\wd0>\lw |
| 1167 |
% \sbox0{\tiny\t}^^A |
| 1168 |
% \ifdim\wd0>\linewidth |
| 1169 |
% \lwbox |
| 1170 |
% \else |
| 1171 |
% \usebox0 |
| 1172 |
% \fi |
| 1173 |
% \else |
| 1174 |
% \lwbox |
| 1175 |
% \fi |
| 1176 |
% \else |
| 1177 |
% \usebox0 |
| 1178 |
% \fi |
| 1179 |
% \else |
| 1180 |
% \lwbox |
| 1181 |
% \fi |
| 1182 |
% \else |
| 1183 |
% \usebox0 |
| 1184 |
% \fi |
| 1185 |
% \else |
| 1186 |
% \lwbox |
| 1187 |
% \fi |
| 1188 |
% \else |
| 1189 |
% \usebox0 |
| 1190 |
% \fi |
| 1191 |
% \else |
| 1192 |
% \lwbox |
| 1193 |
% \fi |
| 1194 |
% \else |
| 1195 |
% \usebox0 |
| 1196 |
% \fi |
| 1197 |
% \end{quote} |
| 1198 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 1199 |
% TDS installing feature, then some files can already be in the right |
| 1200 |
% place, see the documentation of \docstrip. |
| 1201 |
% |
| 1202 |
% \subsection{Refresh file name databases} |
| 1203 |
% |
| 1204 |
% If your \TeX~distribution |
| 1205 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 1206 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 1207 |
% \verb|mktexlsr|. |
| 1208 |
% |
| 1209 |
% \subsection{Some details for the interested} |
| 1210 |
% |
| 1211 |
% \paragraph{Unpacking with \LaTeX.} |
| 1212 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 1213 |
% \begin{description} |
| 1214 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 1215 |
% \item[\LaTeX:] Generate the documentation. |
| 1216 |
% \end{description} |
| 1217 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 1218 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 1219 |
% about your intention: |
| 1220 |
% \begin{quote} |
| 1221 |
% \verb|latex \let\install=y\input{thepdfnumber.dtx}| |
| 1222 |
% \end{quote} |
| 1223 |
% Do not forget to quote the argument according to the demands |
| 1224 |
% of your shell. |
| 1225 |
% |
| 1226 |
% \paragraph{Generating the documentation.} |
| 1227 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 1228 |
% the documentation. The process can be configured by the |
| 1229 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 1230 |
% line into this file, if you want to have A4 as paper format: |
| 1231 |
% \begin{quote} |
| 1232 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 1233 |
% \end{quote} |
| 1234 |
% An example follows how to generate the |
| 1235 |
% documentation with pdf\LaTeX: |
| 1236 |
% \begin{quote} |
| 1237 |
%\begin{verbatim} |
| 1238 |
%pdflatex thepdfnumber.dtx |
| 1239 |
%makeindex -s gind.ist thepdfnumber.idx |
| 1240 |
%pdflatex thepdfnumber.dtx |
| 1241 |
%makeindex -s gind.ist thepdfnumber.idx |
| 1242 |
%pdflatex thepdfnumber.dtx |
| 1243 |
%\end{verbatim} |
| 1244 |
% \end{quote} |
| 1245 |
% |
| 1246 |
% \printbibliography[ |
| 1247 |
% heading=bibnumbered, |
| 1248 |
% ] |
| 1249 |
% |
| 1250 |
% \begin{History} |
| 1251 |
% \begin{Version}{2011/11/24 v1.0} |
| 1252 |
% \item |
| 1253 |
% First version. |
| 1254 |
% \end{Version} |
| 1255 |
% \begin{Version}{2016/05/16 v1.1} |
| 1256 |
% \item |
| 1257 |
% Documentation updates. |
| 1258 |
% \end{Version} |
| 1259 |
% \end{History} |
| 1260 |
% |
| 1261 |
% \PrintIndex |
| 1262 |
% |
| 1263 |
% \Finale |
| 1264 |
\endinput |