3

I want to use Roman numbers and Arabic numbers in my thesis. the total language of the document is Arabic and I use command \pagenumbering to change page number's style. I tried most of the solutions that add command \clearpage or \cleardoublepage but it doesn't work. this is MWC :

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[LAE, T1]{fontenc}
\usepackage[arabic, english]{babel}

\renewcommand{\I}[1]        {\if@farsi\FarsiEncoding\else\ArabicEncoding\fi\textLR{#1}}%
\renewcommand{\EI}[1]{\textLR{\FarsiEncoding  \textLR{#1}}}%
\renewcommand \thechapter {\textLR{\arabic{chapter}}}

\TOCLanguage{arabic} % arabic is the main language 
\newcommand\lr[1]{\textLR{#1}}
\newcommand\rl[1]{\textRL{#1}}

\begin{document}
\selectlanguage{arabic}
\pagenumbering{roman}
\chapter*{الملخص}
الملخص العربي 
\chapter*{\lr{Abstract}}
    \textLR{ English abstract\ldots}
\chapter*{كلمة الشكر}
نص باللغة العربية   
\tableofcontents
\listoffigures
\listoftables
\cleardoublepage

\pagenumbering{arabic}
\chapter{تجريب}
نص باللغة العربية\\

\end{document}

using the method suggested by @egreg the problem of page numbering has been solved but it changes the style of the table of contents, where the numbers changes into arabi-indi coding ?So is there any way to fix this problem? this is the method suggested by @egreg :

\makeatletter
\def\ps@plain{\ps@empty\SAV@ps@plain}
\makeatletter
\pagestyle{plain}

and this is the result of this change: result after redefine <code>plain</code>

By redefining command \pagenumbering as @egreg the problem of toc arabi-inidi coding has been solved and this is the suggested redefinition :

\pagenumbering{roman}
\renewcommand{\thepage}{\protect\textLR{\roman{page}}}

then when arabic numbers is needed

\pagenumbering{arabic}
\renewcommand{\thepage}{\protect\textLR{\arabic{page}}}

and this is the result : enter image description here

  • I also tried to put command \cleardoublepage befor \pagenumbering{roman} but it doesn't work. – Ahmad Hafez Nov 7 '18 at 10:58
  • removing command TOClanguage{arabic} dosen't solve the problem – Ahmad Hafez Nov 7 '18 at 10:58
  • I also tried to define a new counter and change it's style and it's value manually but it doesn't work. – Ahmad Hafez Nov 7 '18 at 11:02
  • I tried to redefine the counter thepage and then change it's style but also it doesn't work. – Ahmad Hafez Nov 7 '18 at 11:32
  • by redefine the plain page style the problem of page numbering has been solved but the suggested method changes the style of the table of contents? is there any way to solve this problem?@egreg – Ahmad Hafez Nov 7 '18 at 11:59
1

The plain page style is redefined to always give \number\c@page.

You can revert this decision made by arabicore.sty. But I'm afraid you have to supplement the \pagenumbering declaration.

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[LAE, T1]{fontenc}
\usepackage[english,arabic]{babel}

\renewcommand{\I}[1]{\if@farsi\FarsiEncoding\else\ArabicEncoding\fi\textLR{#1}}%
\renewcommand{\EI}[1]{\textLR{\FarsiEncoding\textLR{#1}}}%
\renewcommand\thechapter{\textLR{\arabic{chapter}}}

\TOCLanguage{arabic} % arabic is the main language 
\newcommand\lr[1]{\textLR{#1}}
\newcommand\rl[1]{\textRL{#1}}

\makeatletter
\def\ps@plain{\ps@empty\SAV@ps@plain}
\makeatletter
\pagestyle{plain}

\begin{document}
\pagenumbering{roman}
\renewcommand{\thepage}{\protect\textLR{\roman{page}}}

\chapter*{الملخص}
الملخص العربي 

\begin{otherlanguage}{english}
\chapter*{Abstract}
English abstract
\end{otherlanguage}

\chapter*{كلمة الشكر}
نص باللغة العربية   

\tableofcontents
\listoffigures
\listoftables

\cleardoublepage
\pagenumbering{arabic}
\renewcommand{\thepage}{\protect\textLR{\arabic{page}}}

\chapter{تجريب}
نص باللغة العربية\\

\end{document}

enter image description here

  • could you please explain the differences between the following methods: the first one is what you define : \def\ps@plain{\ps@empty\SAV@ps@plain} and the other is define the counter \thepage and the change it's style, how t these methods are work? where could I find more information on this topic. – Ahmad Hafez Nov 7 '18 at 11:24
  • when I redefine plain the table of contents change it's style ,so what is the problem? – Ahmad Hafez Nov 7 '18 at 11:54
  • 1
    @AhmadHafez Fixed in the new version. – egreg Nov 7 '18 at 12:39
  • after redefining \pagenumbering as you suggested and compile twice the problem of toc is solved – Ahmad Hafez Nov 7 '18 at 13:23

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.