General ⇒ Include the word chapter in table of contents
Include the word chapter in table of contents
Hello all,
I need the word chapter (e.g., ‘Chapter 1: … )’ to appear in my table of contents. However, my thesis file only produces a list of numbers such as
1 Introduction
1.1 Motivation
1.2 Previous work
2 Algorithm
Instead I need
Chapter 1: Introduction
1.1
1.2
Chapter 2: Algorithm
and so on…
Would appreciate suggestions..I have been fiddling around with the report.cls file to generate the appropriate change. But if I add the word 'Chapter' before #1 in the .cls file it generates something like Chapter 1 Introduction:
Best
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Include the word chapter in table of contents
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Include the word chapter in table of contents
Code: Select all
\documentclass{report}
\usepackage[english]{babel}
\usepackage{tocloft}
\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftchappagefont}{\bfseries}
\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{6em}
\begin{document}
\tableofcontents
\chapter{First chapter}
\section{Sec. One one}
\section{Sec. One two}
\chapter{Second chapter}
\section{Sec. Two one}
\section{Sec. Two two}
\chapter{Third chapter}
\section{Sec. Three one}
\section{Sec. Three two}
\end{document}
Re: Include the word chapter in table of contents
That's the reason I've been fiddling with the report.cls file to make just this change. I don't want to get into tocloft and take care of all the changes introduced by using it.
I am looking for a simple renewal command either in the latex source or in the report.cls file.
Re: Include the word chapter in table of contents
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
**************** {\protect Chapter\numberline{\thechapter \;:}#1}% %%%% Change on 07/20/2008
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Include the word chapter in table of contents
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 1
- Joined: Wed Oct 08, 2008 9:23 am