# Page numbering with babylonian numerals

I'm trying to use page numbering with babylonian numerals using Santakku font. The code bellow works only without the \tableofcontents command. Using it, the following error happens:

! Missing control sequence inserted.
<inserted text>
\inaccessible
l.1 ...\global \c@workm@mctr \c@page \relax \let }

?


I'm using MiKTeX Portable 2.9.6361, updated with the Update MiKTex tool.

Thanks.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{babyloniannum}
\renewcommand*{\thepage}{%
\ifcase\value{page}%
0%
\else
\ifnum\value{page}>0 %
\LARGE\babyloniannum{\value{page}}%
\else
0%
\fi
\fi
}
\begin{document}
\tableofcontents

\section{My document}\

text

\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\end{document}

• Welcome to TeX.SE. Where can we find the babyloniannum package? And why do you have those  after the \section macros? – user31729 Aug 27 '17 at 20:40
• The babyloniannum package was automatically downloaded when compiling (but it is also here ctan.org/pkg/babyloniannum). The various \sections is only for testing the table of contents and the \ after them are for making a indented paragraph (in portuguese). – user142202 Aug 27 '17 at 21:00
• It is not on TL 2017 however ... And I don't want to download extra fonts for this in order to test – user31729 Aug 27 '17 at 21:02

The command is not robust. You should protect it so that it doesn't break on the way to the toc:

\documentclass{article}
\usepackage{babyloniannum}

\makeatletter
\renewcommand*{\thepage}{%
\ifcase\value{page}%
0%
\else
\ifnum\value{page}>0 %
\protect\Large\protect\babyloniannum{\the\c@page}%
\else
0%
\fi
\fi
}
\begin{document}
\tableofcontents

\section{My document}\

text

\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\newpage
\section{test}\
\end{document}