0

I want to add "Chapter" word before chapter number in Table of Content. I have searched the solutions but the most answered question is when we using tocloft package that I didn't use. Can I give that word when using tocbibind package?

1
  • 2
    Why don't you use tocloft then? Both packages are maintained by our fellow user Will Robertson and are compatible to each other,but do address different issues. tocbibind is basically only for the inclusion toc in toc, whereas tocloft does provide hooks to the toc - entries
    – user31729
    Commented Nov 18, 2015 at 8:58

1 Answer 1

1

The hard part was getting the hanging indentation right.

\documentclass{report}

\makeatletter
\renewcommand*\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \settowidth{\@tempdimb}{\normalsize\bfseries \chaptername~}%
      \advance\leftskip by \@tempdimb
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@tempdima
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      \chaptername~#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\makeatother

\begin{document}

\tableofcontents

\chapter{A very very very very very very very very very very very very very very very very very very long title}

\end{document}

toc with chapter

5
  • How can I remove the word 'chapter' before the list of figures ?
    – S_25
    Commented Jun 24, 2017 at 20:02
  • @S_25 - Save and restore the original \l@chapter. Or just put the redefinition inside a group {...} with the TOC (but not the LOF). Commented Jun 24, 2017 at 21:18
  • @JohnKormylo could you please show how to implement this for only chapters without the lists; example: list of figures, and appendices? Commented Jul 12, 2019 at 19:24
  • @AhmedSayed - As it turns out, my previous comment was invalid, since you have no control of \l@chapter while the TOC is being printed. One would need a way to distinguish between two different kinds of chapters. You might try asking a new question with a complete MWE. Commented Jul 13, 2019 at 14:53
  • @john kormylo I have already created a new question through this link tex.stackexchange.com/questions/499707/… Commented Jul 13, 2019 at 15:48

You must log in to answer this question.

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