hyperref makes PDFs with awesome features


A PDF file can be more than just an image.

If you’ve copied text and pasted it from a PDF (or opened a JSTOR scan and discovered you couldn’t), then you know that a PDF is not just a picture for printing but a hypertext in its own right. If you use modern TeX at all, you know that pdflatex and xelatex produce well-behaved PDFs that can indeed be copied from. (In the old days, when you had to use a tex to dvi to postscript to pdf workflow, things were not so reliable.)

But you may not know that the hyperref package works in conjunction with pdf/xelatex to add extra richness to your PDFs. As you’d expect, it helps you typeset URLs and makes those URLs clickable hyperlinks. But by default, hyperref will also automatically create a set of “bookmarks” based on your section headings, respecting the chapter/section/subsection hierarchy. (These bookmarks appear as a sidebar table of contents in most PDF viewers.) Pretty nice, right?

hyperref also automatically makes footnote anchors (the numbers/symbols in your text that mark a footnote) clickable links to the footnote text itself. The hyperref documentation warns that this behavior is “easily broken” (it can be switched off with the package option hyperfootnotes=false), but I have found it to work pretty well. It can get confused if complex things happen with floats and pagebreaks.

And this is the really magical thing I discovered only a few days ago. hyperref and biblatex play well together. In particular, hyperref will make every \cite of a particular source a clickable link back to the first \cite, so that readers who see an “ibid.” or a shorthand abbreviation can click it to see the first, full reference. This works even with highly minimal cites like a postnote-only citation generated with biblatex’s \notecite and \pnotecite commands. The markup \pnotecite[16]{stevens:cpp} typesets as simply “(16),” but in the PDF that page number is a clickable link back to my first, full citations of stevens:cpp.

I haven’t yet played with generating a bibliography alongside my footnotes; it would be neat to see if hyperref and biblatex could create links between a bibliography and notes. That would alleviate my main complaint about short-citations-plus-bibliography books (I hate having to fish in the back to figure out what a telegraphically-cited source is).

Indeed, the clickable-footnote-anchor feature means that hyperref also makes PDFs that defeat my main complaint about endnotes—I hate having to turn pages / scroll all the way to the end and hunt for the note. In combination with the “back” feature of any good PDF viewer, endnotes become almost as tractable for reading as foodnotes.