I have a not so far problem from the question opened here: Adding word "Chapter" into Table of Contents for only numbered chapter entries

I'm using a "literal numbering for chapters, using the macro:

\newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
\def\xwords#1{\ifcase#1\or
One\or
Two\or
Three\else
I need more words\fi}

\makeatletter
\makeatother


Chapter One. The title of the chapter one

Chapter Two. The title of the chapter two...and so

Solutions based on the two packages titletoc and tocloft are wellcome, preventing eventual problems of compatibility, because I'm using bidi package (For example, in the solution based on titletoc, in the question cited, one must change the value of \thecontentslabel command to the "literal" value, I think, but I don't know how !)

• Should the way chapters are counted, i.e. the counter value is displayed, changed in the ToC only? The caveat of 'One', 'Two' is that the space required for this 'numbers' is larger than for real numbers. – user31729 Nov 21 '14 at 7:22
• Please look to the comments of the answer. Thanks – Faouzi Bellalouna Nov 21 '14 at 8:25
• Which comments to which answer? – user31729 Nov 21 '14 at 8:31

A possible solution, but I am sure, this has been answered before

(I took the \cftchapresnum... etc code from Karl Koeller's answer in the link provided by the OP)

\documentclass{book}

\usepackage{fmtcount}
\usepackage{blindtext}
\usepackage[titles]{tocloft}

\usepackage{forloop}

\newcounter{dummycounter}%

\newlength\mylength
\renewcommand\cftchappresnum{\chaptername~}
\renewcommand\cftchapaftersnum{:}

\usepackage{etoolbox}%

\makeatletter
\pretocmd{\@chapter}{\begingroup \renewcommand{\thechapter}{\Numberstring{chapter}}}{}{}
\apptocmd{\@chapter}{\endgroup}{}{}
\makeatother

\begin{document}
\tableofcontents

\forloop{dummycounter}{1}{\value{dummycounter} < 11}{%
\chapter{Some Content of chapter \number\value{dummycounter}}%
\blindtext[5]
}%
\end{document}


• Your answer seems to be the good solution for me. But there's some details that I want to talk about... I go to the discuss on my original file which is in arabic, using polyglossia. I try to make it comprehensive for you. Thanks – Faouzi Bellalouna Nov 21 '14 at 8:35
• I give the first page of my contents (of a very beautiful book of probability in arabic in the end of progress...), with some explanation... The chaptername in arabic is الباب... "First" is الأول and "Second" is الثاني... All is written from right to left... You can see that the contents of level "chapter" have gone far in the margin... How can I push it to the left... Same thing for the level "subsection" (pages 18,19,23...)... The contents for the sections are in the right place ...Why is it not the case for the others? – Faouzi Bellalouna Nov 21 '14 at 8:54
• @FaouziBellalouna: Sorry, I don't understand Arabic and have never worked with polyglossia so far – user31729 Nov 21 '14 at 8:58
• ok thanks.. I'll try to my self and inform you – Faouzi Bellalouna Nov 21 '14 at 8:58
• @FaouziBellalouna: The problem is rather that you use a lot of extra packages/formatting which is not provided to us. – user31729 Nov 21 '14 at 9:06

The problem is solved, by using titletoc. I give n answer combined with a use of the package fncychap and option Glenn. Using the following commands on the examples given above, gives a good form...

\usepackage[Glenn]{fncychap}
\ChNumVar{\Large}% Dimension of the number of the chapter

\usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries\vspace*{10pt}}% <above-code>
{\large\chaptername\ \thecontentslabel. }% <numbered-entry-format>
{}% <numberless-entry-format>
{\hfill\contentspage}% <filler-page-format>

\makeatletter
\pretocmd{\@chapter}{\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}{}{}
\apptocmd{\@chapter}{\endgroup}{}{}
\makeatother


Here's the first page of the contents (The enumeration obtained by \words is in arabic الأول الثاني الثالث and the chaptername in arabic is الباب)

One can see the difference with the first page on the beginning of the document.

The page 1 of the chapter 1

On the demand of @Educ I give the complete file, with some improvements, to produce what I'm talking about (partial contents, fancy things etc)

The .tex file

\documentclass[14pt,a4paper]{book}

\usepackage{titlesec}
\usepackage{titletoc}
\usepackage{etoolbox}
\usepackage{multicol}
\usepackage{titleps}

\usepackage{amsmath,amssymb}

\usepackage{geometry}
\geometry{paperwidth=180mm, paperheight=130mm, top=5mm, bottom=5mm}
\pagestyle{empty}

\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}

\makeatletter
\pretocmd{\@chapter}{\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}{}{}
\apptocmd{\@chapter}{\endgroup}{}{}
\makeatother
\titlecontents{lsection}
[2.3em]{\small}{\contentslabel{2.3em}}
{\hspace*{-2.3em}}
{}
\titlecontents{lsubsection}
[4.6em]{\small}{\contentslabel{2.3em}}
{\hspace*{-2.3em}}
{}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \words{chapter}}{20pt}{\Huge}
\titlespacing{\chapter}
{0pt}{40pt}{-10pt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  MACRO FOR LITERAL NUMBERING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
\def\xwords#1{\ifcase#1\or
الأول\or
الثاني\or
الثالث\or
الرابع\or
الخامس\or
السادس\or
السابع\or
الثامن\or
التاسع\or
العاشر\or
الحادي عشر\or
الثاني عشر\or
الثالث عشر\or
الرابع عشر\or
الخامس عشر\or
السادس عشر\or
السابع عشر\or
الثامن عشر\or
التاسع عشر\or
العشرون\or
\else
I need more words\fi}

\makeatletter
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  END MACRO FOR LITERAL NUMBERING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%     REDEFINING NAMES IN ARABIC      %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\gappto\captionsarabic{\renewcommand{\contentsname}{المحتويات}}
\gappto\captionsarabic{\renewcommand{\chaptername}{الباب}}
\gappto\captionsarabic{\def\figurename{رسم}}
\gappto\captionsarabic{\renewcommand{\tablename}{جدول}}
\gappto\captionsarabic{\renewcommand{\indexname}{\textbf{الثبت}}}
\gappto\captionsarabic{\renewcommand{\appendixname}{\textbf{الملحق}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   MACRO FOR PARTIAL CONTENTS     %%%%%%%%%%%%%%%%%%%%%%%
% start of Werner's code
% http://tex.stackexchange.com/a/37732/3954
\setlength{\columnseprule}{0.1pt}
\makeatletter
\patchcmd{\endmulticols}{\par}{\par\xdef\@@tpd{\the\prevdepth}}{}{}
\newenvironment{multicolumns}[1]
{% \begin{multicolumns}{<cols>}
\par\nobreak % don't break a page here
\kern\dimexpr\the\prevdepth+\multicolsep\relax % don't take into account the depth of the preceding line + #2
{\columnseprulecolor\hrule height 0.4pt} % the rule, same width as \columnseprule
\kern-\multicolsep % space after the rule
\nointerlineskip % no additional space after the rule
\begin{multicols}{#1}
}
{% \end{multicolumns}
\end{multicols}%
\par\nobreak % don't break a page here
\kern\dimexpr\@@tpd-\multicolsep\relax % don't take into account the depth of the preceding line + #2
{\columnseprulecolor\hrule height 0.4pt} % the rule, same width as \columnseprule
\kern\multicolsep % space after the rule
\nointerlineskip % no additional space after the rule
}
\makeatother
% end of Werner's code

%%%     Commands for generateing the ptc
\newcommand\buildptc{%
\vspace*{-40pt}
\startcontents[chapter]
{\large\noindent\bf
المحتوى}
\vspace*{-5pt}
\begin{multicolumns}{2}
\printcontents[chapter]{l}{0}{\setcounter{tocdepth}{1}}
\end{multicolumns}%
%%%\vspace*{-40pt}
\vspace*{5pt}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   END MACRO FOR PARTIAL CONTENTS     %%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%% REDEFINES \THECHAPTER IN CONTENTS
\makeatletter
\pretocmd{\@chapter}{\begingroup \renewcommand{\thechapter}{{\words{chapter}}}}{}{}
\apptocmd{\@chapter}{\endgroup}{}{}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{titletoc}%
\titlecontents{chapter}% <section-type>
[0pt]% <left>
{\bfseries\vspace*{10pt}}% <above-code>
{\normalsize\chaptername\ \thecontentslabel.\;}% <numbered-entry-format>
{}% <numberless-entry-format>
{\normalsize\hfill\contentspage}% <filler-page-format>

\usepackage[Glenn]{fncychap}
\ChNumVar{\Large}% Dimension of the number of the chapter in the first page... instead of the default...\ChNumVar{\Huge}

\begin{document}
\chapter{التحليل التوافقي}
\buildptc
\section{مقدّمة}
\section{المبدأ الأساسي للعد}

\chapter{مسلّمات الاحتمالات}
\buildptc
\section{مقدّمة}
\section{فراغ العينة و الحوادث}
\section[مسلّمات الاحتمالات]{مسلّمات الاحتمالات\hfill\normalsize \LR{Axioms of Probability}}
\stopcontents[chapter]
\end{document}


and it's compilation, with xelatex

• Well, it's nice that you grab my efforts to improve your solution which I couldn't since I did not have to information you have ;-) – user31729 Nov 24 '14 at 13:17
• Many thanks. I post the first page of the chapter 1, with the minitoc obtained by this beautiful macro, which announces the next chapter, in bold... – Faouzi Bellalouna Nov 24 '14 at 20:33
• see the doc of the package... you can find the following... The following settings have been used as default parameters \ChNameVar{\bfseries\Large\sf}, \ChNumVar{\Huge}, \ChTitleVar{\bfseries\Large\rm}, \ChRuleWidth{1pt}, \ChNameUpperCase, \ChTitleUpperCase.. you can play with this for adjustments... – Faouzi Bellalouna Feb 21 '17 at 17:25
• I saw your opened question, and I was not very patient in my solution using fncychap... one must put the command after the other concerning sectioning... so just before document if you want.. \usepackage[Glenn]{fncychap} \ChNumVar{\Large}% Dimension of the number of the chapter in the first page... instead of the default...\ChNumVar{\Huge} – Faouzi Bellalouna Feb 21 '17 at 17:36
• I've forgotten another thing... must add the command \stopcontents[chapter] in the end of the last chapter, for a good behaviour of the partial contents.. I'll put it in the last edition ! – Faouzi Bellalouna Feb 22 '17 at 5:22