7
\documentclass[12pt]{arabbook}
%%%%%%%%%%% packages
\usepackage{fancyhdr}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english, arabic]{babel}
\usepackage{t1enc}
\usepackage{float}
 \usepackage{arabtex} 
 \usepackage{amssymb}
\usepackage{graphicx}% ajouter des photos
\pagestyle{fancy}
\addto\captionsarabic{\renewcommand{\chaptername}{الفصل}}
\makeatletter
\newcommand{\arabic@words}[1]{% substitute the relevant Arabic numbers here
\ifcase#1\or الأوّل
\or الثاني\or الثالث\or الرابع\else\@ctrerr\fi}
\newcommand*\arabicwords[1]{\expandafter\arabic@words\csname c@#1\endcsname}
\renewcommand\thechapter{\arabicwords{chapter}}
\makeatother
\setcounter{page}{1}
\begin{document}
\tableofcontents
\chapter{أهلا}
\section{مرحبا}
\begin{arabtext}
mr.hbn bkm
\end{arabtext}
\end{document}

I want to get

الفصل الاول

instead of

الفصل ١

and in section headings مرحبا 1.1 instead of ١.١ مرحبا

I edited the files, thanks to @Alan Munn but the problem go to the table of contents: enter image description here

  • why don't use xelatex? – touhami Jun 8 at 22:25
  • it shouldn't be very difficult to copy and change the relevant definitions, but it is quite unclear to see what is wrong or what the output should be if one can't read/write arabic. – Ulrike Fischer Jun 10 at 17:20
4

Edit If for some reason one need to use arabtex, here is another solution with pdflatex (arabi and arabtex):

Note i think one need to add this

\renewcommand*\l@section{\@dottedtocline{1}{1em}{1.5em}}

to correctly set table of contents

\documentclass[12pt]{arabbook}
%---------------------------------------------                
\usepackage[LAE,T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage[english, arabic]{babel}
\usepackage{arabtex} 
%---------------------------------------------
\usepackage{amsmath,amssymb}
\usepackage{graphicx}  
\usepackage{float}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{etoolbox}
%---------------------------------------------
\addto\captionsarabic{\renewcommand{\chaptername}{الفصل}}
\makeatletter
\newcommand{\arabic@words}[1]{% substitute the relevant Arabic numbers here
\ifcase#1\or الأوّل
\or الثاني\or الثالث\or الرابع\else\@ctrerr\fi}
\newcommand*\arabicwords[1]{\expandafter\arabic@words\csname c@#1\endcsname}
\patchcmd{\@makechapterhead}{\thechapter}{\arabicwords{chapter}}{}{}
\makeatother
\renewcommand \thechapter {\textLR{\arabic{chapter}}}
\renewcommand \thesection {\thechapter.\textLR{\arabic{section}}}
\renewcommand \thesubsection {\thesection.\textLR{\arabic{subsection}}}

%---------------------------------------------
\begin{document}
\tableofcontents
\chapter{أهلا}
\section{مرحبا}
\begin{arabtext}
mr.hbn bkm
\end{arabtext}
\end{document}

Here is a solution. The idea is to redefine \@makechapterhead command and replace \thechapter with \arabicwords{chapter}. For that, we can use \patchcmd from etoolbox package:

\patchcmd{\@makechapterhead}{\thechapter}{\arabicwords{chapter}}{}{}.

Here is a MWE with xelatex :

\documentclass[12pt]{book}  
%---------------------------------------------                
\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Arial}
\setmonofont{Courier New}
\newfontfamily{\arabicfont}[Script=Arabic,Scale=1.2]{Amiri}
%\newfontfamily{\arabicfont}[Script=Arabic]{Amiri}
%---------------------------------------------
\usepackage{etoolbox}
\usepackage{amsmath,amssymb}
\usepackage{graphicx}  
\usepackage{float}
\usepackage{fancyhdr}
\pagestyle{fancy}
%---------------------------------------------
\usepackage{polyglossia}
\setdefaultlanguage[locale=algeria]{arabic}
\setotherlanguage{english}
%---------------------------------------------
\addto\captionsarabic{\renewcommand{\chaptername}{الفصل}}
\makeatletter
\newcommand{\arabic@words}[1]{% substitute the relevant Arabic numbers here
\ifcase#1\or الأوّل
\or الثاني\or الثالث\or الرابع\else\@ctrerr\fi}
\newcommand*\arabicwords[1]{\expandafter\arabic@words\csname c@#1\endcsname}
\patchcmd{\@makechapterhead}{\thechapter}{\arabicwords{chapter}}{}{}
\makeatother
%---------------------------------------------
\begin{document}
\tableofcontents
\chapter{أهلا}
\section{مرحبا}
مرحباً بكم
\textenglish{hello}
اللغة العربية

\begin{english}
welcome to TeX.se 
\textarabic{مرحباً}
This is an entire paragraph in english.
\end{english}


\end{document}
  • thank you, please can I sent you an email ? – Poline Sandra Jun 14 at 19:09
  • @PolineSandra no problem. Where can i fined your email address. – touhami Jun 14 at 19:46
  • I finally asked my question if you can help me – Poline Sandra Jun 14 at 19:53
  • can we do something like this with arabtext?tex.stackexchange.com/questions/73421/… – Poline Sandra Jul 5 at 15:55
  • are you using arabi : \usepackage[english, arabic]{babel} like in this question or arabook+arqam like here – touhami Jul 6 at 17:49

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.