[Tex/LaTex] Suppress/remove sectioning (heading) from table of contents

page-breakingsectioningtable of contentsvertical alignment

(NB: not the same question as How to remove “Contents” line from table of contents [closed])

Please consider the following MWE, compiled with pdflatex test.tex:

\documentclass[twoside,a4paper]{book}

\begin{document}

\section{TOC}

\tableofcontents

\cleardoublepage

\section{Sect 1}

\section{Sect 2}

\section{Sect 3}

\end{document}

This gives me:

  • pg 1: "0.1 TOC" heading
  • pg 2: blank
  • pg 3: "Contents" heading (+ toc)
  • pg 4: blank
  • pg 5: "0.2 Sect 1"; "0.3 Sect 2" and "0.4 Sect 3" (as expected)

Now, what I would like to do, is have the heading for the table of contents set by a \section command (the \section{TOC}) – and I'd like the contents table to continue as a paragraph would continue after a \section; or – my expected result would be:

  • pg 1: "0.1 TOC" heading (+ toc)
  • pg 2: blank
  • pg 3: "0.2 Sect 1"; "0.3 Sect 2" and "0.4 Sect 3" (as expected)

Obviously, in the example above, the \tableofcontents command first clears a double page – then inserts its own heading.

In other words, I'd like to suppress this heading inserted by \tableofcontents – however, not merely by \renewcommand\contentsname{}; because I'd also like to reclaim the vertical space that the toc heading usually claims (because it's actually a \chapter, I guess). How do I do that?

Best Answer

OK, I think I got it, thanks to answer #47241 How to remove the self-reference of the ToC from the ToC?:

... found that I can simply not use \tableofcontents, and instead use:

\makeatletter
\@starttoc{toc}
\makeatother

This doesn't create a section for the table of contents, so the problem goes away.

And indeed, seems to work for above MWE too:

\documentclass[twoside,a4paper]{book}

\begin{document}

\section{TOC}

% \tableofcontents
\makeatletter
\@starttoc{toc}
\makeatother

\cleardoublepage

\section{Sect 1}

\section{Sect 2}

\section{Sect 3}

\end{document}

Hope this is the way to do this :) Cheers!