0

I'm doing my master thesis in LaTex and I use the following code. I face a problem with the Table of Contents, in that its page numbering is arabic.

I tried to switch it with List of Figures , but I faced the same problem with it. I can't make any of them have roman numbers, I tried many things with no success. The numbering sequence looks like "i,ii,iii,iv,v,vi,7,8", where 7-8 is the table and list pages, then the chapter pages normally "1,2,etc".

\documentclass[12pt,a4paper,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[width=150mm,top=25mm,bottom=25mm]{geometry}
\usepackage[Bjornstrup]{fncychap}
\pagestyle{plain}
\usepackage[innercaption]{sidecap}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{textcomp}
\usepackage[arabic,main=english]{babel}
\renewcommand{\baselinestretch}{1.5}
\usepackage{tocloft}
\begin{document}
\nocite{*}
\frontmatter
\savegeometry{Mem}

\newgeometry{top=5in}

\addcontentsline{toc}{chapter}{Acknowledgment} \centerline{\textsc{Acknowledgment}}

First

\clearpage

\loadgeometry{Mem}

\addcontentsline{toc}{chapter}{Notation}

\centerline{\textsc{Notation:}} Note \clearpage

\newgeometry{top=5in}

\addcontentsline{toc}{chapter}{Abstract}

\begin{center} \Large{\textsc{Abstract}} \end{center} Abs \clearpage

\addcontentsline{toc}{chapter}{Arabic Abstract}

\begin{otherlanguage}{arabic} \begin{center} \Large{الملخص} \end{center} \begin{center} \large{وبنيته وبعض البنيات الجزئية فيه.} \end{center} \end{otherlanguage}

\clearpage

\newgeometry{top=3in}

\addcontentsline{toc}{chapter}{Foreword}

\begin{center} \textsc{Foreword} \end{center} Fore

\loadgeometry{Mem} Fore

\clearpage

\tableofcontents \addcontentsline{toc}{chapter}{Table of Contents}

\listoffigures \addcontentsline{toc}{chapter}{List of Figures}

\cleardoublepage

\cleardoublepage \mainmatter

\newgeometry{top=4in}

\chapter{Preliminaries and Basic Concepts about Algebras} blah

\bibliography{ref} \bibliographystyle{acm} \end{document}

Ingmar
  • 6,690
  • 5
  • 26
  • 47
Jemi neu
  • 3
  • 2

1 Answers1

0

If You Can Switch to a Modern Engine

If you can upgrade to LuaLaTeX, switching to Unicode will cut the Gordian knot of a lot of hacks. It appears to solve this bug.

\documentclass[12pt,a4paper,twoside]{book}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage{unicode-math}
\usepackage[width=150mm,top=25mm,bottom=25mm]{geometry}
\usepackage[Bjornstrup]{fncychap}
\usepackage[innercaption]{sidecap}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{tocloft}
\usepackage[bidi=basic, layout=sectioning.tabular, english]{babel}

\babelprovide[import=ar]{arabic}

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX } \babelfont{rm} [Ligatures=Common, Scale=1.0]{Libertinus Serif} \babelfont[arabic]{rm} {Amiri} \babelfont{sf} [Ligatures=Common]{Libertinus Sans} \babelfont{tt} {Libertinus Mono} \babelfont[arabic]{tt} {ALM Fixed} \setmathfont{Libertinus Math}

\renewcommand{\baselinestretch}{1.5}

\pagestyle{plain}

\begin{document} \nocite{*} \frontmatter \savegeometry{Mem}

\newgeometry{top=5in}

\addcontentsline{toc}{chapter}{Acknowledgment} \centerline{\textsc{Acknowledgment}}

First

\clearpage

\loadgeometry{Mem}

\addcontentsline{toc}{chapter}{Notation}

\centerline{\textsc{Notation:}} Note \clearpage

\newgeometry{top=5in}

\addcontentsline{toc}{chapter}{Abstract}

\begin{center} \Large{\textsc{Abstract}} \end{center} Abs \clearpage

\addcontentsline{toc}{chapter}{Arabic Abstract}

\begin{otherlanguage}{arabic} \begin{center} \Large{الملخص} \end{center} \begin{center} \large{وبنيته وبعض البنيات الجزئية فيه.} \end{center} \end{otherlanguage}

\clearpage

\newgeometry{top=3in}

\addcontentsline{toc}{chapter}{Foreword}

\begin{center} \textsc{Foreword} \end{center} Fore

\loadgeometry{Mem} Fore

\clearpage

\tableofcontents \addcontentsline{toc}{chapter}{Table of Contents}

\listoffigures \addcontentsline{toc}{chapter}{List of Figures}

\cleardoublepage

\cleardoublepage \mainmatter

\newgeometry{top=4in}

\chapter{Preliminaries and Basic Concepts about Algebras} blah

\bibliography{ref} \bibliographystyle{acm} \end{document}

Sticking with PDFTeX

The cause of this bug seems to be arabicore.sty (which is called from arabic.sty when you switch to Arabic in babel) redefining the plain page style in a way that does not respect \pagenumbering. The following redefinition in the preamble made your original MWE work for me:

\makeatletter
\def\ps@plain{\let\@mkboth\@gobbletwo
     \let\@oddhead\@empty\def\@oddfoot{\reset@font\hfil\if@rlmain
     \I{\thepage}\else\textLR{\thepage}\fi
     \hfil}\let\@evenhead\@empty\let\@evenfoot\@oddfoot}
\makeatother
Davislor
  • 44,045