1

I don't know how to make the numbers in the itemize environment appear correctly, after the ninth question, the numbers flip as in the picture, so I have 01 instead of 10 and 21 instead of 12, and so on.

I think this is because I'm using the Arabic language but I don't know how to fix it.

Here is a part of my code

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[LAE,T1]{fontenc}
\usepackage[arabic,english]{babel}
\usepackage{amsmath}
\usepackage[margin=3.0cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}

\rhead{  \selectlanguage{arabic}{فيزياء عامة}    \selectlanguage{english}
2
 }
\chead{\LARGE  \selectlanguage{arabic}{تمارين}    \selectlanguage{english}
3}

\lhead{ 1441/06/12}
\renewcommand{\headrulewidth}{1.5pt}

%---------------------------------------
\begin{document}
\begin{enumerate}
%------------------------------------
  \selectlanguage{english}

\item
\selectlanguage{arabic}
تعطى معادلة مسار الحركة لجسيم بالعلاقة 
\selectlanguage{english}
$x=10 \ t^{2}$
\selectlanguage{arabic}
، حيث 
$x\ (m)$ بالمتر
، $t\ (s)$ بالثانية
\selectlanguage{english}

\selectlanguage{arabic}
احسب
\begin{enumerate}
    \item 

    \selectlanguage{arabic}
متوسط السرعة خلال الفترة الزمنية من 
$2 \ s$
إلى 
$3 \ s$

    \item 

    \selectlanguage{arabic}
متوسط السرعة خلال الفترة الزمنية من 
$2 \ s$
إلى 
$2.1 \ s$
\end{enumerate}

\end{enumerate}
\end{document}

enter image description here

0

1 Answer 1

1

If switching to luatex or xetex is an option, I would definitely use them instead of pdftex. Here is an example with luatex.

\documentclass{article}

\usepackage[bidi=basic,english]{babel}

\babelprovide[import, main]{arabic}

% Change the font here. Instead of Free Serif, you may prefer Amiri or
% another Unicode-aware font.
\babelfont[arabic]{rm}{FreeSerif}

% You may want to change itemize, too. Here is how to do it currently:
\makeatletter
\def\@alph#1{\ifcase#1\or ا\or ب\or ج\or د\or ه\or و\or ز\or ح\or ط\fi}
\makeatother
\renewcommand\labelenumii{\theenumii.}

% Note babel with luatex undestands what an RTL document is (not only
% text), so margins and other layout elements can be reversed.
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\rhead{فيزياء عامة 2}
\chead{\LARGE تمارين 3}

\lhead{1441/06/12}
\renewcommand{\headrulewidth}{1.5pt}

\begin{document}

\begin{enumerate}

\setcounter{enumi}{8}

\item تعطى معادلة مسار الحركة لجسيم بالعلاقة $x=10 \ t^{2}$ ، حيث $x\
(m)$ بالمتر ، $t\ (s)$ بالثانية احسب.

\begin{enumerate}
\item متوسط السرعة خلال الفترة الزمنية من $2 \ s$ إلى $3 \ s$
\item متوسط السرعة خلال الفترة الزمنية من $2 \ s$ إلى $2.1 \ s$
\end{enumerate}

\item تعطى معادلة مسار الحركة لجسيم بالعلاقة $x=10 \ t^{2}$ ، حيث $x\
(m)$ بالمتر ، $t\ (s)$ بالثانية احسب.

\end{enumerate}

\end{document}

babel-arabic

Edit. I've extended the example with Abjad numerals in itemize, and some remarks.

7
  • Thanks, this works perfectly! but how can I change the font?
    – Asma
    Feb 16, 2020 at 4:20
  • @Asma I've extended the example. To change the font to, say, Amiri, use \babelfont[arabic]{rm}{Amiri} Feb 16, 2020 at 7:01
  • What is the difference between \babelfont[arabic]... and \babelfont[*arabic]...?
    – Diaa
    Jul 2, 2021 at 18:20
  • @Diaa arabic is the language, *arabic is the script. With the former, the font isn't applied to Farsi, with the latter it's. For example, you can declare a font at once for Russian, Bulgarian, Serbian and Ukrainian with *cyrillic. Jul 3, 2021 at 7:39
  • I am new to babel, so would you please refer me to an answer to fully understand your comment?
    – Diaa
    Jul 3, 2021 at 19:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .