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?

  • Take a look to the link above (I think it answers your question. Is it?) – koleygr Sep 2 '17 at 22:37
  • @koleygr, this is different as it need to set the page number to an arabic alphabet character and not a number. – Sobhan Sep 2 '17 at 22:37
  • Ok.. Sorry thought it was a number... And I supposed to know what arabic numbers are ... – koleygr Sep 2 '17 at 22:39
  • 2
    Before the new \renewcommand\thepage use \clearpage. – Skillmon Sep 2 '17 at 22:40
  • 1
    Oh, and welcome to TeX.SX! – Skillmon Sep 2 '17 at 23:19
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}
  • 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 3 '17 at 0: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}
  • 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 3 '17 at 0:14
  • @Sobhan don't worry, I prefer his solution, too. – Skillmon Sep 3 '17 at 12:17

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.