4

How can I hide just one link in a document? (I'd like to be able to create a "secret link" that is like an Easter egg that readers can find if they look carefully.)

\documentclass{article}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}

\begin{document}
\href{https://www.google.com/}{This link is colored blue.}

\hypersetup{hidelinks}
\href{https://www.google.com/}{This is a hidden link, not colored.}

\hypersetup{hidelinks = false} % This doesn't work
\href{https://www.google.com/}{I want this link to not be hidden, like the first one.}

\end{document}
littleO
  • 1,153
  • 1
    Have you read this discussion? https://tex.stackexchange.com/questions/389740/making-text-difficult-but-not-impossible-to-read – AndréC Aug 09 '18 at 19:21

1 Answers1

7

Use a group instead of resetting the key. Grouping limits the scope of the value assignment.

\documentclass{article}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}

\begin{document}
\href{https://www.google.com/}{This link is colored blue.}

\begingroup
\hypersetup{hidelinks}
\href{https://www.google.com/}{This is a hidden link, not colored.}
\endgroup

\href{https://www.google.com/}{I want this link to not be hidden, like the first one.}

\end{document}
TeXnician
  • 33,589