1

For some pages in a book document, I need to manually set the page number to an arabic alphabet character.

For example, The first page of my document should have آ as its page number, and second page should be ب and third page should be ج.

I don't need the page numbers to be automatically set as the pages with this format are 5 or 6 at most. So manually setting them would work but I can't find any command which allows me to set alphabet characters for a specific page.

Please note that, I don't want to set the page numbers to arabic numbers as suggested here with this command : \renewcommand{\thepage}{\arabic{page}}. I need to set the page number to an arabic alphabet character such as آ or د.

What I've Tried:

  • \renewcommand\thepage{آ} : I've tried doing this before every page that I want to manually set but as soon as I do another \renewcommand\thepage{ب} for the next page, then the first page number is overwritten to ب.
  • \setcounter{page}{آ}: this obviously won't work as it excepts a number and not an alphabet character.

So, is there a way to manually set the page number of specific pages to arabic alphabet characters?

Sobhan
  • 113

2 Answers2

4

The following example defines \arabicalph as number formatting command like \arabic or \alph (see latex.ltx). Then, the numbering style can be easily switched by \pagenumbering{arabicalph}:

\documentclass[a5paper]{article}
\usepackage{lipsum}

\usepackage{fontspec}
\setmainfont{FreeSerif}

\makeatletter
\newcommand*{\@arabicalph}[1]{%
  \ifcase#1%
  \or
    آ%
  \or
    ب%
  \or
    ج%
  % ...
  \else
    \@ctrerr
  \fi
}
\newcommand*{\arabicalph}[1]{%
  \expandafter\@arabicalph\csname c@#1\endcsname
}
\makeatother

\begin{document}
\pagenumbering{arabicalph}
\lipsum
\end{document}
Heiko Oberdiek
  • 271,626
  • Amazing! This answer also works great in a case when Table of Contents could have multiple pages and you want the page number to go to the next letter in the alphabet on each page. – Sobhan Sep 03 '17 at 00:15
2

Just use a \clearpage before the next page begins.

\documentclass[]{article}

\usepackage{blindtext}

\begin{document}
\renewcommand{\thepage}{Z}
\blindtext
\clearpage
\renewcommand{\thepage}{Y}
\blindtext
\clearpage
\pagenumbering{arabic}
\blinddocument
\end{document}
Skillmon
  • 60,462
  • 2
    Although this solution worked perfectly and I didn't ask for anything more in the question, I went with @Heiko's solution as it solved the case when Table of Contents could have multiple pages and you want the page number to go to the next letter in the alphabet on each page. – Sobhan Sep 03 '17 at 00:14
  • @Sobhan don't worry, I prefer his solution, too. – Skillmon Sep 03 '17 at 12:17