# “Literal” and numerical numbering of chapters

I ask another question related to this one "Literal" numbering of chapters but not in contents which was not "precise"... This question is the exact one, with an example...

This example gives me chapters "one" and "two" in the first pages of chapters (and this is what I want), and in the contents "1" and "two" (and this isn't what I want..). I want to obtain the same thing in the text but, in the contents, "1" and "2".. Then how to change the chapterhead, to be numeric.. I want it "1.1" for the section 1 not "one.1" like in my example.

I write all the packages for preventing eventual conflicts because I use all this packages in my book (of probability in arabic)...

    \documentclass[14pt,a4paper]{extbook}%{article}%

\usepackage{titletoc}
\usepackage{etoolbox}
\usepackage{multicol}
\usepackage{amsmath,amssymb}
\usepackage[most]{tcolorbox}
\usepackage{boxedminipage}
\usepackage{slashbox}
\usepackage{titlesec}
\usepackage{enumitem}
\usepackage{minitoc}
\usepackage{rotating}
\usepackage{fmultico}
\setlength{\columnseprule}{0.1pt}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{pdflscape}
\usepackage{array}

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

\makeatletter
\makeatother

\newcommand\words[1]{\expandafter\xwords\csname c@#1\endcsname}
\def\xwords#1{\ifcase#1\or
one\or
two\or
three\or
\else
I need more words\fi}

\begin{document}
\tableofcontents
\chapter{Simulation}
\section{Introduction 1}
Simulation
\section{Introduction 2}
\chapter{Simulation}
Simulation
\end{document}


Instead of modifying the macro \thechapter that's used inside the macro \@makechapterhead, one could patch \@makechapterhead directly to make it use \words{chapter} instead of \thechapter when typesetting the representation of the chapter's "number". (The patching may be done via a \patchcmd instruction. As it looks like you're loading the etoolbox package anyway, you'll have access to \patchcmd.) By not touching the definition of \thechapter, no downstream complications result in terms of uses of \thechapter in, say, the creation of the table of contents.

Summarizing, I suggest that instead of

\makeatletter
\makeatother


you execute

% \usepackage{etoolbox} %% uncomment if 'etoolbox' isn't already being loaded
\makeatletter

Aside: In order to get your code to compile on my system (MacOSX 10.9.2, TeXLive2104/pre with all packages fully up to date), I had to comment out the instruction \usepackage{titletoc} that's in your preamble. It looks like titletoc tries to load the inputenc package, either directly or through a subsidiary package. When compiling a document under XeLaTeX -- which seems to be the case here, since you're also loading polyglossia -- the inputenc package should not be loaded. XeLaTeX (and LuaLaTeX too, for that matter) can handle only one input encoding system: UTF8. I think that until quite recently only a warning message would be issued if you (or one of the packages you specify) loaded inputenc; with the most recent update to TeXLive an outright error message is generated and compilation hangs. Let's all hope that the titletoc package gets upgraded soon to no longer load inputenc (and especially not if running under either XeLaTeX or LuaLaTeX).
• @FaouziBellalouna - I'm not sure I understand the issue. I am able to compile your MWE under XeLaTeX -- and with the polyglossia package loaded -- as long as the titletoc package is not loaded. Please elaborate what you mean by "does not have any effect". Which TeX distribution do you use, by the way? – Mico May 9 '14 at 9:26