2

I have a long url which I want to appear blue and underlined. Furthermore it must linebreak if the url is to long for a single line.

\documentclass[a4paper,10pt]{article}
\usepackage[colorlinks,urlcolor=blue,breaklinks=true]{hyperref}
\usepackage[hyphenbreaks]{breakurl}
\begin{document}
\underline{\href{http://www.atmel.com/Images/Atmel-11121-32-bit-Cortex-A5-Microcontroller\_SAMA5D3\_Datasheet.pdf}{http://www.atmel.com/Images/Atmel-11121-32-bit-Cortex-A5-Microcontroller\_SAMA5D3\_Datasheet.pdf}}
\end{document}}

The line-breaking is easy. The problem is when you want to have line-breaking and underlining. I tried what is described here: Is it possible to have italic and bold text, and linebreaks under the \underline{text} command?. The soul package also works but does not give really good results, meaning sometimes the underline is gone for a small part of the url and it gives often an extra space at the end of the url.

2

As far as I know, the most closer you can get to what you want is:

\documentclass[a4paper,10pt]{article}
\usepackage{hyperref}
\hypersetup{colorlinks=false,pdfborderstyle={/S/U/W 1},pdfborder=0 0 1}
\begin{document}

\url{http://www.atmel.com/Images/Atmel-11121-32-bit-Cortex-A5-Microcontroller\_SAMA5D3\_Datasheet.pdf}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\end{document}

However, clearly there is a problem regarding the underline and the line width. You can see through the multiple "text" that the underline stops at the end of line, instead of following the url size. I suggest you to not use underline. Try to use a colored link instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.