[Tex/LaTex] Page Numbering Using Only Fibonacci Numbers

calculationspage-numbering

How to display the page number in Fibonacci.
Example:
Normal page number 1, 2, 3, 4, 5, 6, 7, 8,…

Fibonnacci page number style: 1, 1, 2, 3, 5, 8, 13, …

Best Answer

Package fibnum helps:

\usepackage{fibnum}
\renewcommand*{\thepage}{\fibnum{\value{page}}}

Full example:

\documentclass{article}
\usepackage{fibnum}
\renewcommand*{\thepage}{\fibnum{\value{page}}}
\begin{document}
\newcommand*{\test}{%
  \begin{tabular}{ll}
    Page value: & \the\value{page}\\
    \texttt{\textbackslash thepage}: & \thepage
  \end{tabular}%
  \newpage
}
\test
\test
\test
\test
\test
\test
\test
\test
\test
\end{document}

If the number of pages is large (>> 46), then \fibnumPreCalc should be used to get a more efficient \fibnum. \fibnum must calculate the numbers each time, unless the values are calculated in advance via \fibnumPreCalc. Example:

\documentclass{article}

\usepackage{fibnum}
\renewcommand*{\thepage}{\fibnum{\value{page}}}

\usepackage{atbegshi}
\AtBeginShipout{%
  \fibnumPreCalc{\value{page}}%
}

\begin{document}
\newcommand*{\test}{%
  \begin{tabular}{ll}
    Page value: & \the\value{page}\\
    \texttt{\textbackslash thepage}: & \thepage
  \end{tabular}%
  \newpage
}
\test
\test
\test
\test
\test
\test
\test
\test
\setcounter{page}{200}
\test
\end{document}

Table in last page:

Result 200

The package fibnum calculates and stores the first 46 Fibonacci numbers, because these numbers also fit into a TeX count register. However the numbers are not limited by this, as the previous example has shown. Above this value package fignum switches its calculation method by using the expandable operations for big integers of package bigintcalc.

Related Question