5

I have a little bit of problem. I have to put the title of toc into toc. I've used the following code to do that and it works for me, kind of. The problem is in the title is aligned with the titles of the chapters and not with list of figures etc.

{
\makeatletter
\let\@oldstarttoc\@starttoc
\renewcommand{\@starttoc}{%
  \addcontentsline{toc}{chapter}{\protect\numberline{}\contentsname}% Add ToC to ToC
  \@oldstarttoc
}
\tableofcontents
\makeatother
}

Here is the picture of my toc.

enter image description here

My idea is to use the same code for Acknowledgements, Lists of... , Abbreviations etc. Is it ok to try that or there is an alternative?

3
  • Lovely question: my problem, at least with Google docs, is the inverse: making sure that the header of table of contents does not show in the table of contents.
    – Yossi Gil
    Jan 15 '14 at 7:47
  • 4
    Just drop the \protect\numberline{} in your definition.
    – Werner
    Jan 15 '14 at 7:50
  • What is the point of adding the Acknowledgements and the Table of Contents to the Table of Contents? The ToC is supposed to help readers find the parts that are interesting to them. Once they reach the ToC, they supposedly have already seen the Acknowledgements and the ToC, so what is there to find?
    – Alex
    Jan 15 '14 at 9:52
6

Why don't you simply load the package tocbibind that automatically inserts ToC, LoF and LoT into the ToC itself?

MWE:

\documentclass{book}
\usepackage{tocbibind}

\begin{document}

\tableofcontents
\listoftables
\listoffigures
\chapter{test}

\end{document} 

Output

enter image description here

4
  • It works but spacings are bigger than it should be. I'll try to force the spacing somehow. Jan 15 '14 at 9:43
  • @ManuelCalavera Which spacing? Jan 15 '14 at 9:45
  • @ karlkoeller Spacing inside toc. It probably has to do something with my class file. Jan 15 '14 at 10:00
  • @ManuelCalavera I suggest you to ask a new question containing a minimal working example (MWE) that shows this. Jan 15 '14 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.