In the following sample, the second link isn't hyperlinked:
\documentclass{article}
\usepackage{amsmath} % Removing this makes the second link work
\usepackage{hyperref}
\begin{document}
\hyperref[abc-def]{link} % This link works
\(\textnormal{\hyperref[abc-def]{link}}\) % But not this one
\label{abc-def} Target
\end{document}
However, removing \usepackage{amsmath}
fixes the second link. Why is that? And how can I make the second link work without removing amsmath?
(This is a simplified example from auto-generated XeLaTeX sources, so modifying the code itself is rather inconvenient).
Here is a slightly larger example:
\documentclass{article}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
\hyperref[lbl]{term}
\(\textnormal{\hyperref[lbl]{term}}\)
\newpage
\subsubsection{Abc}
\phantomsection\label{lbl} def
\end{document}
\label{abc-def}Target
into\newpage Text\phantomsection\label{abc-def}Target
both links point to the intended destination.hyperref
behaves differently inside of a math block, but only when amsmath is loaded.\text...
commands are completely different if amsmath is loaded (they are a mathchoice so set at 4 different sizes internally so they work in subscripts)\text
before loading amsmath?