2

Am using the book environment and trying to print the chapter title as "Chapter One", instead of "Chapter 1". I've searched about the "cardinal" and "chapter", but I didn't find anything similar to what I want.

The problem is that am using the titlesec package:

\documentclass[12pt, oneside,a4paper]{book} % The default font size and one-sided printing (no margin offsets)
\usepackage{graphics}
\graphicspath{ {images/} } % Specifies the directory where pictures are stored
\usepackage{multirow}
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{url}
\usepackage[font=large]{subcaption}
\usepackage[font=large]{caption}
\usepackage{pbox}
\usepackage[usenames,dvipsnames]{xcolor,colortbl}
\definecolor{PaleGreen}{HTML}{E6E6E6}

\usepackage{manyfoot}       % NOTE: manyfoot and DeclareNewFootnote MUST be declared before the BibLatex package,
\DeclareNewFootnote{A}      % otherwise, you get an error about no room for a new counter
                            % Vanilla footnotes: use \footnoteB
\DeclareNewFootnote{B}

\usepackage[backend=bibtex,
            hyperref=true,
            url=false,
            isbn=false,
            backref=false,
            style=ieee,
            citereset=chapter,
            maxcitenames=3,
            maxbibnames=100,
            block=none]{biblatex}
%%%%%%%%%
% the command \sbc (short bracketed cite) defined below prints footnote citation with brackets
\newcommand{\sbc}[1]{\bfcite{#1}}           
%%%%%%%%%

\usepackage{rotating}

\usepackage{libertine}
\usepackage[T1]{fontenc}

\title{\ttitle} % Defines the thesis title - don't touch this

\usepackage{titlesec}
\newcommand{\hsp}{\hspace{10pt}}
\definecolor{chapterSepLine}{HTML}{41B6c4}
\definecolor{chapterNumColor}{HTML}{212121}
\newcommand{\blackTBar}{{\color{black}\titlerule[0.75pt]}}
\newcommand{\royalBlueTBar}{{\color{chapterSepLine}\titlerule[0.75pt]}}

%--------- Chapter heading format ---------
\titleformat{\chapter}
[hang] % shape
{\center\LARGE\usefont{T1}{bch}{b}{n}\selectfont}   % format
{{\color{chapterNumColor} {\chaptertitlename}~\thechapter}} % label
{0pt}   % sep
{\center\Huge\bfseries }    % before
[\hrule\vspace{1pt}\royalBlueTBar]  % after
\titlespacing*{\chapter}{0pt}{-35pt}{40pt} % \titlespacing[*]{<command>}{<left>}{<before-sep>}{<after-sep>}[<right-sep>]

%--------- Section heading format ---------
\titleformat{\section}[hang]{
    \usefont{T1}{bch}{b}{n}\selectfont} % bch for Bitstream Charter, and ppl for Palatino
    {} 
    {0em}
    {\hspace{-0.4pt}\Large \thesection\hspace{0.6em}}

%--------- Subsection heading format ---------
\titleformat{\subsection}[hang]{
    \usefont{T1}{bch}{b}{n}\selectfont} % bch for Bitstream Charter, and ppl for Palatino
    {} 
    {0em}
    {\hspace{-0.4pt}\large \thesubsection\hspace{0.6em}}

%--------- paragraph heading format ---------
\titleformat{\paragraph}[runin]{
    \usefont{T1}{bch}{b}{n}\selectfont} % bch for Bitstream Charter, and ppl for Palatino
    {} 
    {0em}
    {\hspace{-0.4pt}\large\hspace{0.6em}}


\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}

\renewcommand{\contentsname}{Table of Contents}

\usepackage{inconsolata}                % monofont only, which replaces the current mono (Libertine) font

\makeatletter

\patchcmd{\@makechapterhead}{%
  \huge\bfseries \@chapapp\space \thechapter}{ \huge\bfseries \@chapapp\space \Numberstring{chapter}}{}{}
\makeatother

\usepackage{fmtcount}%

\addbibresource{Bibliography.bib}

% ----------------------------------------------------------------
%   BEGIN DOCUMENT
% ----------------------------------------------------------------
\begin{document}
\chapter{Hello}
\end{document}
  • The package fmtcount might help, but the precise solution depends on the class. Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Oct 31 '14 at 8:58
  • possible duplicate of How to change the chapter number to display as text (One, Two, ...)? – egreg Oct 31 '14 at 9:10
  • I added an MWE, am using the titlesec package, which is just like forbids the use of cardinal numbering in the chapter – blueMix Oct 31 '14 at 9:15
  • 1
    While the standard chapter number display might be a duplicate, the usage of the titlesec does not make it duplicate of the question linked to by egreg... however, it might be a duplicate of some other question – user31729 Oct 31 '14 at 9:38
4

This is a quick solution for book.cls, but this does not affect the page chaptermark headings.

The book class uses the command\@makechapterhead for setting the chapter heading via \@chapapp\space \thechapter. Replacing this by a patch by

\@chapapp\space \Numberstring{chapter}

Chapter 1 will be Chapter One etc.

The macro \Numberstring from fmtcount package expects a counter name and uses the corresponding verbal expression of the number.

\documentclass{book}

\usepackage{xpatch}

\makeatletter

\xpatchcmd{\@makechapterhead}{%
  \huge\bfseries \@chapapp\space \thechapter}{ \huge\bfseries \@chapapp\space \Numberstring{chapter}}{}{}
\makeatother

\usepackage{fmtcount}%

\begin{document}
\tableofcontents
\chapter{First}
\end{document}

enter image description here

Note The \xpatchcmd macro has two final arguments for the successful or failing patching of a command... I omitted code for this ;-)

New version, with the MWE from the OP

The chapter format has to be changed from

{{\color{chapterNumColor} {\chaptertitlename}~\thechapter}} % label

to this

{{\color{chapterNumColor} {\chaptertitlename}~\Numberstring{chapter}}} % label



\documentclass[12pt, oneside,a4paper]{book} % The default font size and one-sided printing (no margin offsets)
\usepackage{graphics}
\graphicspath{ {images/} } % Specifies the directory where pictures are stored
\usepackage{multirow}
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{url}
\usepackage[font=large]{subcaption}
\usepackage[font=large]{caption}
\usepackage{pbox}
\usepackage[usenames,dvipsnames]{xcolor,colortbl}
\definecolor{PaleGreen}{HTML}{E6E6E6}

\usepackage{manyfoot}       % NOTE: manyfoot and DeclareNewFootnote MUST be declared before the BibLatex package,
\DeclareNewFootnote{A}      % otherwise, you get an error about no room for a new counter
                            % Vanilla footnotes: use \footnoteB
\DeclareNewFootnote{B}

\usepackage[backend=bibtex,
            hyperref=true,
            url=false,
            isbn=false,
            backref=false,
            style=ieee,
            citereset=chapter,
            maxcitenames=3,
            maxbibnames=100,
            block=none]{biblatex}
%%%%%%%%%
% the command \sbc (short bracketed cite) defined below prints footnote citation with brackets
\newcommand{\sbc}[1]{\bfcite{#1}}           
%%%%%%%%%

\usepackage{rotating}

\usepackage{libertine}
\usepackage[T1]{fontenc}

\title{\ttitle} % Defines the thesis title - don't touch this
\usepackage{fmtcount}%

\usepackage{titlesec}
\newcommand{\hsp}{\hspace{10pt}}
\definecolor{chapterSepLine}{HTML}{41B6c4}
\definecolor{chapterNumColor}{HTML}{212121}
\newcommand{\blackTBar}{{\color{black}\titlerule[0.75pt]}}
\newcommand{\royalBlueTBar}{{\color{chapterSepLine}\titlerule[0.75pt]}}

%--------- Chapter heading format ---------
\titleformat{\chapter}
[hang] % shape
{\center\LARGE\usefont{T1}{bch}{b}{n}\selectfont}   % format
{{\color{chapterNumColor} {\chaptertitlename}~\Numberstring{chapter}}} % label
{0pt}   % sep
{\center\Huge\bfseries }    % before
[\hrule\vspace{1pt}\royalBlueTBar]  % after
\titlespacing*{\chapter}{0pt}{-35pt}{40pt} % \titlespacing[*]{<command>}{<left>}{<before-sep>}{<after-sep>}[<right-sep>]

%--------- Section heading format ---------
\titleformat{\section}[hang]{
    \usefont{T1}{bch}{b}{n}\selectfont} % bch for Bitstream Charter, and ppl for Palatino
    {} 
    {0em}
    {\hspace{-0.4pt}\Large \thesection\hspace{0.6em}}

%--------- Subsection heading format ---------
\titleformat{\subsection}[hang]{
    \usefont{T1}{bch}{b}{n}\selectfont} % bch for Bitstream Charter, and ppl for Palatino
    {} 
    {0em}
    {\hspace{-0.4pt}\large \thesubsection\hspace{0.6em}}

%--------- paragraph heading format ---------
\titleformat{\paragraph}[runin]{
    \usefont{T1}{bch}{b}{n}\selectfont} % bch for Bitstream Charter, and ppl for Palatino
    {} 
    {0em}
    {\hspace{-0.4pt}\large\hspace{0.6em}}


\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}

\renewcommand{\contentsname}{Table of Contents}

\usepackage{inconsolata}                % monofont only, which replaces the current mono (Libertine) font

\makeatletter

\patchcmd{\@makechapterhead}{%
  \huge\bfseries \@chapapp\space \thechapter}{ \huge\bfseries \@chapapp\space \Numberstring{chapter}}{}{}
\makeatother


\addbibresource{Bibliography.bib}

% ----------------------------------------------------------------
%   BEGIN DOCUMENT
% ----------------------------------------------------------------
\begin{document}
\chapter{Hello}
\end{document}

enter image description here

  • I added an MWE, am using the titlesec package, which is just like forbids the use of cardinal numbering in the chapter – blueMix Oct 31 '14 at 9:14
  • @blueMix: Well, I provided my solution before you posted your 'MWE'. You should have stated the titlesec usage right from the start of the post – user31729 Oct 31 '14 at 9:16
  • \usepackage{fmtcount} \renewcommand{\thechapter}{\Numberstring{chapter}} – blueMix Oct 31 '14 at 9:23
  • @blueMix: This will change any numbering of chapters, your sections will be displayed as One.1 and in the TOC this will appear 'wrong' as well. – user31729 Oct 31 '14 at 9:24
  • 1
    @blueMix: Just see my updated answer – user31729 Oct 31 '14 at 9:34

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.