0

In my latex document which uses the report documentclass and hyperref package, I have the following code before the end of the document:

\bibliographystyle{plain}
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{refsaut}

The bibliography starts on page 91 and goes up to page 96 (say). The table of contents gives the page number for bibliography to be page 90 (which is incorrect), and clicking on the hyperlink in the ToC takes me to the chapter before the bibliography (this chapter actually starts on page 88).

If I change the order of the last two commands to the following:

\bibliographystyle{plain}
\bibliography{refsaut}
\addcontentsline{toc}{chapter}{Bibliography}

then, the page number given in the table of contents for the bibliography is page 96 (which is again incorrect). But at least now, clicking on the hyperlink in the table of contents does take me correctly to the bibliography chapter.

How do I fix this? I need to get two things: the page number in table of contents should be correct, and the hyperlink in table of contents should take me to the correct page.

  • 1
    Welcome to TeX.SX! The simplest solution is to add \usepackage[nottoc]{tocbibind} to the preamble, instead of trying to place \addcontentsline at a good spot. This will also solve the problem for the lists of figures and tables. – egreg Oct 30 '15 at 11:24
  • @egreg. Your solution worked for the bibliography, but I would also like the table of contents to appear as an item in the toc (which doesn't happen now) and in the side navigator pane to click on (it doesn't appear there also). – user123 Nov 12 '15 at 7:20
  • Remove nottoc – egreg Nov 12 '15 at 7:29
1

The simplest solution for the problem is to use the tocbibind package:

\usepackage[nottoc]{tocbibind}

The option removes the table of contents entry from the table of contents itself, which is the most common usage. If you need it there, just do

\usepackage{tocbibind}

No \addcontentsline is necessary: the package will take care of adding also the lists of tables and figures and the indices, if present.

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.