Debian Codegraph @

texmf-dist/source/latex/oberdiek/fibnum.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: fibnum.dtx
4 % Version: 2016/05/16 v1.1
5 % Info: Fibonacci numbers
6 %
7 % Copyright (C)
8 % 2012 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 fibnum.dtx
32 % and the derived files
33 % fibnum.sty, fibnum.pdf, fibnum.ins, fibnum.drv, fibnum.bib,
34 % fibnum-test1.tex, fibnum-test-calc.tex.
35 %
36 % Distribution:
37 % CTAN:macros/latex/contrib/oberdiek/fibnum.dtx
38 % CTAN:macros/latex/contrib/oberdiek/fibnum.pdf
39 %
40 % Unpacking:
41 % (a) If fibnum.ins is present:
42 % tex fibnum.ins
43 % (b) Without fibnum.ins:
44 % tex fibnum.dtx
45 % (c) If you insist on using LaTeX
46 % latex \let\install=y\input{fibnum.dtx}
47 % (quote the arguments according to the demands of your shell)
48 %
49 % Documentation:
50 % (a) If fibnum.drv is present:
51 % latex fibnum.drv
52 % (b) Without fibnum.drv:
53 % latex fibnum.dtx; ...
54 % The class ltxdoc loads the configuration file ltxdoc.cfg
55 % if available. Here you can specify further options, e.g.
56 % use A4 as paper format:
57 % \PassOptionsToClass{a4paper}{article}
58 %
59 % Program calls to get the documentation (example):
60 % pdflatex fibnum.dtx
61 % bibtex fibnum.aux
62 % makeindex -s gind.ist fibnum.idx
63 % pdflatex fibnum.dtx
64 % makeindex -s gind.ist fibnum.idx
65 % pdflatex fibnum.dtx
66 %
67 % Installation:
68 % TDS:tex/generic/oberdiek/fibnum.sty
69 % TDS:doc/latex/oberdiek/fibnum.pdf
70 % TDS:source/latex/oberdiek/fibnum.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: fibnum 2016/05/16 v1.1 Fibonacci numbers (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: fibnum
99 Version: 2016/05/16 v1.1
100
101 Copyright (C)
102 2012 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 fibnum.dtx
126 and the derived files
127 fibnum.sty, fibnum.pdf, fibnum.ins, fibnum.drv, fibnum.bib,
128 fibnum-test1.tex, fibnum-test-calc.tex.
129
130 \endpreamble
131 \let\MetaPrefix\DoubleperCent
132
133 \generate{%
134 \file{fibnum.ins}{\from{fibnum.dtx}{install}}%
135 \file{fibnum.drv}{\from{fibnum.dtx}{driver}}%
136 \nopreamble
137 \nopostamble
138 \file{fibnum.bib}{\from{fibnum.dtx}{bib}}%
139 \usepreamble\defaultpreamble
140 \usepostamble\defaultpostamble
141 \usedir{tex/generic/oberdiek}%
142 \file{fibnum.sty}{\from{fibnum.dtx}{package}}%
143 % \usedir{doc/latex/oberdiek/test}%
144 % \file{fibnum-test1.tex}{\from{fibnum.dtx}{test1}}%
145 % \file{fibnum-test-calc.tex}{\from{fibnum.dtx}{test-calc}}%
146 }
147
148 \catcode32=13\relax% active space
149 \let =\space%
150 \Msg{************************************************************************}
151 \Msg{*}
152 \Msg{* To finish the installation you have to move the following}
153 \Msg{* file into a directory searched by TeX:}
154 \Msg{*}
155 \Msg{* fibnum.sty}
156 \Msg{*}
157 \Msg{* To produce the documentation run the file `fibnum.drv'}
158 \Msg{* through LaTeX.}
159 \Msg{*}
160 \Msg{* Happy TeXing!}
161 \Msg{*}
162 \Msg{************************************************************************}
163
164 \endbatchfile
165 %</install>
166 %<*bib>
167 @online{texhax:abraham,
168 author={Abraham, Jan},
169 title={[texhax] Beginner in TEX MACRO to compute functions},
170 date={2012-04-07},
171 url={https://tug.org/pipermail/texhax/2012-April/019146.html},
172 urldate={2012-04-08},
173 }
174 @article{knuth:negafibonacci,
175 author={Knuth, Donald E.},
176 title={Negafibonacci Numbers and the Hyperbolic Plane},
177 date={2008-12-11},
178 url={http://research.allacademic.com/meta/p206842_index.html},
179 }
180 @online{wikipedia:negafibonacci,
181 author={{Wikipedia contributors}},
182 organization={{Wikipedia, The Free Encyclopedia}},
183 title={Fibonacci numbers},
184 language={langenglish},
185 version={486266088},
186 date={2012-04-08},
187 url={https://en.wikipedia.org/w/index.php?title=Fibonacci_number&oldid=486266088},
188 urldate={2012-04-08},
189 }
190 %</bib>
191 %<*ignore>
192 \fi
193 %</ignore>
194 %<*driver>
195 \NeedsTeXFormat{LaTeX2e}
196 \ProvidesFile{fibnum.drv}%
197 [2016/05/16 v1.1 Fibonacci numbers (HO)]%
198 \documentclass{ltxdoc}
199 \usepackage{amsmath,amsfonts}
200 \usepackage{siunitx}
201 \usepackage{array}
202 \usepackage{tabularx}
203 \usepackage{fibnum}[2016/05/16]
204 \usepackage{holtxdoc}[2011/11/22]
205 \usepackage{csquotes}
206 \usepackage[
207 backend=bibtex,
208 bibencoding=ascii,
209 alldates=iso,seconds=true,
210 ]{biblatex}[2011/11/13]
211 \bibliography{oberdiek-source}
212 \bibliography{fibnum}
213 \begin{document}
214 \DocInput{fibnum.dtx}%
215 \end{document}
216 %</driver>
217 % \fi
218 %
219 %
220 %
221 % \GetFileInfo{fibnum.drv}
222 %
223 % \title{The \xpackage{fibnum} package}
224 % \date{2016/05/16 v1.1}
225 % \author{Heiko Oberdiek\thanks
226 % {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}}
227 %
228 % \maketitle
229 %
230 % \begin{abstract}
231 % The package \xpackage{fibnum} provides expandable fibonacci
232 % numbers for both \hologo{LaTeX} and \hologo{plainTeX}.
233 % \end{abstract}
234 %
235 % \tableofcontents
236 %
237 % \section{Documentation}
238 %
239 % In the mailing list \textsf{texhax} Jan Abraham asked the question,
240 % how to get Fibonacci numbers in \hologo{TeX} \cite{texhax:abraham}:
241 % \begin{quote}
242 % Write a Macro in \hologo{TeX} that compute the function |\fib{m}|
243 % All fibonacci numbers from 1 to $m$ ($m < 40$).
244 % \end{quote}
245 % This packages provides an expandable implementation for the
246 % calculation of these numbers for a much larger set of indexes.
247 % For practical reasons the index is restricted to the same limitations
248 % that apply for \hologo{TeX} integer numbers.
249 % The range of the Fibonacci numbers, however, are not limited
250 % by the algorithm. They are only restricted to memory limitations,
251 % if they are hit.
252 %
253 % The package is loaded as \hologo{LaTeX} package in \hologo{LaTeX}:
254 % \begin{quote}
255 % |\usepackage{fibnum}|
256 % \end{quote}
257 % and as file in \hologo{plainTeX}:
258 % \begin{quote}
259 % |\input fibnum.sty|
260 % \end{quote}
261 % The package does not know any options and it provides
262 % the macros \cs{fibnum} and \cs{fibnumPreCalc}.
263 %
264 % \begin{declcs}{fibnum} \M{index}
265 % \end{declcs}
266 % Macro \cs{fibnum} expects a \hologo{TeX} number as \meta{index}
267 % in the official \hologo{TeX} number range from $-(2^{31}-1)$ up to
268 % $2^{31}-1$. In exact two expansion steps the macro expands to
269 % the Fibnoacci number $F_{\text{\meta{index}}}$. In case of a negative
270 % \meta{index}, the ``negafibonacci'' number \cite{wikipedia:negafibonacci}
271 % is used. Formally the Fibonacci number $F_n$ with integer
272 % index~$n$, $n\in\mathbb{Z}$ and
273 % $n\in[\num{-2147483647},\num{2147483647}]$ that is returned by macro
274 % \cs{fibnum} with numerical argument $n$ is defined the following way:
275 % \begin{gather}
276 % \label{eq:def}
277 % F_n =
278 % \begin{cases}
279 % 0 & \text{for $n=0$}\\
280 % 1 & \text{for $n=1$}\\
281 % F_{n-1} + F_{n-2} & \text{for $n>1$}\\
282 % (-1)^{n+1}F_n & \text{for $n<0$}
283 % \end{cases}
284 % \end{gather}
285 % Examples:
286 % \begin{quote}
287 % \makeatletter
288 % \def\x#1{\cs{fibnum}\{#1\}&
289 % \edef\X{\fibnum{#1}}\edef\Y{\expandafter\ltx@car\X\@nil}^^A
290 % \if-\Y
291 % \edef\X{\expandafter\ltx@cdr\X\@nil}^^A
292 % \noindent
293 % \llap{-}\X
294 % \else
295 % \X
296 % \fi
297 % \tabularnewline
298 % }
299 % \def\y{\multicolumn{1}{@{}c@{}}{$\vdots$}\tabularnewline}
300 % \DeclareUrlCommand\UrlNum{^^A
301 % \urlstyle{tt}^^A
302 % \def\UrlBreaks{\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9}^^A
303 % }
304 % \begin{tabularx}{\dimexpr\linewidth+5.7pt\relax}{@{}>{\ttfamily}l@{ $\rightarrow$ \hphantom{\ttfamily-}}>{\ttfamily}X@{}}
305 % \x{-6}
306 % \x{-5}
307 % \x{-4}
308 % \x{-3}
309 % \x{-2}
310 % \x{-1}
311 % \x{0}
312 % \x{1}
313 % \x{2}
314 % \x{3}
315 % \x{4}
316 % \x{5}
317 % \x{6}
318 % \y
319 % \x{10}
320 % \y
321 % \x{46}
322 % \y
323 % \cs{fibnum}\{100\} & 354224848179261915075
324 % \tabularnewline
325 % \y
326 % \cs{fibnum}\{200\} & 280571172992510140037611932413038677189525
327 % \tabularnewline
328 % \y
329 % \cs{fibnum}\{1000\} &
330 % \raggedright
331 % \UrlNum{^^A
332 % 434665576869374564356885276750406258025646^^A
333 % 605173717804024817290895365554179490518904^^A
334 % 038798400792551692959225930803226347752096^^A
335 % 896232398733224711616429964409065331879382^^A
336 % 98969649928516003704476137795166849228875^^A
337 % }
338 % \tabularnewline
339 % \end{tabularx}\kern-5.7pt\mbox{}
340 % \end{quote}
341 %
342 % \begin{declcs}{fibnumPreCalc} \M{index}
343 % \end{declcs}
344 % The package already provides precalculated Fibonacci numbers up to
345 % index~46. That means that calculations are not necessary for
346 % Fibonacci numbers that fit into the range of \hologo{TeX}
347 % numbers. Because macro \cs{fibnum} is expandable, it cannot
348 % store calculated Fibonacci numbers for later use. Macro definitions
349 % are forbidden in expandable contexts. If larger Fibonacci numbers
350 % are used more than once, than the compilation time can be shortened
351 % by calculating and storing the Fibonacci numbers beforehand.
352 % The argument \meta{index} is a \hologo{TeX} number and macro
353 % \cs{fibnumPreCalc} ensures that the Fibonacci numbers
354 % $F_0$ up to $F_{\lvert\text{\meta{index}}\rvert}$ that are not
355 % already known are calculated
356 % and stored in internal macros. Internally only non-negative
357 % Fibonacci numbers are stored. If \meta{index} is negative, then
358 % the needed positive Fibonacci numbers are calculated and stored.
359 % Example:
360 % \begin{quote}
361 % \def\x#1{\begingroup\itshape\texttt{\%} #1\endgroup}
362 % |\fibnumPreCalc{50}|\\
363 % \x{calculates and stores the values for indexes 47..50.}\\
364 % \x{(Values for 0..46 are already stored by the package.)}\\
365 % |\fibnum{49}| \x{uses the stored value}\\
366 % |\fibnum{51}|
367 % \x{only calculates $F_{51}$ from stored values $F_{49}$ and $F_{50}$}\\
368 % |\fibnumPreCalc{100}|\\
369 % \x{calculates and stores the values for indexes 51..100}\\
370 % |\fibnum{100}| \x{uses the stored value for $F_{100}$}\\
371 % |\fibnum{-100}|
372 % \x{uses the stored value for $F_{100}$}\\
373 % \x{$F_{-100}=-F_{100}$ according to equation \eqref{eq:def}.}
374 % \end{quote}
375 %
376 % \StopEventually{
377 % }
378 %
379 % \section{Implementation}
380 %
381 % \subsection{Identification}
382 %
383 % \begin{macrocode}
384 %<*package>
385 % \end{macrocode}
386 % Reload check, especially if the package is not used with \LaTeX.
387 % \begin{macrocode}
388 \begingroup\catcode61\catcode48\catcode32=10\relax%
389 \catcode13=5 % ^^M
390 \endlinechar=13 %
391 \catcode35=6 % #
392 \catcode39=12 % '
393 \catcode44=12 % ,
394 \catcode45=12 % -
395 \catcode46=12 % .
396 \catcode58=12 % :
397 \catcode64=11 % @
398 \catcode123=1 % {
399 \catcode125=2 % }
400 \expandafter\let\expandafter\x\csname [email protected]\endcsname
401 \ifx\x\relax % plain-TeX, first loading
402 \else
403 \def\empty{}%
404 \ifx\x\empty % LaTeX, first loading,
405 % variable is initialized, but \ProvidesPackage not yet seen
406 \else
407 \expandafter\ifx\csname PackageInfo\endcsname\relax
408 \def\x#1#2{%
409 \immediate\write-1{Package #1 Info: #2.}%
410 }%
411 \else
412 \def\x#1#2{\PackageInfo{#1}{#2, stopped}}%
413 \fi
414 \x{fibnum}{The package is already loaded}%
415 \aftergroup\endinput
416 \fi
417 \fi
418 \endgroup%
419 % \end{macrocode}
420 % Package identification:
421 % \begin{macrocode}
422 \begingroup\catcode61\catcode48\catcode32=10\relax%
423 \catcode13=5 % ^^M
424 \endlinechar=13 %
425 \catcode35=6 % #
426 \catcode39=12 % '
427 \catcode40=12 % (
428 \catcode41=12 % )
429 \catcode44=12 % ,
430 \catcode45=12 % -
431 \catcode46=12 % .
432 \catcode47=12 % /
433 \catcode58=12 % :
434 \catcode64=11 % @
435 \catcode91=12 % [
436 \catcode93=12 % ]
437 \catcode123=1 % {
438 \catcode125=2 % }
439 \expandafter\ifx\csname ProvidesPackage\endcsname\relax
440 \def\x#1#2#3[#4]{\endgroup
441 \immediate\write-1{Package: #3 #4}%
442 \xdef#1{#4}%
443 }%
444 \else
445 \def\x#1#2[#3]{\endgroup
446 #2[{#3}]%
447 \ifx#1\@undefined
448 \xdef#1{#3}%
449 \fi
450 \ifx#1\relax
451 \xdef#1{#3}%
452 \fi
453 }%
454 \fi
455 \expandafter\x\csname [email protected]\endcsname
456 \ProvidesPackage{fibnum}%
457 [2016/05/16 v1.1 Fibonacci numbers (HO)]%
458 % \end{macrocode}
459 %
460 % \begin{macrocode}
461 \begingroup\catcode61\catcode48\catcode32=10\relax%
462 \catcode13=5 % ^^M
463 \endlinechar=13 %
464 \catcode123=1 % {
465 \catcode125=2 % }
466 \catcode64=11 % @
467 \def\x{\endgroup
468 \expandafter\edef\csname FibNum@AtEnd\endcsname{%
469 \endlinechar=\the\endlinechar\relax
470 \catcode13=\the\catcode13\relax
471 \catcode32=\the\catcode32\relax
472 \catcode35=\the\catcode35\relax
473 \catcode61=\the\catcode61\relax
474 \catcode64=\the\catcode64\relax
475 \catcode123=\the\catcode123\relax
476 \catcode125=\the\catcode125\relax
477 }%
478 }%
479 \x\catcode61\catcode48\catcode32=10\relax%
480 \catcode13=5 % ^^M
481 \endlinechar=13 %
482 \catcode35=6 % #
483 \catcode64=11 % @
484 \catcode123=1 % {
485 \catcode125=2 % }
486 \def\TMP@EnsureCode#1#2{%
487 \edef\FibNum@AtEnd{%
488 \FibNum@AtEnd
489 \catcode#1=\the\catcode#1\relax
490 }%
491 \catcode#1=#2\relax
492 }
493 \TMP@EnsureCode{33}{12}% !
494 %\TMP@EnsureCode{36}{3}% $
495 %\TMP@EnsureCode{38}{4}% &
496 \TMP@EnsureCode{40}{12}% (
497 \TMP@EnsureCode{41}{12}% )
498 \TMP@EnsureCode{45}{12}% -
499 \TMP@EnsureCode{46}{12}% .
500 \TMP@EnsureCode{47}{12}% /
501 \TMP@EnsureCode{58}{12}% :
502 \TMP@EnsureCode{60}{12}% <
503 \TMP@EnsureCode{62}{12}% >
504 \TMP@EnsureCode{91}{12}% [
505 %\TMP@EnsureCode{96}{12}% `
506 \TMP@EnsureCode{93}{12}% ]
507 %\TMP@EnsureCode{94}{12}% ^ (superscript) (!)
508 %\TMP@EnsureCode{124}{12}% |
509 \edef\FibNum@AtEnd{\FibNum@AtEnd\noexpand\endinput}
510 % \end{macrocode}
511 %
512 % \subsection{Package resources}
513 %
514 % \begin{macrocode}
515 \begingroup\expandafter\expandafter\expandafter\endgroup
516 \expandafter\ifx\csname RequirePackage\endcsname\relax
517 \def\TMP@RequirePackage#1[#2]{%
518 \begingroup\expandafter\expandafter\expandafter\endgroup
519 \expandafter\ifx\csname ver@#1.sty\endcsname\relax
520 \input #1.sty\relax
521 \fi
522 }%
523 \TMP@RequirePackage{ltxcmds}[2011/04/18]%
524 \TMP@RequirePackage{intcalc}[2007/09/27]%
525 \TMP@RequirePackage{bigintcalc}[2007/11/11]%
526 \else
527 \RequirePackage{ltxcmds}[2011/04/18]%
528 \RequirePackage{intcalc}[2007/09/27]%
529 \RequirePackage{bigintcalc}[2007/11/11]%
530 \fi
531 % \end{macrocode}
532 %
533 % \subsection{Setup precalculated values}
534 %
535 % \begin{macrocode}
536 \def\FibNum@temp#1{%
537 \expandafter\def\csname FibNum@#1\endcsname
538 }
539 \catcode46=9 % dots are ignored
540 \FibNum@temp{0}{0}
541 \FibNum@temp{1}{1}
542 \FibNum@temp{2}{1}
543 \FibNum@temp{3}{2}
544 \FibNum@temp{4}{3}
545 \FibNum@temp{5}{5}
546 \FibNum@temp{6}{8}
547 \FibNum@temp{7}{13}
548 \FibNum@temp{8}{21}
549 \FibNum@temp{9}{34}
550 \FibNum@temp{10}{55}
551 \FibNum@temp{11}{89}
552 \FibNum@temp{12}{144}
553 \FibNum@temp{13}{233}
554 \FibNum@temp{14}{377}
555 \FibNum@temp{15}{610}
556 \FibNum@temp{16}{987}
557 \FibNum@temp{17}{1.597}
558 \FibNum@temp{18}{2.584}
559 \FibNum@temp{19}{4.181}
560 \FibNum@temp{20}{6.765}
561 \FibNum@temp{21}{10.946}
562 \FibNum@temp{22}{17.711}
563 \FibNum@temp{23}{28.657}
564 \FibNum@temp{24}{46.368}
565 \FibNum@temp{25}{75.025}
566 \FibNum@temp{26}{121.393}
567 \FibNum@temp{27}{196.418}
568 \FibNum@temp{28}{317.811}
569 \FibNum@temp{29}{514.229}
570 \FibNum@temp{30}{832.040}
571 \FibNum@temp{31}{1.346.269}
572 \FibNum@temp{32}{2.178.309}
573 \FibNum@temp{33}{3.524.578}
574 \FibNum@temp{34}{5.702.887}
575 \FibNum@temp{35}{9.227.465}
576 \FibNum@temp{36}{14.930.352}
577 \FibNum@temp{37}{24.157.817}
578 \FibNum@temp{38}{39.088.169}
579 \FibNum@temp{39}{63.245.986}
580 \FibNum@temp{40}{102.334.155}
581 \FibNum@temp{41}{165.580.141}
582 \FibNum@temp{42}{267.914.296}
583 \FibNum@temp{43}{433.494.437}
584 \FibNum@temp{44}{701.408.733}
585 \FibNum@temp{45}{1.134.903.170}
586 \FibNum@temp{46}{1.836.311.903}
587 % \end{macrocode}
588 % \begin{macro}{\FibNum@max}
589 % \begin{macrocode}
590 \def\FibNum@max{46}
591 % \end{macrocode}
592 % \end{macro}
593 %
594 % \subsection{Macros for precalculating values}
595 %
596 % \begin{macro}{\fibnumPreCalc}
597 % \begin{macrocode}
598 \def\fibnumPreCalc#1{%
599 \expandafter\expandafter\expandafter
600 \FibNum@PreCalc\intcalcNum{#1}/%
601 }
602 % \end{macrocode}
603 % \end{macro}
604 % \begin{macro}{\FibNum@PreCalc}
605 % \begin{macrocode}
606 \def\FibNum@PreCalc#1/{%
607 \ifnum#1<\ltx@zero
608 \expandafter\FibNum@PreCalc\ltx@gobble#1/%
609 \else
610 \ifnum#1>\FibNum@max
611 \begingroup
612 \ltx@LocDimenA=#1sp\relax
613 \countdef\FibNum@i=255\relax
614 \FibNum@i=\FibNum@max\relax
615 \edef\FibNum@temp{%
616 \csname FibNum@\the\FibNum@i\endcsname/%
617 }%
618 \advance\FibNum@i by -1\relax
619 \edef\FibNum@temp{%
620 \FibNum@temp
621 \csname FibNum@\the\FibNum@i\endcsname
622 }%
623 \advance\FibNum@i\ltx@two
624 \iftrue
625 \expandafter\FibNum@PreCalcAux\FibNum@temp
626 \fi
627 \endgroup
628 \fi
629 \fi
630 }
631 % \end{macrocode}
632 % \end{macro}
633 % \begin{macro}{\FibNum@PreCalcAux}
634 % \begin{macrocode}
635 \def\FibNum@PreCalcAux#1/#2\fi{%
636 \fi
637 \edef\FibNum@temp{\BigIntCalcAdd#1!#2!}%
638 \global\expandafter
639 \let\csname FibNum@\the\FibNum@i\endcsname\FibNum@temp
640 \ifnum\FibNum@i=\ltx@LocDimenA
641 \xdef\FibNum@max{\the\FibNum@i}%
642 \else
643 \advance\FibNum@i\ltx@one
644 \expandafter\FibNum@PreCalcAux\FibNum@temp/#1%
645 \fi
646 }
647 % \end{macrocode}
648 % \end{macro}
649 %
650 % \subsection{Expandable calculations}
651 %
652 % \begin{macro}{\fibnum}
653 % \begin{macrocode}
654 \def\fibnum#1{%
655 \romannumeral
656 \expandafter\expandafter\expandafter\FibNum@Do\intcalcNum{#1}/%
657 }
658 % \end{macrocode}
659 % \end{macro}
660 % \begin{macro}{\FibNum@Do}
661 % \begin{macrocode}
662 \def\FibNum@Do#1/{%
663 \ifnum#1<\ltx@zero
664 \FibNum@ReturnAfterElseFiFi{%
665 \ifodd#1 %
666 \expandafter\expandafter\expandafter\ltx@zero
667 \else
668 \expandafter\expandafter\expandafter\ltx@zero
669 \expandafter\expandafter\expandafter-%
670 \fi
671 \romannumeral
672 \expandafter\FibNum@Do\ltx@gobble#1/%
673 }%
674 \else
675 \ifnum\FibNum@max<#1 %
676 \ltx@ReturnAfterElseFi{%
677 \expandafter
678 \FibNum@ExpCalc\number\expandafter\IntCalcInc\FibNum@max!%
679 \expandafter\expandafter\expandafter/%
680 \csname FibNum@\FibNum@max
681 \expandafter\expandafter\expandafter\endcsname
682 \expandafter\expandafter\expandafter/%
683 \csname FibNum@\expandafter\IntCalcDec\FibNum@max!%
684 \endcsname/%
685 #1%
686 }%
687 \else
688 \expandafter\expandafter\expandafter\ltx@zero
689 \csname FibNum@#1\expandafter\expandafter\expandafter\endcsname
690 \fi
691 \fi
692 }
693 % \end{macrocode}
694 % \end{macro}
695 % \begin{macro}{\FibNum@ReturnAfterElseFiFi}
696 % \begin{macrocode}
697 \def\FibNum@ReturnAfterElseFiFi#1\else#2\fi\fi{\fi#1}
698 % \end{macrocode}
699 % \end{macro}
700 % \begin{macro}{\FibNum@ExpCalc}
701 % \begin{macrocode}
702 \def\FibNum@ExpCalc#1/#2/#3/#4\fi{%
703 \fi
704 \ifnum#1=#4 %
705 \ltx@ReturnAfterElseFi{%
706 \expandafter\expandafter\expandafter\ltx@zero
707 \BigIntCalcAdd#2!#3!%
708 }%
709 \else
710 \expandafter\FibNum@ExpCalc
711 \number\IntCalcInc#1!%
712 \expandafter\expandafter\expandafter/%
713 \BigIntCalcAdd#2!#3!/%
714 #2/#4%
715 \fi
716 }
717 % \end{macrocode}
718 % \end{macro}
719 %
720 % \begin{macrocode}
721 \FibNum@AtEnd%
722 %</package>
723 % \end{macrocode}
724 %% \section{Installation}
725 %
726 % \subsection{Download}
727 %
728 % \paragraph{Package.} This package is available on
729 % CTAN\footnote{\CTANpkg{fibnum}}:
730 % \begin{description}
731 % \item[\CTAN{macros/latex/contrib/oberdiek/fibnum.dtx}] The source file.
732 % \item[\CTAN{macros/latex/contrib/oberdiek/fibnum.pdf}] Documentation.
733 % \end{description}
734 %
735 %
736 % \paragraph{Bundle.} All the packages of the bundle `oberdiek'
737 % are also available in a TDS compliant ZIP archive. There
738 % the packages are already unpacked and the documentation files
739 % are generated. The files and directories obey the TDS standard.
740 % \begin{description}
741 % \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}]
742 % \end{description}
743 % \emph{TDS} refers to the standard ``A Directory Structure
744 % for \TeX\ Files'' (\CTANpkg{tds}). Directories
745 % with \xfile{texmf} in their name are usually organized this way.
746 %
747 % \subsection{Bundle installation}
748 %
749 % \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the
750 % TDS tree (also known as \xfile{texmf} tree) of your choice.
751 % Example (linux):
752 % \begin{quote}
753 % |unzip oberdiek.tds.zip -d ~/texmf|
754 % \end{quote}
755 %
756 % \subsection{Package installation}
757 %
758 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
759 % \docstrip\ archive. The files are extracted by running the
760 % \xfile{.dtx} through \plainTeX:
761 % \begin{quote}
762 % \verb|tex fibnum.dtx|
763 % \end{quote}
764 %
765 % \paragraph{TDS.} Now the different files must be moved into
766 % the different directories in your installation TDS tree
767 % (also known as \xfile{texmf} tree):
768 % \begin{quote}
769 % \def\t{^^A
770 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
771 % fibnum.sty & tex/generic/oberdiek/fibnum.sty\\
772 % fibnum.pdf & doc/latex/oberdiek/fibnum.pdf\\
773 % fibnum.dtx & source/latex/oberdiek/fibnum.dtx\\
774 % \end{tabular}^^A
775 % }^^A
776 % \sbox0{\t}^^A
777 % \ifdim\wd0>\linewidth
778 % \begingroup
779 % \advance\linewidth by\leftmargin
780 % \advance\linewidth by\rightmargin
781 % \edef\x{\endgroup
782 % \def\noexpand\lw{\the\linewidth}^^A
783 % }\x
784 % \def\lwbox{^^A
785 % \leavevmode
786 % \hbox to \linewidth{^^A
787 % \kern-\leftmargin\relax
788 % \hss
789 % \usebox0
790 % \hss
791 % \kern-\rightmargin\relax
792 % }^^A
793 % }^^A
794 % \ifdim\wd0>\lw
795 % \sbox0{\small\t}^^A
796 % \ifdim\wd0>\linewidth
797 % \ifdim\wd0>\lw
798 % \sbox0{\footnotesize\t}^^A
799 % \ifdim\wd0>\linewidth
800 % \ifdim\wd0>\lw
801 % \sbox0{\scriptsize\t}^^A
802 % \ifdim\wd0>\linewidth
803 % \ifdim\wd0>\lw
804 % \sbox0{\tiny\t}^^A
805 % \ifdim\wd0>\linewidth
806 % \lwbox
807 % \else
808 % \usebox0
809 % \fi
810 % \else
811 % \lwbox
812 % \fi
813 % \else
814 % \usebox0
815 % \fi
816 % \else
817 % \lwbox
818 % \fi
819 % \else
820 % \usebox0
821 % \fi
822 % \else
823 % \lwbox
824 % \fi
825 % \else
826 % \usebox0
827 % \fi
828 % \else
829 % \lwbox
830 % \fi
831 % \else
832 % \usebox0
833 % \fi
834 % \end{quote}
835 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
836 % TDS installing feature, then some files can already be in the right
837 % place, see the documentation of \docstrip.
838 %
839 % \subsection{Refresh file name databases}
840 %
841 % If your \TeX~distribution
842 % (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh
843 % these. For example, \TeX\,Live\ users run \verb|texhash| or
844 % \verb|mktexlsr|.
845 %
846 % \subsection{Some details for the interested}
847 %
848 % \paragraph{Unpacking with \LaTeX.}
849 % The \xfile{.dtx} chooses its action depending on the format:
850 % \begin{description}
851 % \item[\plainTeX:] Run \docstrip\ and extract the files.
852 % \item[\LaTeX:] Generate the documentation.
853 % \end{description}
854 % If you insist on using \LaTeX\ for \docstrip\ (really,
855 % \docstrip\ does not need \LaTeX), then inform the autodetect routine
856 % about your intention:
857 % \begin{quote}
858 % \verb|latex \let\install=y\input{fibnum.dtx}|
859 % \end{quote}
860 % Do not forget to quote the argument according to the demands
861 % of your shell.
862 %
863 % \paragraph{Generating the documentation.}
864 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
865 % the documentation. The process can be configured by the
866 % configuration file \xfile{ltxdoc.cfg}. For instance, put this
867 % line into this file, if you want to have A4 as paper format:
868 % \begin{quote}
869 % \verb|\PassOptionsToClass{a4paper}{article}|
870 % \end{quote}
871 % An example follows how to generate the
872 % documentation with pdf\LaTeX:
873 % \begin{quote}
874 %\begin{verbatim}
875 %pdflatex fibnum.dtx
876 %bibtex fibnum.aux
877 %makeindex -s gind.ist fibnum.idx
878 %pdflatex fibnum.dtx
879 %makeindex -s gind.ist fibnum.idx
880 %pdflatex fibnum.dtx
881 %\end{verbatim}
882 % \end{quote}
883 %
884 % \printbibliography[
885 % heading=bibnumbered,
886 % ]
887 %
888 % \begin{History}
889 % \begin{Version}{2012/04/08 v1.0}
890 % \item
891 % First version.
892 % \end{Version}
893 % \begin{Version}{2016/05/16 v1.1}
894 % \item
895 % Documentation updates.
896 % \end{Version}
897 % \end{History}
898 %
899 % \PrintIndex
900 %
901 % \Finale
902 \endinput