
Me gustaría cambiar la fuente de todos los enlaces producidos por hyperref
, por ejemplo, a sffamily
. Con este fin, utilicé el etoolbox
paquete para parchear el \Hy@colorlink
comando de la siguiente manera:
\usepackage{etoolbox}
\makeatletter
\patchcmd{\Hy@colorlink}{\begingroup}{\begingroup\sffamily}{}{}%
\makeatother
Esto funciona para todo tipo de enlaces, excepto para las notas a pie de página. No tengo idea de por qué este es el caso. A continuación se incluye un ejemplo de trabajo mínimo para su comodidad.
¡Gracias de antemano por su ayuda!
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage{etoolbox}
% This throws an error
%\AtBeginDocument{%
% \makeatletter
% \patchcmd{\Hy@colorlink}{\begingroup}{\begingroup\sffamily}{}{}%
% \makeatother
%}
\begin{document}
\makeatletter
\patchcmd{\Hy@colorlink}{\begingroup}{\begingroup\sffamily}{}{}%
\makeatother
\tableofcontents
\section{A section}\label{sec:toto}
\begin{enumerate}
\item Pageref: page~\pageref{sec:toto}.
\item All links have the new font except footnotes: One\footnote{One} two\footnote{Two} three.\footnote{Three}
\end{enumerate}
\end{document}
Respuesta1
El comando estándar para crear marcas de notas al pie contiene un comando \normalfont. Si lo quitas, funciona.
\documentclass{article}
\usepackage[colorlinks]{hyperref}
\usepackage{etoolbox}
\makeatletter
\AtBeginDocument{%
\patchcmd{\Hy@colorlink}{\begingroup}{\begingroup\sffamily}{}{}%
\patchcmd{\@makefnmark}{\normalfont}{\selectfont}{}{}%
}
\makeatother
\begin{document}
\tableofcontents
\section{A section}\label{sec:toto}
\begin{enumerate}
\item Pageref: page~\pageref{sec:toto}.
\item All links have the new font except footnotes: One\footnote{One} two\footnote{Two} three.\footnote{Three}
\end{enumerate}
\end{document}