4

Using the package hyperref, the command \href takes two inputs, the destination and the description. Upon compiling using LaTeX, the description become a link and has a little box around it. My descriptions are long and I'd like them to have line breaks (even though the box would look a bit funny). The descriptions are not URLs and I couldn't make the breakurl package work for this purpose. Any suggestions?

Here is an example:

Bozo, C and Dufu, S. \textit{How not to succeed.}
\href{http://www.google.com}{To appear in a fancy journal}.

Any ideas? Thanks!

  • 2
    You could use color links, \usepackage[colorlinks=true]{hyperref} which changes the boxes as an indication of link to colors. – JPi Jul 31 '16 at 19:12
  • 2
    As an aside, if this is a bibliography then it would be better to use bibtex with a url field. – JPi Jul 31 '16 at 19:13
  • You could put the description inside a \parbox, but you need to figure out how wide to make it. – John Kormylo Jul 31 '16 at 21:17
  • JPi - thanks, colorlinks=true fixed the problem. If you submit it as an answer I'll accept. Unfortunately, this reference is in the text, not in bibliography, so bibtex won't help me here. – Quasi Kevin Aug 1 '16 at 16:48
1

Use \usepackage[hyphens]{url} in the preamble. Try

\usepackage[hyphens]{url}
\usepackage[%
pdftex,%
colorlinks=true,%
hyperindex,%
plainpages=false%
]{hyperref}

%Also Add this for having different colors for the citation links.
\makeatletter
\AtBeginDocument{\def\@citecolor{blue}}
\makeatother
  • Hmm, couldn't make this work. It gave an error when used in combination with the hyperref package. – Quasi Kevin Aug 1 '16 at 16:47
  • @QuasiKevin.. It's now been edited. Use url and hyperrref as mentioned above. Hope it would suffice your need. Check. – Mishra S Aug 2 '16 at 10:32

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.