I would like to page number my document using base 12 but also to number AMS theorems, sections, equations… the same way. What would be the best solution?

I found this working code to use binary for page numbering:

\usepackage{expl3}
\ExplSyntaxOn
\renewcommand\thepage{\int_to_bin:n{\value{page}}}
\ExplSyntaxOff

Maybe should I use the dozenal package in some way. Thank you in advance.

enter image description here

\documentclass{article}

\makeatletter
\def\btwelve#1{\expandafter\@btwelve\csname c@#1\endcsname}
\def\@btwelve#1{\ifnum#1>11
\@btwelve{\numexpr(#1-6)/12\relax}%
\btwelvedigits{\numexpr#1-((#1-6)/12)*12\relax}\else
\btwelvedigits{#1}%
\fi}

\def\btwelvedigits#1{\ifcase\numexpr#1\relax 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or A\or B\or[\number#1]\fi}
\begin{document}

{\renewcommand\thepage{\btwelve{page}}

\setcounter{page}{5} \thepage

\setcounter{page}{10} \thepage

\setcounter{page}{11} \thepage

\setcounter{page}{12} \thepage

\setcounter{page}{17} \thepage

\setcounter{page}{18} \thepage

\setcounter{page}{19} \thepage

\setcounter{page}{24} \thepage

\setcounter{page}{25} \thepage

}
\end{document}

This can easily be adapted to any base *just replace 11, 12 and 6 in the calculation).

Same idea as in the question using a flexible base:

\usepackage{expl3}
\ExplSyntaxOn
\renewcommand\thepage{\int_to_Base:nn{\value{page}}{12}}
\ExplSyntaxOff
  • Do you know how to extend this to AMS theorems counters? – Suponell Jun 24 at 11:14

\usepackage[typeone]{dozenal} will do that for you: all standard counters are redefined to use the special symbols (compatible with Computer Modern fonts).

  • Thanks! It works very well for standard counters but nor for AMS theorems. – Suponell Jun 24 at 11:18

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.