Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know how to include table of contents into a table of contents....

I have an example of how to spoof it into the toc - using \phantomsection - but it seems like when i have a long document the link goes a bit wrong - ie. it links to a couple of pages before.....

\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents

Example:

\documentclass[12pt, a4paper, twoside]{book}
\usepackage[english]{babel}
\usepackage{amsfonts,dsfont}
\usepackage[final]{pdfpages}
\usepackage{hyperref} 

%----------------------------------------------------------------------------------
\begin{document}
\pagenumbering{roman} 
%----------------------------------------------------------------------------------

%----------------------------------------------------------------------------------
\thispagestyle{empty}
\begin{titlepage}
{\Large
\begin{center}
{\bf XXXXXXXXXXXXXXX}
\end{center}
}
\end{titlepage}
%----------------------------------------------------------------------------------

\phantomsection
\addcontentsline{toc}{chapter}{Contents}
\tableofcontents


\phantomsection
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables

%----------------------------------------------------------------------------------

\newpage
\setcounter{page}{1}
\pagenumbering{arabic}

\chapter{XXXXX}
\label{chXXXXX}

\section{Introduction}\label{chXXXXX_Intro}
BLAH BLAH BLAH. 

%----------------------------------------------------------------------------------

%--------------------
\setboolean{@twoside}{false}
\end{document}
share|improve this question
3  
Instead of using \phantomsection \addcontentsline{toc}{chapter}{Contents} you can load the tocbibind package. –  Gonzalo Medina Mar 30 '13 at 21:15
2  
Just out of interest: why does one want to do so? When I'm reading the TOC, I should actually be able to find the TOC without having to look into the TOC… as you see, this is a bit self-referencial. –  Benedikt Bauer Mar 30 '13 at 21:29
2  
Fair point. I guess the point is more - not so much to add it to the table of contents instead to the bookmarks in the e version - for easy navigation. It seemed a bit weird when i looked at the bookmarks that it noted the abstract, talks/papers, and then no bookmarks through to the first chapter - missing the TOC, lists of figures, tables etc. Adding it to the table of contents as well is nice - because it makes the bookmarks+TOC the same. (I should note I'm writing my thesis - it has a lot of crap required at the beginning). Anyway - I love self referential stuff - just like this comment. –  JPH Mar 30 '13 at 21:42
1  
Looks like your question was some kind of xy problem. The problem that you state in your comment may be solve in this question –  Benedikt Bauer Mar 30 '13 at 21:52
2  
An explicit page break (\newpage, \clearpage, or \cleardoublepage) before \phantomsection is missing to ensure that \phantomsection is at the top of the right page. –  Heiko Oberdiek Mar 30 '13 at 22:54
show 5 more comments

1 Answer

Ok.... Superfast answer\comment from Gonzalo Medina

Instead of using \phantomsection \addcontentsline{toc}{chapter}{Contents} you can load the tocbibind package. – Gonzalo Medina 3 mins ago


Example becomes:

\documentclass[12pt, a4paper, twoside]{book}
\usepackage[english]{babel}
\usepackage{amsfonts,dsfont}
\usepackage[final]{pdfpages}
\usepackage{hyperref}

\usepackage{tocbibind}


%----------------------------------------------------------------------------------
\begin{document}
\pagenumbering{roman}
%----------------------------------------------------------------------------------

%----------------------------------------------------------------------------------
\thispagestyle{empty}
\begin{titlepage}
{\Large
\begin{center}
{\bf XXXXXXXXXXXXXXX}
\end{center}
}
\end{titlepage}
%----------------------------------------------------------------------------------

\tableofcontents
\listoffigures
\listoftables

%----------------------------------------------------------------------------------

\newpage
\setcounter{page}{1}
\pagenumbering{arabic}

\chapter{XXXXX}
\label{chXXXXX}

\section{Introduction}\label{chXXXXX_Intro}
BLAH BLAH BLAH.

%----------------------------------------------------------------------------------

%--------------------
\setboolean{@twoside}{false}
\end{document} 
share|improve this answer
    
Ok... can't accept it just yet... –  JPH Mar 30 '13 at 21:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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