# Duodecimal chapters, sections etc

Thanks to duodecimal page number I don't have to ask how to get duodecimal page numbers and I managed to get duodecimal chapter numbers with that method too. But how do I change the sections, subsections, … to be also shown in duodecimal values?

    \usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\basetwelve}{m}
{ \duodec_convert:n { #1 } }

\tl_new:N \l_duodec_string_tl
\cs_new_protected:Npn \duodec_convert:n #1
{
\tl_set:Nx \l_duodec_string_tl { \int_to_base:nn { #1 } { 12 } }
\tl_replace_all:Nnn \l_duodec_string_tl { a } { ↊ } %I use XeLaTex, so these sings are no problem at all ;)
\tl_replace_all:Nnn \l_duodec_string_tl { b } { ↋ }
\tl_use:N \l_duodec_string_tl
}
\ExplSyntaxOff

\renewcommand{\thepage}{\basetwelve{\arabic{page}}}
\renewcommand{\thepart}{\basetwelve{\arabic{part}}}
\renewcommand{\thechapter}{\basetwelve{\arabic{chapter}}}
\renewcommand{\thesection}{\basetwelve{\arabic{section}}}


This leads to sections numbered without the chapter number (1,2,3 instead of 5.1,5.2,5.3...). How do I get the standard numbering just with duodecimal values? I tried it with

\makeatletter
\renewcommand*{\p@section}{\thechapter.}
\renewcommand*{\p@subsection}{\p@section}
\renewcommand*{\p@subsubsection}{\p@section}
\renewcommand*{\p@paragraph}{\p@section}
\renewcommand*{\p@subparagraph}{\p@section}
\makeatother


To be clear, I want all automatic numbering (pages, chapters etc, pictures, tables…) to be in duodecimal values in the end, without changing the format. Thank you!

• \renewcommand{\thesection}{\thechapter.\basetwelve{\arabic{section}}} – David Carlisle Dec 23 '18 at 9:51
• Wow! That was too easy, thank you! I kind of tried the same but because the "." turned blue like it combined with \thechapter, I inserted a space (\thechapter .) which seemed to corrupt everything and a huge load of errors appeared. Now that I deleted the space it works! Thanks a lot!!! – DonMeles Dec 23 '18 at 10:56
• \thechapter. and \thechapter . are identical input to TeX (the space is not tokenised so the definitions would be identical whether or not there is a space, not just act the same way – David Carlisle Dec 23 '18 at 11:09
• feel free to post a full working answer:-) – David Carlisle Dec 23 '18 at 11:11

Thank you, David, for your Help! The solution is way easier than I thought.

To get the solution I was looking for you need the following code:

\documentclass[11pt,a4paper,final]{book}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{graphicx} % I need this to rotate my numbers...
\usepackage{xparse} % this is the magic package...
\ExplSyntaxOn % for the missing numbers after 9 the package uses "a" and "b",
% but I want to use "↊" and "↋" as defined by the Dozenal
% Society of Great Britain. The following lines do that for me:

\NewDocumentCommand{\basetwelve}{m}
{ \duodec_convert:n { #1 } }

\tl_new:N \l_duodec_string_tl
\cs_new_protected:Npn \duodec_convert:n #1
{
\tl_set:Nx \l_duodec_string_tl { \int_to_base:nn { #1 } { 12 } }
\tl_replace_all:Nnn \l_duodec_string_tl { a } { \rotatebox[origin=c]{180}{2} }
% I rotate the numbers, because standard fonts don't contain ↊ and ↋.
\tl_replace_all:Nnn \l_duodec_string_tl { b } { \rotatebox[origin=c]{180}{3} }
\tl_use:N \l_duodec_string_tl
}
\ExplSyntaxOff % I got this code from the related question linked above.

\renewcommand{\thepage}{\basetwelve{\arabic{page}}}
\renewcommand{\thepart}{\basetwelve{\arabic{part}}}
\renewcommand{\thechapter}{\basetwelve{\arabic{chapter}}}
% No problems so far...
% This is how you get numbering formatted as chapter.section:
\renewcommand{\thesection}{\thechapter.\basetwelve{\arabic{section}}}
\renewcommand{\thesubsection}{\thesection.\basetwelve{\arabic{subsection}}}
% Dont put \thechapter here, it is already contained in \thesection!!!
\renewcommand{\thefigure}{\basetwelve{\arabic{figure}}}
% As I told you, I wanted to change the figcaptions too.
% But I don't need the chapter's number here.
\renewcommand{\labelenumi}{\basetwelve{\arabic{enumi}}.}
% And this is my first dozenal enumeration with a dot behind the number.

%let's see, if it works:
\begin{document}
\part{Quick demonstration}
\chapter{Here we go!}
Just scroll down...
\chapter{I}
\chapter{need}
\chapter{lots}
Whoops, nearly there...
\newpage
On this and on the following page you see the dozenal page numbers!
\chapter{of}
See? It works!
\chapter{pages}
\chapter{and}
\chapter{chapters}
\chapter{for}
\chapter{dozenal}
This is the dozenal number  \rotatebox[origin=c]{180}{2}, equal to $10_{(10)}$.
\chapter{numbers.}
This is the second dozenal number: \rotatebox[origin=c]{180}{3}, it is just a turned 3 and equal to $11_{(10)}$.
\section{What are these symbols?!}
I use fonts like Times New Roman, they have symbols like \rotatebox[origin=c]{180}{2} and \rotatebox[origin=c]{180}{3} integrated as Unicode glyphs U+218A and U+218B. They are just rotated numbers too, basicly. These numbers are defined by the Dozenal Society of Great Britain and I like them. If you complie with XeLaTeX you can just copy and paste these signs: ↊ and ↋ (in this font they will probably be invisible).

\section{Why so many chapters?}
I need more than 12 pages and chapters for the numbers  \rotatebox[origin=c]{180}{2} and \rotatebox[origin=c]{180}{3} to appear.

\section{Enumeration}
\begin{enumerate}
\item Just
\item a
\item very
\item short
\item demonstration
\item of
\item a
\item dozenal
\item enumeration
\item for
\item you
\item to
\end{enumerate}
\section{Just a random section}
\subsection{with a subsection}
\subsubsection{and a subsubsection}
These all work just finde with dozenal numbers aswell but I think the code is already long enough. And as you see, subsubsections usually don't have numbers at all.
\end{document}


Now my entire document uses the duodecimal system and I feel like it's already Christmas. Thanks!!!