Enter an UNNUMBERED chapter entry into the TOC; But do not print a chapter title (header) for a single chapter’s starting page

table of contents

I tried the solution given in Start a new chapter without heading Which temporally causes @makechapterhead to simply gobble it's text argument.

\makeatletter
\newcommand{\unchapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble % make \@makechapterhead do nothing
  \chapter{#1}
  \endgroup
}
\makeatother

\unchapter{test chapter}

However, this prints a NUMBERED "test chapter" in the TOC.

In my book document … I use \chapter*{test chapter} (which is unnumbered, but is also not printed in toc either) … in combination with \addcontentsline{toc}{chapter}{test chapter} … which does make an entry in the TOC for the current chapter.

Is there anyway to modify the solution given above for my particular case? I want an unnumbered entry in the toc, and also no title header on the chapter's starting page – for a single chapter only.

I tried to modify the above solution for my case as follows:

\makeatletter
\newcommand{\unchapter}[1]{%
  \begingroup
  \let\@makechapterhead\@gobble % make \@makechapterhead do nothing
  \chapter*{#1}
  \endgroup
}
\makeatother

\unchapter{test chapter}

But this still causes a chapter title header to be printed on the chapter's starting page.

Recap:. The first solution works (as far as not printing a title on the chapter's starting page – which is what I want) … but makes the toc entry as a numbered chapter (whereas I need an unnumbered entry for the chapter in the toc).

My attempt to modify the first solution, given as the second solution … still makes a chapter's start contain a printed header.

Best Answer

The solution is already in start chapter with no headings

(1) Second chapter starts without heading

(2) An entry is added to the ToC

(3) Links in ToC works fine.

b

Link of Test unchapter remits to page 5, the starting of the chapter without headings.

e

\documentclass[12pt,a4paper]{book}

\usepackage{hyperref}   

\usepackage{kantlipsum}% only dummy text

\makeatletter
\newcommand{\unchapter}[1]{% FROM https://tex.stackexchange.com/a/624410/161015
    \begingroup
    \let\@makeschapterhead\@gobble % make \@makechapterhead do nothing
    \chapter*{#1}
    \addcontentsline{toc}{chapter}{#1}
    \markboth{#1}{}
    \endgroup
}
\makeatother


\begin{document}
\tableofcontents

\chapter{One}
1. \kant[1]

\unchapter{Test unchapter}
2. \kant[2]

\chapter{Two}

3. \kant[3]     
    
\end{document}
Related Question