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?

  • 1
    Welcome to TeX.SX! Please help us help you by providing a minimal compilable code example (MWE). – TeXnician Sep 11 '18 at 10:10
  • 10
    But you wrote »13« here yourself! Beware! – Keks Dose Sep 11 '18 at 13:27
  • 13
    And the question is currently at 13 upvotes, I like to imagine this isn't a coincidence. – LiefdeWen Sep 11 '18 at 13:38
  • 1
    @jfbu Update from a multi-stack user: This is on the HNQ. – FoxElemental Sep 12 '18 at 21:14
  • 1
    @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:


\usepackage{kantlipsum} % for mock text

  \expandafter\@fixedarabic\csname c@#1\endcsname
  \ifnum#1=13 12${}+{}$1\else\number#1\fi





enter image description here

  • 22
    12+1 is much to obvious. I suggest $\sum_{i=1}^5 i -3$. – Ulrike Fischer Sep 11 '18 at 10:18
  • 2
    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
  • 1
    @Max More general. – egreg Sep 11 '18 at 10:28
  • 6
    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
  • 1
    @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"?.

\setcounter{page}{12} % this is the 12th page
\cfoot{12+1} % this is the 12+1th page 
  • 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
  • 1
    @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.

enter image description here



\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% Remove header rule
   $\mbox{\setcounter{page}{12}\thepage} + \mbox{\setcounter{page}{1}\thepage}$%

\pagenumbering{roman} % Just as an example




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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