I'd like to put a list of pages, hyperlinked to the position of the \eqref
or \cref
that point to it in the margin of each \label
ed equation, like backref
does for bibliographies and \cite
.
Both this answer for \ref
and this one for a figure list don't support hyperref
links, deduplication and ranges like backref
. (Edit: see below and first comment, turns out to not be that hard).
Edit: so my main problem is displaying text in the margin next to an equation's tag.
Edit 2: posted my current solution as an answer
Edit 3: It doesn't work with cleveref
because that patches \label{X}
in a way that \df@label
now contains {X}
instead of just X
as before which breaks \refsto
. No idea how that happens, or how I could remove the {}
. Edit 4: actually it's when amsmath
is loaded before cleverref
. But it must be loaded before, because \cref
can't be used to refer to equations otherwise.
Edit 5: found a way to remove {}
if present, is there a builtin command for this?
\def\maybeWithBraces{foo} % this
\def\maybeWithBraces{{foo}} % or this
\def\@identity#1{#1}
\def\@@identity#1{\@identity#1}
\edef\withoutBraces{\expandafter\@@identity\maybeWithBraces}
% \withoutBraces→foo in both cases.