[Tex/LaTex] Remove chapter from ToC without losing the numbering in the document

chaptersnumberingtable of contents

I'm trying to remove a chapter in the ToC to instead replace it with a custom text.
A easy way is do like this:

\chapter*{Chapter}
\addcontentsline{toc}{chapter}{Custom chapter name}

But this unfortunately removes all chapter numbers in the
underlying sections and subsections.

How can I go around this?

Best Answer

Here's a somewhat cleaner way (in my point of view) to provide a different chapter number title:

Either manipulate the tocdepth counter temporarily or use \chapter[Other ToC Title]{Different in - body - title}.


\documentclass{book}

\usepackage{blindtext}

\begin{document}

\tableofcontents
\chapter{A regular chapter}
\blindtext[10]
\addtocontents{toc}{\protect\setcounter{tocdepth}{-5}} % Switch off toc appeareance for a moment
\chapter{In - document chapter name}
\addtocontents{toc}{\protect\setcounter{tocdepth}{3}}
\addcontentsline{toc}{chapter}{Custom chapter name}
\section{Foo}
\blindtext

\chapter[And yet another chapter title in ToC]{And this is the long chapter title that shouldn't appear in ToC!}
\section{Foo bar}
\blindtext[10]


\chapter{Another regular Chapter}
\section{Foo bar bar}
\blindtext

\end{document}

enter image description here