3

I am looking to change the font of only the links in the LaTeX as italics.

\hypersetup{%
linkcolor=black,
font=italics,
unicode%
}

2 Answers2

5

It's possible to modify the definition of colorlink to change the font to italics, similar to the existing frenchlinks option (which changes the font to small caps). Note that the definition should be provided after \begin{document}, otherwise hyperref can overwrite the modifications with the default values.

MWE:

\documentclass{article}
\usepackage[colorlinks]{hyperref}
\begin{document}
\makeatletter
\def\Hy@colorlink#1{\begingroup\fontshape{it}\selectfont}%
\makeatother
See \autoref{sec:first}.
\section{First section}
\label{sec:first}
\end{document}

Result:

enter image description here

Marijn
  • 37,699
  • 2
    Maybe \fontshape{\itdefault} in case the italic shape of the current font isn't called it. – Phelype Oleinik Jun 28 '18 at 11:34
  • @PhelypeOleinik that is probably better indeed. Note that the definition of frenchlinks (on which my answer is based) uses sc and not scdefault - but that doesn't mean that it's right of course :) – Marijn Jun 28 '18 at 12:04
  • 1
    Indeed. Try this, for example: \documentclass{article} \usepackage[garamond]{mathdesign} \usepackage[frenchlinks]{hyperref} \begin{document} \section{test}\label{sec:test} See~\ref{sec:test} \end{document}. I get a warning: Font shapeT1/mdugm/m/sc' undefined(Font) using T1/mdugm/m/n' instead. Should it be reported to the maintainer? – Phelype Oleinik Jun 28 '18 at 12:10
-1

if used just once or twice,

\textit{\url{www.url.com}}

or

\textit{\href{https://url.com}{URL}}
Werner
  • 603,163