hyperref icon indicating copy to clipboard operation
hyperref copied to clipboard

Support different color for footnote links

Open nplatis opened this issue 3 years ago • 1 comments

Currently, some types of links can have their own color. I would suggest extending this to footnote marks. It seems doable as shown in https://tex.stackexchange.com/questions/117943/hyperref-footnotes-and-section-ref-colors So, unless there are other side effects, I would suggest providing a relevant package option.

nplatis avatar Jul 15 '22 09:07 nplatis

The standard link types describe technical differences in the PDF/backends (link is a GoTo link, file a gotoR, url a URI etc).

The answer you link to changes the link context, an argument which can be used to specify a semantic meaning for a subtype of links of the GoTo type.

While that can be useful, I don't think that hyperref should start to add options for all sort of semantic meanings (beside footnotes one could think of e.g. acronym links, glossaries, index links). Already the citecolor option (which is such an semantic link) doesn't really fit.

Instead with the new pdfmanagement and the new hyperref driver used by it, you will be able change the footnote colors through a hook:

\DocumentMetadata{}
\documentclass{article}
\usepackage{hyperref,etoolbox}
\hypersetup{colorlinks}
\makeatletter
\patchcmd\@footnotemark{{link}}{{footnote}}{}{\fail}
\makeatother

\ActivateGenericHook{hyp/link/footnote}
\AddToHook{hyp/link/footnote}{\hypersetup{linkcolor=blue}}


\begin{document}


\section{abc}\label{abc}
normal reference \autoref{abc} \nameref{abc}

and a footnote\footnote{my footnote}

\end{document}

What hyperref should do it to allow to change the context for footnotes without patching @footnotemark.

u-fischer avatar Jul 15 '22 10:07 u-fischer