I am wanting to include a link within some highlighted text. The highlighting is currently being performed by the soul package but the following example shows it returns a bunch of warnings and fails to render the link:
\documentclass{book}
% Package used for highlighting
\usepackage{soul}
% Link setup
\usepackage[ps2pdf]{hyperref}
\hypersetup{breaklinks=true, colorlinks=true, linkcolor=black, urlcolor=blue}
\usepackage[anythingbreaks]{breakurl}
\begin{document}
Link works here: \url{http://google.co.uk/}
Link within highlight fails: \hl{ Highlight \url{http://google.co.uk/} link }
\end{document}
Package hyperref Warning: Rerun to get /PageLabels entry.
! Undefined control sequence. l.14 Complains when link is within
highlight: \hl
{ Highlight link \url{http…
Any idea how I can get links to appear within the \hl
command?
Best Answer
The
\url
command is fragile. The following works.