1

I am trying to \renewcommand the second argument of the \hrefcommand (\href{URL}{text in the PDF pointing to the URL}).

What I want to do is to display the text which points to the URL (URL passed as the first argument of the command) in italics.

A solution would be to wrap my text pointing to the URL in \textit, as shown here, however, I am trying to renew the command such that I don't have to wrap the text in \textit every time I will insert a text pointing to an URL.

BCArg
  • 167

1 Answers1

3

You can patch the command with xpatch:

\documentclass{article}
\usepackage{hyperref}
\usepackage{xpatch}
\xpatchcmd\href{\begingroup}{\begingroup\itshape}{}{\fail}

\begin{document}
\href{http:~_bxx%}{sometext}

\end{document}

enter image description here

Ulrike Fischer
  • 327,261