TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've discovered a rather weird behaviour of PdfLaTeX. In this example


PdfLaTeX won't break the URL and create a too long line. However, if I replace \url with \href like this:


I get the line broken, but the font of the link is not right any more of course (normal instead of texttt). Why doesn't URL break the line at dashes and what could I do to get a nicely typeset line-broken link?

share|improve this question
up vote 23 down vote accepted

Load the url package explicitly with the hyphens option:


By default, the url package does not consider hyphens as legal break points.

share|improve this answer
Beautiful, thank you! – texnic Mar 28 '12 at 10:02
Incidentally, there's a good reason for the default: if a URI gets broken at a hyphen, the user may not know whether the hyphen is a part of the URI or an artifact of an intrusive H&J routine. Obviously that doesn't apply in the present case of a news story where the URI has lots of hyphens, but I would caution against using the [hyphens] option as a matter of course. – Peter Flynn Oct 5 '15 at 20:46

The above answer by mhp may not provide a solution when PDFLaTeX complains with "Option clash for package url."

The cause of this may be because of the package hyperref, which also loads the package. If hyperref is loaded before the url package it gives this error, because the url package is then loaded twice with different options: one without and one with hyphens option (this always causes a clash).

If you must load url after hyperref, you can first specify the hyphens option with the PassOptionsToPackage command:


Note that you do not need to provide the hyphens option a second time when loading the url package.

I noticed that the biblatex package apparently also clashes with url. Therefore, the same goes for biblatex as for hyperref: load url before it or use PassOptionsToPackage.

To moewe and Heilo; I know, I'm sorry and I would have, but as you said, I cannot make comments until a I have a certain 'reputation'. So I will edit my 'answer' to turn it into a real answer. Maybe I shall now collect enough reputation ;-)

Strange, my other post is deleted, and it still advised me to edit that one rather than making a new one! (It also was still visible, in red!)

share|improve this answer
This did not work for me I received a different error though: Undefined control sequence. \loadpackage{hyperref} – Whitecat Mar 9 at 21:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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