I was trying to use Roman and Arabic page numbers in my thesis, I use a method that redefines plain page style, the total method is my previous question here command \pagenumbering can't change numbers style i . This method somehow changes toc's style. the total language of my document is Arabic. the new toc doesn't align different levels's numbers on the right side. this is the first problem. and here is the MWC:

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

\renewcommand{\I}[1]{\if@farsi\FarsiEncoding\else\ArabicEncoding\fi\textLR{#1}}%
\renewcommand{\EI}[1]{\textLR{\FarsiEncoding  \textLR{#1}}}%
\renewcommand \thechapter {\textLR{\arabic{chapter}}}
%% redefine plain page
\makeatletter
\def\ps@plain{\ps@empty\SAV@ps@plain}
\makeatletter
\pagestyle{plain}

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


\begin{document}
\selectlanguage{arabic}
\cleardoublepage
\pagenumbering{Roman}
\renewcommand{\thepage}{\protect\textLR{\roman{page}}}
\clearpage
\chapter*{الملخص}
الملخص العربي 
\clearpage
\begin{otherlanguage}{english}
\chapter*{\lr{Abstract}}
\textLR{ English abstract\ldots}
\end{otherlanguage}
\clearpage
\chapter*{كلمة الشكر}
نص باللغة العربية   
\clearpage
\tableofcontents
\tocloftpagestyle{plain}
\clearpage
\listoffigures
\clearpage
\listoftables
\cleardoublepage
\pagenumbering{arabic}
\renewcommand{\thepage}{\protect\textLR{\arabic{page}}}
\chapter{الفصل}
نص باللغة العربية\\
\section{القسم }
نص باللغة العربية\\
\subsection{قسم فرعي}
\subsection{قسم فرعي}
\chapter{الفصل}

\end{document}

this give the following result: chapter, sec, subsec numbers aren't right aligned the problem is that the numbers of different levels aren't right aligned, so I tried to fix this problem using tocloft package and I add to the privious MWC the following commands:

\renewcommand\cftsecindent{0em}
\renewcommand\cftsubsecindent{0em}
\renewcommand\cftsecnumwidth{2em}
\renewcommand\cftsubsecnumwidth{2em}

this gives the following result : <code>indent</code> and <code>numwidth</code> values still start from left side

This commands that changes the indent and numwidth values but it seems that these numbers starts from left side of the page and it changes the page numbers alignment instead of section and sub section alignment. I tried also to put and numwidth to 1em and add some spaces before or after section's numbers like :

\renewcommand\cftsecnumwidth{1em}
\renewcommand\cftsubsecnumwidth{1em}
\renewcommand{\cftsecpresnum}{\quad}% Inserted before \section numbers in ToC
\renewcommand{\cftsubsecpresnum}{\qquad}% Inserted before \section numbers in ToC 

this give the following result where the numbers and titles are interfered numbers and titles are interfered so how can I solve this problem or how can I refine commands \@tocrmarg and \@pnumwidth on different levels (chapter ,sec,..) to fix this problem.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.