38

I am using the following code.

\newpage
\section*{Abstract}
\addcontentsline{toc}{section}{Abstract}

\newpage
\tableofcontents
\addcontentsline{toc}{section}{Table of Contents}

\newpage
\listoftables
\addcontentsline{toc}{section}{List of Tables}

\newpage
\listoffigures
\addcontentsline{toc}{section}{List of Figures} 

In my actual document, I have many sections, so the table of contents is actually two pages long. Unfortunately, when I run my LaTeX file, the 'Table of Contents' section in the Table of Contents has the incorrect page number (while everything else seems to be in order). It looks like the Table of Contents is using the page number of the second page, instead of the first page.

e.g. In the Table of Contents, 'Table of Contents' is listed as being under page iii, when actually it starts on page ii. Page iii is actually the second page of my Table of Contents.

Anybody know a quick fix for this?

2
  • 6
    Try putting \addcontentsline{toc}{section}{Table of Contents} before \tableofcontents.
    – user11232
    Sep 28, 2012 at 1:28
  • Hi Suzu Welcome to TeX.SE! Code snippets are good, but a complete MWE would be even better- could you make one to help folks? :)
    – cmhughes
    Sep 28, 2012 at 1:28

5 Answers 5

44

Change the order of \addcontentsline:

\newpage
\section*{Abstract}
\addcontentsline{toc}{section}{Abstract}

\newpage
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents

\newpage
\addcontentsline{toc}{section}{List of Tables}
\listoftables

\newpage
\addcontentsline{toc}{section}{List of Figures} 
\listoffigures

If the hyperref package is going to be used, you might add \phantomsection to produce the right anchors for hyperlinks:

\newpage
\phantomsection
\addcontentsline{toc}{section}{Table of Contents}
\tableofcontents

As a suggestion, instead of using "manual" names, you could use the macros containing the pre-defined names; so instead of

\addcontentsline{toc}{section}{List of Figures}

you could say

\addcontentsline{toc}{section}{\listfigurename}
1
  • 3
    \phantomsection worked perfectly for my issues in \subsubsection of the index linking to page 1 instead of the correct page. Thanks very much!
    – Docconcoct
    Sep 28, 2015 at 18:06
17

I had the same problem, and changing the order of \addcontentsline solved a major part of it, but then my numbers were off by one. To solve that, I put \clearpage (or \cleardoublepage if you are doing double sided) before every \addcontentsline.

2
  • 1
    This seems to shift the number up one, but I have the opposite problem. How can I shift the toc number down one?
    – Steve
    Jan 19, 2017 at 22:13
  • This was really helpful, thanks! Sep 10, 2020 at 17:50
3

Now a day, mostly we prefer to the hyperlink. Thus if printing in the double side, which is usually a case for Thesis or reports.

So, the best command even removing the page number in the blank page:

\phantomsection
\addcontentsline{toc}{chapter}{ Contents}  \raggedbottom \pagebreak \thispagestyle{empty}
\tableofcontents  \raggedbottom \pagebreak \thispagestyle{empty}


\cleardoublepage  % \clearpage (if using single side)
\phantomsection
\addcontentsline{toc}{chapter}{ List of Figures}  \raggedbottom \pagebreak \thispagestyle{empty}


\listoffigures  \raggedbottom \pagebreak \thispagestyle{empty}
\cleardoublepage  % \clearpage (if using single side)

\phantomsection
\addcontentsline{toc}{chapter}{ List of Tables} 
\listoftables  \raggedbottom \pagebreak \thispagestyle{empty}
0

If you're still stuck, as I was, after trying the above, this worked for me.

Sometimes our compiler doesn't realise it needs to run latex again to get the table of contents numbering correct. Try adding the following line: \phantom{\cite{?}} somewhere in your code. This include an invisible citation which doesn't exist and will trick our compiler into running the maximum number of times.

(found at https://tex.stackexchange.com/a/116014/56834)

-2

Set the page counter inside your abstract to the page number you desire

\begin{abstract}

    \thispagestyle{plain}
    \pagenumbering{roman}
    \setcounter{page}{5}

    This is the starting of abstract text.

\end{abstract}
1
  • 3
    This has nothing to do with an abstract.
    – Werner
    Jun 22, 2016 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .