Tx · LaTeX & TikZ

Set a Hyperref Link’s Highlight Style to None

Published By the 9to5Science editorial team

At a glance

  1. 1. Set the PDF option

    Use hyperref’s pdfhighlight option with the value /N.

  2. 2. Compile to PDF

    Build the document with a PDF-producing LaTeX engine so the setting is written into the PDF.

  3. 3. Check the viewer

    Open a link in a PDF viewer; viewer behavior can vary.

To stop a PDF link from using the default invert effect while a mouse button is pressed over it, set hyperref’s pdfhighlight option to /N. This changes the highlight mode recorded in the PDF; it does not disable the link or remove its normal appearance.

Minimal example

\documentclass{article}
\usepackage[pdfhighlight=/N]{hyperref}

\begin{document}
Follow the \href{https://www.example.com}{example link}.
\end{document}

Compile this with a PDF-producing engine such as pdfLaTeX, LuaLaTeX, or XeLaTeX. The link remains clickable, but the PDF requests no visual change while a mouse button is pressed over it.

If hyperref is already loaded, set the option afterward with:

\hypersetup{pdfhighlight=/N}

Place \hypersetup after loading hyperref, and before the links you want it to affect.

What the values mean

The pdfhighlight setting controls the highlight mode for PDF link annotations while a mouse button is pressed over them. The common values are:

ValueEffect
/NNo highlight effect
/IInvert the annotation’s appearance; this is hyperref’s usual default
/OShow an outline effect
/PShow a pushed-in effect

The PDF viewer determines how these effects look in practice. Some viewers show little or no visible change, even when a highlight mode is set.

Highlighting is not the same as a border

pdfhighlight controls what happens while a mouse button is pressed over a link. It is separate from the link’s ordinary visible appearance, including any border around it. For example, this setting removes the border:

\hypersetup{pdfborder={0 0 0}}

That does not select the highlight mode. Conversely, pdfhighlight=/N does not necessarily remove a border. Use the option that matches the visual feature you want to change; you can set both options if needed.

Common mistakes

  • Using pdfborder to change the highlight effect: pdfborder controls a border, not the highlight mode. Use pdfhighlight=/N for no highlight while a mouse button is pressed over the link.
  • Using hidelinks as a substitute: hidelinks changes the ordinary link styling, such as colors and borders. It does not specify the PDF annotation’s highlight mode.
  • Expecting every viewer to behave identically: The option is written into the PDF, but a viewer may ignore or render the requested effect differently.
  • Expecting the link to stop working: /N requests no visual highlight; it does not deactivate the link.

References

  1. The hyperref package documentation

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.