# Numbers in multi-language document

When I use two different languages like English and Arabic (one is written form left to right and the other is written from right to left), the equation numbers are written in Arabic, e.g. 14, but when I use \ref it returns 41. I tried \textRL, but the format of the number changes from Arabic to English. So I need all numbers in the document to be written in the same format (English or Arabic), any suggestion please? I use this code.

\documentclass[]{article}
\usepackage[utf8]{inputenc}
\usepackage[english,arabic]{babel}
\usepackage[LAE]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
نبين فلتحكم الكلي يما يلي قانون
% here there are equations more than ten

$$\label{eq:lyap_tot} \color{blue}{\boxed{\color{black}u=u_\theta-u_x}}$$

figure \ref{lyap_tot} shows ... % here the returned number is written in arabic
% but from left to right ( the real number is 14 and the retunred number is 41)
\end{document}

• Hi and welcome to the site. Can you post a minimal document that shows the problem. It should be a complete document, but with just enough code to show us what you're doing (no extra packages) and shows the problem. See I've just been asked to write a minimal example, what is that?. Jul 4, 2016 at 20:48
• @AlanMunn add the minimal document that shows the problem Jul 7, 2016 at 16:28
• From the looks of this document, your main document is in Arabic. Do you want your equation numbers to be in Arabic or English? I would recommend you use XeLaTeX and polyglossia instead. If this is acceptable I can post a solution. Jul 7, 2016 at 17:21
• @AlanMunn yes the main document is in Arabic, but I need English for scientific expressions. It is acceptable to use XeLateX Jul 8, 2016 at 11:16

Here your code with polyglossia which require XeLaTeX engine

• First you set default language with \setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}, option numerals=maghrib for arabic form of numerals 1, 2, 3, .... in opposite to numerals=machriq for Indian form ٣ ٢ ١ .....
• Define other languages on your document with \setotherlanguage{english}
• Define font for arabic script with \newfontfamily\arabicfont[Script=Arabic]{Name_of_font}

Code

\documentclass{article}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{polyglossia}

\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\newfontfamily\englishfont{Amiri}
\parindent 0pt
\begin{document}
نبين فلتحكم الكلي يما يلي قانون

\setcounter{equation}{13}

$$\label{eq:lyap_tot} \color{blue}{\boxed{\color{black}u=u_\theta-u_x}}$$

\begin{english}
equation \ref{eq:lyap_tot} shows .....
\end{english}

المعادلة
\ref{eq:lyap_tot}
تبين أن ......

\end{document}


Result

• Thanks Salim. I was going to post this answer too, but I'm much happier to see it coming from you. :) Jul 8, 2016 at 16:09