Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
\documentclass[12pt,letterpaper]{article}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage{bidipoem}
\usepackage[Kashida]{xepersian}
\settextfont[Scale=1.4]{Scheherazade}
\setlatintextfont{Brill}
\begin{document}
\begin{latin}
Latin Text
\end{latin}
\end{document}

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.

Thanks!

share|improve this question
1  
A simple solution: \settextfont[Mapping={}]{fontname} –  Vafa Khalighi Jun 27 '12 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. –  Vafa Khalighi Jun 27 '12 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 '12 at 22:19

2 Answers 2

up vote 6 down vote accepted

You can redefine the plain page style:

\makeatletter
\def\ps@plain{%
  \let\@mkboth\@gobbletwo
  \let\@oddhead\@empty
  \def\@oddfoot{\reset@font\hfil\lr{\arabic{page}}\hfil}%
  \let\@evenhead\@empty
  \let\@evenfoot\@oddfoot}
\makeatother
\pagestyle{plain}

A less intimidating way is obtained with fancyhdr:

\usepackage{fancyhdr} % must go before bidipoem

\fancypagestyle{plain}{%
  \fancyhf{}%
  \renewcommand{\headrulewidth}{0pt}%
  \fancyfoot[C]{\lr{\arabic{page}}}%
}
\pagestyle{plain}

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

\renewcommand{\thepage}{\texorpdfstring{\lr{\arabic{page}}}{\arabic{page}}}

might be preferred.

share|improve this answer
1  
\renewcommand{\thepage}{\texorpdfstring{\lr{\arabic{page}}}{\arabic{page}}} –  Vafa Khalighi Jun 27 '12 at 9:34
    
@VafaKhalighi Thanks for the pointer. Is there a reason why \lr is not robust? –  egreg Jun 27 '12 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. –  Vafa Khalighi Jun 27 '12 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 –  Vafa Khalighi Jun 27 '12 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 '12 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:

\renewcommand{\thepage}{\texorpdfstring{\lr{\arabic{page}}}{\arabic{page}}}
share|improve this answer
2  
Which, funnily enough, uses arabic numbers (unless the goal is to use roman numerals) ;-) –  ℝaphink Jun 27 '12 at 4:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.