linebreak in url with Bibtex and hyperref package

If you mean the too-wide spacing, that's because the URLs seems to not allow line-breaks. Why this happens is another question, and the answer depends on your preamble (the packages you use etc.). In principle, if properly used, the url package should allow line breaks.

EDIT This problem (and its solution) is described here (sending you to a Google cache since the site is offline at the moment). Bottom line: either use the breakurl package, or PDFLaTeX, or both.


You should use them in this order:

\usepackage[hyphens]{url}
\usepackage{hyperref}  

You get this error when you use them the other way around.

! LaTex Error: Option clash for package url.

since the hyperref package loads the url package somewhere internally without that hypens option, and then you want to load it with the option, so it clashes.

Turning the order around does what you want and does not give this error (since the package is already loaded hyperref won't load it again with different options)

edit: this was with pdftex, I did not test with other tools.

edit2:

or as mentioned by PatrickT in a comment: \PassOptionsToPackage{hyphens}{url} if you're using a class that already loads the package, e.g. beamer.


I just ran across almost the same problem and found it solved by putting

\PassOptionsToPackage{hyphens}{url}

before the

\usepackage[...]{hyperref}

Tags:

Latex

Bibtex