XeTeX – How to Display Page Numbers in Hindi

arabicpage-numberingright-to-leftxetex

I have a document written with a majority Arabic text and few English text. The page numbers as seen in the output appeared in Arabic (1,2,3,etc) numbers instead of the desired Hindi numbers as appeared in the first sentence of the body text part in the output.

How to fix that?

Note:
I would be grateful also if someone would help me indent the English text inside the Arabic environment to the left instead of being on the right as seen in the output.

MWE Code

\documentclass[oneside,18pt]{scrartcl} 
\usepackage{fontspec}
\newfontfamily\arabicfont[Script=Arabic]{Amiri} 
\usepackage{arabxetex}
%=====================End of Preamble ===================================
\begin{document}
\begin{arab}[voc]
\bigskip

هنا  مجمل النص باللغة العربية، ثم مجموعة ارقام باللغة العربية: 1، 2، 3، الخ. ارقام الصفحات ليست كهذه الارقام، ما الذي ينبغي عمله لكي تظهر ارقام الصفحات بهذا الشكل ايضا؟
رقم الصفحة ظهر كارقام هندي.

\noindent\textLR{1, 2, 3, etc are called Arabic numbers, while the numbers above are called Hindi numbers.}

\end{arab}
\end{document}  

MWE Output [body text part]
enter image description here

MWE Output [page number part]
enter image description here

Best Answer

You can escape the arab environment to return to the English typesetting rules.

I usually use polyglossia package to handle that for me, but we can redefine \thepage by ourselves and add Mapping=arabicdigits among other \arabicfont options.

\documentclass[oneside,18pt]{scrartcl} 
\usepackage{fontspec}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri} % arabicdigits devanagaridigits bengalidigits farsidigits thaidigits
\usepackage{arabxetex}
\renewcommand{\thepage}{\arabicfont\arabic{page}}
\addtocounter{page}{122}
\parindent=0pt
%\addtolength{\textheight}{-7.5in} % For purpose of the post.
\begin{document}
\begin{arab}[voc]
هنا  مجمل النص باللغة العربية، ثم مجموعة ارقام باللغة العربية: 1، 2، 3، الخ. ارقام الصفحات ليست كهذه الارقام، ما الذي ينبغي عمله لكي تظهر ارقام الصفحات بهذا الشكل ايضا؟
رقم الصفحة ظهر كارقام هندي. 
\end{arab}
1, 2, 3, etc are called Arabic numbers, while the numbers above are called Hindi numbers.
\end{document}  

mwe