6

I'm finishing a book, and I want the first page of each chapter to begin with the literal numerotation:

Chapter one

...

Chapter two

...

chapter three

etc.

I've seen it in several books so I think it possible, but how?

A file example...in arabic

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

\usepackage{titlesec}
\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[numerals=maghrib]{arabic}
\setotherlanguage{english}

\newfontfamily\arabicfont[Script=Arabic, AutoFakeSlant=-0.02]{Amiri}
\setsansfont[Script=Arabic,Scale=1.5]{Amiri}

\gappto\captionsarabic{\renewcommand{\chaptername}{الباب}}
\begin{document}
\chapter{المحاكاة}
كيف يمكننا إيجاد  احتمال الفوز في  لعبة         
 \end{document}
10
  • You don't have to sign with your name since it automatically appears in the lower right corner of your post.
    – jub0bs
    May 5, 2014 at 14:50
  • How do you want cross-references to chapter numbers to be typeset: As numerals (arabic: 1, 2, ...; roman: i, ii, ...; alphabetic: a, b, ...) or as literal words ("One", "Two", ...)? Please advise.
    – Mico
    May 5, 2014 at 15:01
  • I want my references numeral in arabic and the titles (and only the titles) in words "One", "Two" May 5, 2014 at 15:13
  • Do you have code for titlesec or are you just loading it? If you have \titleformat{\chapter}..., then that's the place where action should be done.
    – egreg
    May 5, 2014 at 18:07
  • @FaouziBellalouna see updated answer May 5, 2014 at 18:29

1 Answer 1

10

use \words{chapter} instead of \arabic{chapter} where words is defined by

\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}

I switched fonts as I didn't have the one you used, and left the words in English:-)

enter image description here

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

\usepackage{titlesec}
\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[numerals=maghrib]{arabic}
\setotherlanguage{english}

\newfontfamily\arabicfont[Script=Arabic, AutoFakeSlant=-0.02]{Arial}
\setsansfont[Script=Arabic,Scale=1.5]{Arial}

\gappto\captionsarabic{\renewcommand{\chaptername}{الباب}}
% probably can use titlesec's \titleformat but I don't know that package:-}
\makeatletter
\let\old@makechapterhead\@makechapterhead
\def\@makechapterhead{\def\thechapter{\words{chapter}}\old@makechapterhead}
\makeatother


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




\begin{document}

\chapter{المحاكاة}
كيف يمكننا إيجاد  احتمال الفوز في  لعبة         
 \end{document}
9
  • After three\else, I write four\else five\else six\else seven\else eight\else nine\else ten\else after this \fi} ?? May 5, 2014 at 15:08
  • The numerotation is automatic ? so when I write \chapter{First chapter}, it writes "First chapter one" ? May 5, 2014 at 15:10
  • No just use \else for the last "error" case where you run out of words, separate all the real cases by \or, the chapter heading code probably defines Chapter \arabic{chapter} you need to change that to use \words instead, if it isn't clear how to change that you could ask about that but you have given no indication of your document class (questions should always include an example document for that reason) May 5, 2014 at 15:21
  • Please see the example what I added, without commenting here... May 5, 2014 at 17:20
  • You could take a look at the fmtcount package: it is dedicated to translating the value of counters into tex, and has some multilingual support. There is no arabic support, but you might take what exists as a model.
    – Bernard
    May 5, 2014 at 18:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .