I've recently been using XePersian to typeset Persian and Arabic poems the traditional way, i.e. in two justified columns. The poetry formatting is done with the bidipoem package, and that's all fine. It looks much better if kashidas are added to even the columns, which, as far as I know, is only possible right now via XePersian.

Anyway, the only thing I can't figure out, despite having combed the XePersian documentation, is how to get Latin (as opposed to the default Persian) page numbers. Any ideas? I know this is a specific and perhaps dumb question, but I can't seem to figure it out. Just for good measure, I'll copy my preamble below.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
Latin Text

etc. I included the last line to show that I'm entering the Latin text environment, which does a great job of switching to print everything except page numbers in Latin script.


  • 1
    A simple solution: \settextfont[Mapping={}]{fontname} Jun 27, 2012 at 9:37
  • 1
    If you only need Kashide from XePersian and nothing else, you can just use \makeatletter \input{kashida-xepersian.def}\makeatother. Both bidipoem and kashida-xepersian.def are independent of xepersian. Jun 27, 2012 at 9:47
  • Hazār tashakkor, Vafa! I think loading only the kashida part will be best for me, most of the time.
    – TSB
    Jun 27, 2012 at 22:19

2 Answers 2


You can redefine the plain page style:


A less intimidating way is obtained with fancyhdr:

\usepackage{fancyhdr} % must go before bidipoem


The first line must go before loading bidipoem, the rest can go anywhere else in the preamble.

Note: the warnings you get with \renewcommand{\thepage}{\lr{\arabic{page}}} are due to the fact that \lr is not expandable and are not innocuous: the bookmarks will be all wrong.

Therefore, as Vafa Khalighi suggests, a definition such as


might be preferred.

  • 1
    \renewcommand{\thepage}{\texorpdfstring{\lr{\arabic{page}}}{\arabic{page}}} Jun 27, 2012 at 9:34
  • @VafaKhalighi Thanks for the pointer. Is there a reason why \lr is not robust?
    – egreg
    Jun 27, 2012 at 9:48
  • Since \lr uses \LRE macro from bidi package, the question would be " Is there a reason why \LRE is not robust?". Well, I can not think of anyway to do that macro robuts, but if you have a suggestion, then I can apply your suggestion to bidi package. Jun 27, 2012 at 9:52
  • Also let me say that a lot of macros are not robust in the way you want it. An example is \textbf so what hyperref does is \let\textbf\@firstofone. Similarly a package like bidi and/or xepersian can (whenever hyperref is loaded) do \makeatletter \pdfstringdefDisableCommands{ \let\lr\@firstofone } ‎\makeatother Jun 27, 2012 at 9:59
  • 1
    @VafaKhalighi My point has little to do with hyperref; I was thinking to what's written in the aux file. Presently, \lr{1} becomes \pLRE{\latinfont 1} while with \protected\def\lr#1{...} only \lr{1} would be written.
    – egreg
    Jun 27, 2012 at 10:02

You just need to redefine \thepage to switch to the latin font. Based on Vafa's comment to egreg's answer, this should be done with:

  • 2
    Which, funnily enough, uses arabic numbers (unless the goal is to use roman numerals) ;-)
    – raphink
    Jun 27, 2012 at 4:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .