30

I often generate reports from pdfLaTeX using TeXworks, and would like to generate a document index, which will appear in the sidebar of a PDF viewer, (e.g. evince, Adobe Reader). Are there any packages which will allow me to do so?

levyd
  • 589
  • 2
  • 5
  • 8

2 Answers2

55

Just add the following to the preamble of your document:

\usepackage[bookmarks]{hyperref}

The bookmarks option generates this "index" by adding bookmarks for sections and lists (of figures, of equations, and so on).

Besides, using this will turn references and urls inside the documents into links, making your document "browseable".

  • Be sure to also add \addcontentline commands where appropriate to generate contents of the `index'. - @vyudh – Adam Harte Aug 21 '12 at 23:58
  • 3
    With `\addcontentline` I get "undefined sequence". With `\usepackage[bookmarks]{hyperref}` I get only one bookmark for the whole document, it makes sense because it is for the proceedings in LNCS, but I don't know how to change the way that template works wrt that, and that would be very useful for my thesis. – Trylks Oct 03 '12 at 14:56
  • 1
    @Trylks If you are using hyperref with the standard classes, you will get a bookmark for every chapter and section in your document. If you do not, your document is somehow special. Compile a minimal example to demonstrate your problem, and head over to http://tex.stackexchange.com/ to get it solved. –  Oct 04 '12 at 09:45
  • I've found that even without using `[bookmarks]` you still get an index for the PDF that matches up to the corresponding sections. It's noted as "Index" rather than "Bookmarks" for Document Viewer on Ubuntu, at least, but it's there. – JAB Oct 09 '15 at 17:35
3

just wanted to add that this (using the package hyperref for getting the pdf-index) works when usig pdflatex and not when using latex->dvips->ps2pdf (don't know about the other alternatives)

i recently found out that using pdftex is apparently the best choice when you don't need the ps output