I am working on a document using XeLaTeX and Polyglossia for typesetting Arabic/Persian text. I'm trying to set a specific font for numbers (0-9) while keeping the main font (Vazirmatn
) for Arabic/Persian characters.
Furthermore, I have defined my fonts as follows:
\documentclass{article}
\usepackage{polyglossia}
\usepackage{fontspec}
\setmainlanguage{farsi}
\newfontfamily\persianfont[Script=Arabic]{Vazirmatn}
\newfontfamily\persiandigitsfont[Scale=MatchUppercase]{TeX Gyre Pagella}
\setmainfont{Vazirmatn}
However, this doesn't seem to affect the numbers in my text. How can I tell Polyglossia to use \persiandigitsfont
for rendering numbers in my document while keeping \persianfont
for Arabic/Persian characters?
Minimal Working Example:
\documentclass{article}
\usepackage{polyglossia}
\usepackage{fontspec}
\setmainlanguage{english}
\setotherlanguage{persian}
\newfontfamily\persianfont[Script=Arabic]{Vazirmatn}
\newfontfamily\persiandigitsfont[Scale=MatchUppercase]{TeX Gyre Pagella}
\begin{document}
\begin{enumerate}
\item testing
\item still testing
\end{enumerate}
\begin{enumerate}
\begin{persian}
\item این نمونه فارسی است.
\item این نمونه فارسی است.
\end{persian}
\end{enumerate}
\end{document}
I appreciate any help or guidance on how to achieve this. Thank you!
P.S.: This is a follow-up of sorts to my previous question, as xepersian
fixes this, even for mixed language documents. Unfortunately, it introduces other issues and is generally not apt for documents mixing languages.
Also, a search has yielded two questions that seem to be mostly identical. One has not been answered yet, the other is beyond the scope, replacing digits in all fonts, if I am not mistaken.