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?
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?
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}
\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
$\sum a+b = b+\sum a$.
– yo'
Sep 12 '18 at 09:00
\thepage for testing with \ifnum: what if we're under \pagenumbering{roman}? Heiko Oberdiek's answer to the first listed question in the link clarifies this.
– egreg
Sep 12 '18 at 09:06
\ifodd to prevent such misuse rather than giving a wrong result on only one page of the document (\relax\ifnum#1... should do it).
– Henri Menke
Sep 12 '18 at 09:09
\def\fi{\mathop{fi}} in order to define a math operator, they're on their own. Using wrong tools can lead to harm oneself. A way out could be using $12+1$, but this could lead to page numbers being printed differently from the rest of the document; $\mbox{12}+\mbox{1}$ seems to me quite clumsy.
– egreg
Sep 12 '18 at 09:15
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}
Many thanks everyone.
– Amir Ali Ahmadi Sep 11 '18 at 10:50fancyhdr package allow a extensive control of page headers and footers 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}
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% Remove header rule
\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}