I am using Arabic language so the alignment should be from the right to left.
What I have so far for the table of contents is:
and I have three problems:
- the roman numbering doesn't apply for the pages before chapter 1 (المبحث ١: علوم الحاسوب)
- The right alignment for the section and subsection is wrong and I tried all the solutions on this website and couldn't fix it.
- I want to change the chapter numbering to alphabetical one. Instead of chapter 1, I wanted chapter one. In my case for the Arabic version, instead of (المبحث ١) I want (المبحث الأول).
My code is
\documentclass[11pt,a4paper]{report}
\usepackage{arabtex}
\usepackage[utf8]{inputenc}
\usepackage[LFE,LAE]{fontenc}
\usepackage[arabic]{babel}
\usepackage{lipsum}
\usepackage{setspace}
\usepackage{titlesec}
\usepackage{tocloft}
\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler-page-format>
\addto\captionsarabic{%
\renewcommand\chaptername{المبحث}
}
\addto{\captionsarabic}{\renewcommand*{\contentsname}{قائمة المحتويات}}
\title{
\Huge\textsc{اللغة العربية}
}
\author{سالم البوزيدي}
\begin{document}
\maketitle
\tableofcontents
\pagenumbering{roman}
\clearpage
\setcounter{page}{5}
\chapter*{الملخص}
\addcontentsline{toc}{chapter}{الملخص}
\chapter*{شكر وثناء}
\addcontentsline{toc}{chapter}{شكر وثناء}
\chapter*{اهداء}
\addcontentsline{toc}{chapter}{اهداء}
\pagenumbering{arabic}
\chapter{علوم الحاسوب}
\section{تاريخ}
\subsection{تاريخ}
\section{تاريخ}
\subsection{تاريخ}
\subsection{تاريخ}
\chapter{علوم الحاسوب}
\chapter{علوم الحاسوب}
\begin{thebibliography}{99}
[1]
من ويكيبيديا، الموسوعة الحرة
\end{thebibliography}
\end{document}
I appreciate any help in this.
EDIT: My code now after the Pieter van Oostrum suggenstion is:
\documentclass[12pt,a4paper]{report} %Same
\usepackage{fontspec} % Added
\defaultfontfeatures{Ligatures=TeX} % Added%Use "Ligatures=TeX" instead of "Mapping=tex-text"
\usepackage{polyglossia}% Added
\setdefaultlanguage{arabic}% Added
\setmainfont{Times New Roman}% Added
\usepackage{lipsum} %Same
\usepackage{setspace}%Same
\usepackage{titlesec}%Same
\usepackage{tocloft}%Same
\usepackage{geometry} %Same
\geometry{
a4paper,
total={170mm,257mm},
left=25mm,
right=25mm,
top=30mm,
bottom=30mm,
}
\usepackage{biblatex} %Same
\addbibresource{sample.bib} %Same
\usepackage{graphicx} %Same
\usepackage{tikz} %Same
\usepackage{eso-pic} %Same
\usepackage{atbegshi,picture} %Same
\usepackage{array,graphicx,lipsum} %Same
\usepackage[export]{adjustbox} %Same
\usepackage{titling} %Same
%\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}
\newcommand\numberstring[1]{% %Same
\ifcase #1
% zero
\or الأول%
\or الثاني%
\or الثالث%
\or الرابع%
\or الخامس%
\else I don't know%
\fi
}
%\makeatletter
\renewcommand{\thechapter}{\numberstring{\c@chapter}}
%\makeatother
\setlength{\cftbeforetoctitleskip}{-3em}
\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries}% <above-code>
{\chaptername\ \thecontentslabel:\quad}% <numbered-entry-format>
{}% <numberless-entry-format>
{\titlerule*[.5pc]{.}\contentspage}
\titlecontents{section}
[0pt]
{}
{\thecontentslabel { } }
{}
{\titlerule*[.5pc]{.}\contentspage}
\titlecontents*{subsection}
[0pt]
{}
{\thecontentslabel{ }}
{}
{\titlerule*[.5pc]{.}\contentspage}
\addto\captionsarabic{%
\renewcommand\chaptername{المبحث}
}
\addto{\captionsarabic}{\renewcommand*{\contentsname}{قائمة المحتويات }}
\usepackage{titling}
\newcommand{\subtitle}[1]{%
\posttitle{%
\par\end{center}
\begin{center}\large#1 \end{center}
\vskip0.5em}%
}
\newcommand{\subsubtitle}[1]{%
\preauthor{%
\begin{center}
\large #1 \vskip0.5em
\begin{tabular}[t]{c}
}%
}
\makeatletter
\def\@maketitle{
\raggedright
\includegraphics[width = 40mm]{logo.png}\\[8ex]
}
\makeatother
%\titlegraphic{\includegraphics[width=4cm]{logo.png}}
\newlength{\myspace}
\setlength{\myspace}{10em}
\makeatletter
\xpatchcmd{\@maketitle}{\vskip.5em}{\vskip\myspace}{}{}
\makeatother
\AtBeginShipoutNext{\AtBeginShipoutUpperLeft{%
\put(\dimexpr\paperwidth-1cm\relax,-1.5cm){\makebox[0pt] [r]{\framebox{
\\جمهورية العراق
\\ وزارة التعليم العالي والبحث العلمي
\\ الجامعة العراقية
\\ كلية الادارة والاقتصاد
}}}%
}}
\begin{document}
\begin{titlepage}
\begin{center}
\vspace*{1cm}
\begin{center}
\Large{ أثر المعرفة في تعزيز
الميزة التنافسية}
\vspace{0.5cm}
\large
بحث مقدم الى مجلس كلية الادارة والاقتصاد-
الجامعة العراقية وهو جزء من متطلبات نيل شهادة البكالوريوس في الادارة والاقتصاد - قسم ادارة الاعمال
\vspace{1.5cm}
اعداد الطالب\\
\text{مصطفى محمد عفر}\\
\vspace*{2cm}
باشراف
\text{ م . د وسن سعد }
\vfill
\vspace{1cm}
٢٥ نيسان ٢٠٢١
\end{center}
\end{center}
\end{titlepage}
%٪\maketitle
\newpage
\pagenumbering{Roman}
\renewcommand{\thepage}{\protect\textLR{\Roman{page}}}
\clearpage
\setcounter{page}{1}
\tableofcontents
%\usepackage{titlesec}
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter}{0pt}{-50pt}{40pt}
\newpage
\doublespacing
\begin{doublespace}
\input{الملخص}
\end{doublespace}
\newpage
\doublespacing
\begin{doublespace}
\input{المقدمة}
\end{doublespace}
\newpage
\doublespacing
\begin{doublespace}
\input{الاية القرانية}
\end{doublespace}
\newpage
\doublespacing
\begin{doublespace}
\input{شكر وثناء}
\end{doublespace}
\newpage
\doublespacing
\begin{doublespace}
\input{اهداء.tex}
\end{doublespace}
\pagenumbering{arabic}
%\renewcommand{\thepage}{\protect \textLR{\arabic{page}}}
\newpage
\doublespacing
\begin{doublespace}
\input{المبحث الأول}
\end{doublespace}
\begin{thebibliography}{99}
\end{thebibliography}
\end{document}
%------------------------
My problem now is the Chapter numbering doesn't match the section numbering. I wanted before to change the chapter number to letter instead like chapter 1 to Chapter One and I succeeded in that applying Pieter van Oostrum suggestion but now I am having another problem which is the section numbering is also converted to the letters like 1.1 is converted to One.1 and I don't want this behavior. Is there any solution for this.
arabic
changing page styles. See tex.stackexchange.com/questions/587259\pagenumbering{arabic} % move here <<<<
AFTER\chapter{<the first>}
it works as you wanted. See my example where\chapter{Introduce}
is the first numbered chapter. page 1. Before that every page is with roman numbering.