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}
  • You don't have to sign with your name since it automatically appears in the lower right corner of your post. – jub0bs May 5 '14 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 '14 at 15:01
  • I want my references numeral in arabic and the titles (and only the titles) in words "One", "Two" – Faouzi Bellalouna May 5 '14 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 '14 at 18:07
  • @FaouziBellalouna see updated answer – David Carlisle May 5 '14 at 18:29
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}
| improve this answer | |
  • After three\else, I write four\else five\else six\else seven\else eight\else nine\else ten\else after this \fi} ?? – Faouzi Bellalouna May 5 '14 at 15:08
  • The numerotation is automatic ? so when I write \chapter{First chapter}, it writes "First chapter one" ? – Faouzi Bellalouna May 5 '14 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) – David Carlisle May 5 '14 at 15:21
  • Please see the example what I added, without commenting here... – Faouzi Bellalouna May 5 '14 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 '14 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.
https://tex.stackexchange.com/questions/175425/literal-numbering-of-chapters
tex.stackexchange.com
crawl=CC-MAIN-2020-40
160270
application/http; msgtype=response
sha1:QZYTPSUEAJ625KRVICR3J5YH3I5N4GGU
<urn:uuid:0d41ddcf-bdb0-4c38-84e2-7fdb88e9fba7>
2020-09-28T13:17:43Z
151.101.65.69
text/html
sha1:GTWTJZYFO5NPZFZ7BD7CN2AOBWV7FLSX
<urn:uuid:9f4f4e30-c43e-418e-9316-0cbcd2fd5bfa>
https://tex.stackexchange.com/questions/175425/literal-numbering-of-chapters
response
<urn:uuid:8792ef00-5707-4d91-9934-24a5c024dbca>
isPartOf: CC-MAIN-2020-40
publisher: Common Crawl
description: Wide crawl of the web for September 2020
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-11.ec2.internal
software: Apache Nutch 1.17 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.2-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: http://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/