I want page 13 to show up as 12+1

I am writing an important document which has ended up being 13 pages.

For superstitious reasons, I want the page number on the last page to show up as "12+1". In other words, I want the page numbers to be: 1, 2, …, 11, 12, 12+1.

How do I do this?

• But you wrote »13« here yourself! Beware! – Keks Dose Sep 11 '18 at 13:27
• And the question is currently at 13 upvotes, I like to imagine this isn't a coincidence. – LiefdeWen Sep 11 '18 at 13:38
• @jfbu Update from a multi-stack user: This is on the HNQ. – FoxElemental Sep 12 '18 at 21:14
• @LiefdeWen You comment got 12 upvotes, so I upvoted it myself again, else nobody will dare. – user4686 Sep 18 '18 at 13:06

Define a new counter format:

\documentclass{article}

\usepackage{kantlipsum} % for mock text

\makeatletter
\newcommand{\fixedarabic}[1]{%
\expandafter\@fixedarabic\csname c@#1\endcsname
}
\newcommand{\@fixedarabic}[1]{%
\ifnum#1=13 12${}+{}$1\else\number#1\fi
}
\makeatother

\pagenumbering{fixedarabic}

\begin{document}

\kant[1-50]

\end{document}


• 12+1 is much to obvious. I suggest $\sum_{i=1}^5 i -3$. – Ulrike Fischer Sep 11 '18 at 10:18
• For my own understanding, could you comment on the differences between defining a new counter format and only redefining \thepage as follows: \renewcommand{\thepage}{\ifnum13=\value{page}12+1\else\the\value{page}\fi}? (The latter also works.) – Max Sep 11 '18 at 10:25
• @Max More general. – egreg Sep 11 '18 at 10:28
• Many thanks! This worked. It was my first time posting a question here and I am amazed how quickly help came. Thank you all! – Amir Ali Ahmadi Sep 11 '18 at 10:49
• @NieDzejkob No, to 12, which is different from 13 anyhow. ;-) – egreg Sep 11 '18 at 14:50

It could be a complex solution to convert the counter page to "12+1" if the value reach 13, but if only matter when 13 is the last page, why not simply change the footer just before \end{document} to "12+1"?.

\documentclass{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\begin{document}
aaa
\setcounter{page}{12} % this is the 12th page
\newpage
bbb
\cfoot{12+1} % this is the 12+1th page
\end{document}

• Thank you very much -- this is a quick solution too. The fancy page style created issues for me elsewhere, so I decided to go with the other proposed solution. Many thanks everyone. – Amir Ali Ahmadi Sep 11 '18 at 10:50
• @AmirAliAhmadi the fancyhdr package allow a ex­ten­sive con­trol of page head­ers and foot­ers so that issues probably can be solved with no effort, or maybe the footer can be fixed by another method without that package, but without a minimal working example showing these issues is not possible go further. – Fran Sep 11 '18 at 11:07

The following solution sets page 13 as 12+1 in whichever format your page numbering is set to. It uses fancyhdr to set the page number in the Centre of the footer.

\documentclass{article}

\usepackage{lipsum,fancyhdr}

\pagestyle{fancy}
\fancyfoot[C]{%
\ifnum\value{page}=13
$\mbox{\setcounter{page}{12}\thepage} + \mbox{\setcounter{page}{1}\thepage}$%
\setcounter{page}{13}%
\else
\thepage
\fi
}

\pagenumbering{roman} % Just as an example

\begin{document}

\sloppy\lipsum[1-50]\lipsum[1-50]

\end{document}