0

I would like to break an URL in my source file, using the \href command as follows:

\href{http://www.nature.com/authors/policies/
      data/data-availability-statements-data-citations.pdf}
 {data availibility}

where "data availibility" should appear in the PDF file, bearing (pointing to) the underlying URL. I tried using the \sloppy command, but the link is dead due to an extra whitespace. Could you please help me how to solve this problem?

2
1
\href{http://www.nature.com/authors/policies/%
data/data-availability-statements-data-citations.pdf}%
{data availibility}

Does this solve your problem?

You can't have a space between the curly brackets or in this URL, as this is not a way either the command or the URL can be recognized. % makes LaTeX ignore the space.

Alternatively, \href{http://www.nature.com/authors/policies/data/data-availability-statements-data-citations.pdf}{data availibility} would be the standard way to go about this.

3
  • You can't suppress spaces with % in an url. Feb 21 '20 at 13:30
  • But the line break seems to be ignored in this href here, for me the hyperref works with % in this example, and doesn't without %.
    – TivV
    Feb 21 '20 at 13:55
  • Hm. You are right, it actually ignores the one at the end. Feb 21 '20 at 15:03

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.