I must be doing something wrong that's really basic. Why do all my hyperlinks go to the first location, ie that of the FVR definition in the example below?
\documentclass{article}
\usepackage[allcolors=blue,colorlinks]{hyperref}
\usepackage{xspace}
\begin{document}
% Whenever I use an acronym, I want it to link back to the definition:
\newcommand\FVR{\hyperref[FVR]{FVR}\xspace}
\newcommand\SWB{\hyperref[SWB]{SWB}\xspace}
\newcommand\ABC{\hyperref[ABC]{ABC}\xspace}
\section{Intro}
foo
\newpage
\section{Defs}
Here's where we define \textbf{def FVR}'' (\textbf{FVR}\label{FVR}) \newpage some more text \newpage Here's where we define\textbf{ def SWB}'' (\textbf{SWB}\label{SWB})
\newpage Here's where we define ``\textbf{ def ABC}'' (\textbf{ABC}\label{ABC})
\newpage
\section{Main}
This sentence with {\FVR}ish (FVR) \FVR and \FVR, looks okay \FVR.
This sentence with {\SWB}ish (SWB) \SWB and \SWB, looks okay \SWB but points to the wrong location
This sentence with {\ABC}ish (ABC) \ABC and \ABC, looks okay \ABC but points to the wrong location
\end{document}
(\MakeLinkTarget{}\textbf{FVR}\label{FVR})(in older you can use \phantomsection, that does more or less the same). – Ulrike Fischer Jan 02 '24 at 19:00