(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?
\renewcommand{\tableofcontents}and substituted the definition fromarticle.cls, which uses\section*and also "does the right thing" for running heads . (comparing the code for\tableofcontentsinbook.clsandarticle.clswould be instructive though; even better, look at the file from which the class files were generated (classes.dtxin thesource/latex/basebranch of the tex live tree) where there are some comments about how the code is constructed.) – barbara beeton Jul 02 '12 at 17:52