Hyperref: 각주를 포함한 모든 링크의 글꼴을 변경합니다.

Hyperref: 각주를 포함한 모든 링크의 글꼴을 변경합니다.

hyperref에서 생성된 모든 링크의 글꼴을 로 변경하고 싶습니다 sffamily. 이를 위해 패키지를 사용하여 다음과 같이 명령을 etoolbox패치했습니다 .\Hy@colorlink

\usepackage{etoolbox}
\makeatletter
\patchcmd{\Hy@colorlink}{\begingroup}{\begingroup\sffamily}{}{}%
\makeatother

이는 각주를 제외한 모든 유형의 링크에 적용됩니다. 왜 이런 일이 일어나는지 모르겠습니다. 귀하의 편의를 위해 최소한의 작업 예제가 아래에 포함되어 있습니다.

당신의 도움에 미리 감사드립니다!

\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}

여기에 이미지 설명을 입력하세요

답변1

각주 표시를 만드는 표준 명령에는 \normalfont 명령이 포함되어 있습니다. 제거하면 작동됩니다.

\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}

여기에 이미지 설명을 입력하세요

관련 정보