How to style text in hyperref \url?
Internally \url
uses \UrlFont
. You can change it with \urlstyle
(see the documentation of url
in url.sty
) or by redefining \UrlFont
:
\documentclass{memoir}
\usepackage{hyperref,xcolor}
\begin{document}
Lala \url{www.example.com}.
\urlstyle{sf}
Lala \url{www.example.com}.
\renewcommand\UrlFont{\color{red}\rmfamily\itshape}
Lala \url{www.example.com}.
\end{document}
Use \href
instead:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\href{http://www.example.com}{\textit{www.example.com}}.
\end{document}
This takes two arguments: the first is the actual url, the second is the link text. The above code produces
In my case I wanted to provide link colored in blue and to be clickable, also I wanted to display the url what I did what to setup a custom command my mixxing commands xcolor
and hyperref
packages:
\usepackage{hyperref}
\usepackage{xcolor}
\newcommand{\link}[1]{{\color{blue}\href{#1}{#1}}}
So using the snippet:
\documentclass[a4paper]{article}
\usepackage{hyperref}
\usepackage{xcolor}
\newcommand{\link}[1]{{\color{blue}\href{#1}{#1}}}
\begin{document}
\begin{itemize}
\item \textbf{Desktop APP}: \link{https://github.com/signalapp/Signal-Desktop}
\item \textbf{Android APP}: \link{https://github.com/signalapp/Signal-Android}
\item \textbf{iOS APP}: \link{https://github.com/signalapp/Signal-iOS}
\end{itemize}
\end{document}
I have the following result: