Previous: Hyperlink drivers pdftex and dvipdfm, Up: Hyperlink drivers


5.4.4 Hyperlink driver nolinks

Select this driver to suppress all hyperlinks in your document.

Selecting this driver is quite different from not selecting any driver at all, or from selecting some driver and then turning hyperlinks off for the entire document with \hloff and \hldestoff (see Turning hyperlinks on/off).

The purpose of \hldestoff and \hloff is to mark (parts) of your document where hyperlinks should never appear. (Imagine you want to prevent a cross-referencing macro from generating a link at a certain spot in your document.)

If instead you have prepared a document with hyperlinks and just want to compile a version without them, it is better to select the driver nolinks. This ensures that spacing and page-breaking are the same as what you were getting with hyperlinks enabled.

The reason for this is that hyperlinks are produced by the \special primitives or low-level hyperlink commands. Each such command is placed inside a whatsit (an internal TeX object), which may introduce legitimate breakpoints at places where none would exist without the whatsits. The macros \hldestoff and \hloff disable the hyperlink macros completely, so that no whatsits are produced.

In contrast, the nolinks driver does not completely disable hyperlink macros. Instead, it defines them to merely write to the log file (what gets written is unimportant). This also produces whatsits, thus imitating the whatsits from the hyperlink commands. (This trick was borrowed from the LaTeX `color' package.)

Another reason for using nolinks is that in horizontal mode \hldest places destinations inside boxes of zero width, height, and depth. When you say \hldestoff, \hldest will omit both destination definitions and these boxes. The missing boxes can again cause the typesetting to be inconsistent with that with destinations enabled. Here again, the nolinks driver helps by defining \hldest to produce the empty boxes.

So, if you are planning to produce versions of your PDF document both with and without hyperlinks, here is the recommended way to enable the hyperlinks under pdfTeX:

     \ifpdf
       \enablehyperlinks
     \else
       \enablehyperlinks[nolinks]%
     \fi