2

After some update (bidi,latex,xetex,...) I'm facing problem in numbers with . or - which is not happening previously, numbering direction is correct with maghrib form 0,1,2,...,9 but with mashriq form ٠,١,٢,٣,٤,٥,٦,٧,٨,٩ direction of numbering do not change with command (\setlatin - \setnonlatin)

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{bidi}
\setmainfont[Script=Arabic]{Amiri}
\parindent=0pt

\begin{document}

\setRTL
\setnonlatin

\section{text}
\subsection{text text}
\subsection{text text}

1.23 % change direction with \setnonlatin - \setlatin 

١.٢٣ <-- % do not change direction with \setnonlatin - \setlatin


\hrulefill

\setlatin

1.23

١.٢٣

\end{document}

enter image description here

From log file

This is XeTeX, Version 3.14159265-2.6-0.999991 (TeX Live 2019/W32TeX) (preloaded format=xelatex 2019.10.16) 3 NOV 2019

Package: bidi 2019/10/19 v35.10 Bidirectional typesetting in plain TeX and LaTeX

2

The code as posted contains Unicode 0661, 0662, 0663. This is Arabic-Indic Digit One and Two and Three. However, bidi checks for 06F1 to 06F9, which is Extended Arabic-Indic Digit one to nine. So change those in the source and it works as expected.

MWE:

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{bidi}
\setmainfont[Script=Arabic]{Amiri}
\parindent=0pt

\begin{document}

\setRTL
\setnonlatin

\section{text}
\subsection{text text}
\subsection{text text}
1.23\par % change direction with \setnonlatin - \setlatin 
١.٢٣ <-- \par % Arabic Indic Digits do not change direction with \setnonlatin - \setlatin
۱.۲۳ \par % Extended Arabic-Indic Digits
\hrulefill

\setlatin
1.23 \par
١.٢٣ \par
۱.۲۳ \par

\end{document}

Result:

enter image description here

Alternatively, you can add the non-extended Arabic-Indic digits to the digits charclass:

\usepackage{bidi}
\makeatletter
\bidi@digits=1633 \loop \XeTeXcharclass \bidi@digits \bidi@digits@charclass \ifnum\bidi@digits<1641 \advance\bidi@digits \@ne \repeat
\makeatother
\setmainfont[Script=Arabic]{Amiri}

enter image description here

  • Thanks, I think this needs to be added to bidi. – Salim Bou Nov 4 '19 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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