Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing a lab report, and select report class provided by LyX. I use LyX 2.0.3 and MiKTeX 2.9.

My question is, how to change the chapter number to display as text?

eg:

CHAPTER ONE not CHAPTER 1;

Also the same to be appear in the TOC

eg.:

CHAPTER ONE 
1.1...............
   1.1.1.........................
share|improve this question
add comment

2 Answers

Here's one possibility using the \Numberstring command from the fmtcount package to turn the number to its text string; the tocloft package was used to add the word "Chapter" before the chapter number in the ToC:

\documentclass{report}
\usepackage{tocloft}
\usepackage{fmtcount}

\renewcommand\thechapter{\Numberstring{chapter}}
\setlength\cftchapnumwidth{3em}
\renewcommand\cftchappresnum{Chapter~}
\newlength\mylen
\settowidth\mylen{\bfseries\cftchappresnum\cftchapaftersnum} % extra space
\addtolength\cftchapnumwidth{\mylen}

\begin{document}

\tableofcontents
\chapter{Test Chapter}

\end{document}

An image of the ToC:

enter image description here

An image of the first page of the chapter:

enter image description here

share|improve this answer
    
I got the following error, how I can fix it plz.\documentclass {report} \usepackage{tocloft} \usepackage{fmtcount} Your command was ignored. Type I <command> <return> to replace it with another command, or <return> to continue without it. –  MAHMD SHUGRAN Nov 18 '12 at 4:54
    
@MAHMDSHUGRAN are you getting this error with the exact code I posted in my answer? –  Gonzalo Medina Nov 18 '12 at 21:08
add comment

Here is a direct patch of \@chapter - the macro responsible for setting the passing chapter content to the ToC, together with fmtcount for formatting the numbering of the chapter counter. The patch is thanks to xpatch:

enter image description here

\documentclass{report}
\usepackage{xpatch}% http://ctan.org/pkg/etoolbox
\usepackage{fmtcount}% http://ctan.org/pkg/fmtcount
\renewcommand{\thechapter}{\NUMBERstring{chapter}}%
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\makeatletter
\xpatchcmd{\@chapter}% <cmd>
  {\numberline{\thechapter}}% <search>
  {\@chapapp~\thechapter\quad}% <replace>
  {}{}% <success><failure>
\makeatother
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\chapter{Second chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\chapter{Third chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\chapter{Last chapter}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\section{A section}\subsection{A subsection}\subsubsection{A subsubsection}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.