I'm using xepersian for my article but in one page I need to add Gregorian calendar date. so I add:
\usepackage[british]{babel}
and then where I want the date:
\selectlanguage{british}
{\large \today}
butthen where ever I use today it writes Gregorian instead of persian (still in persian but uses Gregorian calender) and figure caption texts (like Fig.) is in english instead of persian.
EDIT:
\documentclass[14pt,a4paper]{article}
%\usepackage[british]{babel}
\usepackage{enumerate}
\usepackage{xepersian}
\settextfont{XB Niloofar}
\begin{document}
\today
\end{document}
Like this the printed date is from persian calendar like this (reads 16th of khordad 1393):
but when I uncomment that line it will be english language in persian like this(reads 6th of june 2014):
Best Answer
Two things up front:
XePersian
is relying on theXeTeX
engine, I would recommend usingpolyglossia
instead ofbabel
.article
document class cannot use the14pt
option; for more information, take a look at this answer.The Problem in your case is that
XePersian
clearly changes all western numerals (123) into genuine Arabic numerals (١٢٣), even though theXB Niloofar
font contains both. Therefore, you need to tellXeTeX
to use a different font thanXePersian
uses with\settextfont
. If you do not specify a different font,XePersian
will be used for typesetting, which will of course substitute the numerals.First, of course, you need to tell
XeTeX
there is another language besides Farsi. You should usepolyglossia
to set this up:\setotherlanguage[]{english}
. Then you must tellpolyglossia
to use a different font for all English text with\newfontfamily\englishfont{XB Niloofar}
. This can of course be the exact same typeface as yourXePersian
\settextfont
, but this time, it will not go throughXePersian
and thusly use the correct number forms. In the document, use\textenglish{}
or\begin{english}
to switch to an English environment.Using the above suggestions will yield the following MWE:
which gives this output:
On a side note, setting
\setdefaultlanguage[]{farsi}
, which would be normal practice withpolyglossia
, does not work, because it clashes withXePersian
, therefore it is commented out here but you are welcome to delete it.