# Problem with numbering equations when using Arabic as the main language

The following code prevents the number of the equation from appearing.

\documentclass{book}

\usepackage{amsmath}

\usepackage{polyglossia}

\setdefaultlanguage[numerals=maghrib, calendar=gregorian]{arabic}

\newfontfamily\arabicfont[Script=Arabic, Scale=1.1, WordSpace=2]{Amiri}

\setotherlanguage{english}

\begin{document}

$$X=Y$$

\end{document}


The problem disappears when switching English with Arabic; that is when taking English as the main language. Also, the problem disappears when one removes [Script=Arabic]; but this makes a disaster if one includes an Arabic text.

Sorry if the question is not well edited. Thanks in advance.

• I don't have Amiri font but tried another font and got no error (but I can not read arabic) do you get a tex error? if so please add the exact error message from the log into your question, use the {} button to mark as a code section so lines are preserved – David Carlisle Jan 5 '17 at 20:27
• Can you add an image showing result after compiling – Salim Bou Jan 5 '17 at 20:37
• @ David Carlisle : It does not seem that on the chosen Arabic font; I tried with three others, and get the same result. – Yassine Guerboussa Jan 5 '17 at 20:59
• @Salim Bou: I don't know how to add an image; though when compiling the parenthese "(" appears instead of the number. – Yassine Guerboussa Jan 5 '17 at 21:04
• I edited your question parenthesis appears like this or without numbers? – Salim Bou Jan 5 '17 at 21:25

I used a different font and saw 1)( as shown in Salim's image. The following forced the () to appear in LTR order using this font but possibly won't work for you (I'll delete if not)

\documentclass{book}

\usepackage{amsmath}

\usepackage{polyglossia}

\setdefaultlanguage[numerals=maghrib, calendar=gregorian]{arabic}

\setotherlanguage{english}

\makeatletter

\def\tagform@#1{\maketag@@@{\selectlanguage{english}(\ignorespaces#1\unskip\@@italiccorr)}}
\makeatletter

\begin{document}

$$X=Y$$

\end{document}

• Yes, it works; I'm really thankful. Can you please add a comment on the main source of the problem; anyway, I don't need such an explanation to be happy! – Yassine Guerboussa Jan 5 '17 at 22:41
• @YassineGuerboussa I couldn't trace exactly where it went wrong but )( is basically () but typeset in the wrong direction so I forced \setlanguage{english} into the macro that prints the number (apart from that it is the standard definition) which persuaded it to print left to right. – David Carlisle Jan 5 '17 at 22:50