[Tex/LaTex] Custom page numbering for appendix

appendicespage-numbering

For an appendix I want a page numbering which goes like A1, A2, …

How to do that? With \pagenumbering{...} I can only choose between arabic and roman numbering.

Best Answer

You can change the "appearance" of the page counter by redefining \thepage. Here's a solution that simply adds "A":

\documentclass{article}

\usepackage{lipsum}

\begin{document}

\section{foo}

\lipsum

\clearpage
\pagenumbering{arabic}% resets `page` counter to 1
\renewcommand*{\thepage}{A\arabic{page}}
\appendix

\section{appfoo}

\lipsum

\end{document}

For the book and report class, you may consider to add a page number prefix according to the apendix chapter "number" ("A", "B", ...). In the following example, the etoolbox package is used to prepend the definition of \chapter at the start of the appendix:

\documentclass{report}

\usepackage{etoolbox}

\usepackage{lipsum}

\begin{document}

\chapter{foo}

\lipsum

\appendix
\pretocmd{\chapter}{%
  \clearpage
  \pagenumbering{arabic}%
  \renewcommand*{\thepage}{\thechapter\arabic{page}}%
}{}{}

\chapter{appfoo}

\lipsum

\chapter{appbar}

\lipsum

\end{document}