Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an enumerate. In an item I have a long url. I use the package breakurl and it works fine outside the enumerate but not in the item.

\item svn co \burl{ ABC-paper-2012}

How should I do to break the url ?

EDIT: If I remove the margin at 3cm it actually works. It seems to be an interaction between geometry and breakurl

share|improve this question

2 Answers 2

up vote 23 down vote accepted

It should be noted up front that the long-URL issues you are encountering can arise regardless of whether the URL occurs inside an enumerate environment or not.

By default, if a URL string contains a hyphen character, neither \burl of the breakurl package nor \url of the url package will insert a linebreak after a hyphen character. (This setting is chosen to avoid ambiguities over whether the hyphen character is a part of the URL string or not.) To override the default setting, load the breakurl package with the hyphenbreaks option or, equivalently, load the url package with the hyphens option set (and use the command \url instead of \burl, of course).

However, even with the hyphenbreaks/hyphens options set, overfull lines can still occur. An additional measure you may have to take is to issue the command \sloppy. This directive lets TeX expand the amount of interword whitespace (almost) arbitrarily to support its efforts to avoid overfull lines.

The following, modified form of your MWE shows how this works. The packages breakurl and url are loaded with the options hyphenbreaks and hyphens, respectively. Even so, the first two items in the enumeration, which use the \burl and \url commands, produce overfull lines. In contrast, the third and fourth items, for which the directive \sloppy is in effect, do not produce overfull lines. (By the way, in this MWE the scope of the \sloppy directive ends at the \end{enumerate} statement.)

\usepackage{lipsum} % load paragraphs of filler text

\lipsum[2] % generate some filler text (to show width of text block)

svn co \burl{ ABC-paper-2012}
svn co \url{ ABC-paper-2012}
svn co \burl{ ABC-paper-2012}
svn co \url{ ABC-paper-2012}

enter image description here

share|improve this answer
@Barth You can use \begin{sloppypar}...\end{sloppypar} to turn \sloppy on for just a part of the document. – Ethan Bolker May 8 '12 at 16:58
thank you so much for your help and explanation ! – Barth May 9 '12 at 6:47
When I click the URLs, they are not forwarded to correct addresses. Any part in the second lines are missing. For Item 1, 2012 is missing. Even worse, For Item 1, 'svn co' is added to the address. Any way to fix it? – FEQ Jul 3 at 19:21
@FEQ - The web address that the OP provided (and which I re-used in my answer) isn't active -- and, as far as I can tell, never was. Furthermore, the code in my answer doesn't load the hyperref package; hence, any hyperlinks that may exist are provided by the pdf file browser you use rather than by LaTeX and friends. Please clarify what you're trying to achieve. – Mico Jul 3 at 23:30
@Mico Thanks! You already gave me an answer! Yes the hyperlink was from my PDF viewer and when I loaded hyperref, it went all okay. – FEQ Jul 4 at 3:19

None of the answers helped me out. My long url was placed in a footnote. After searching around I found a working solution here.

In my preamble:


The last line instructs the url-package which is loaded with the hyperref-package to additionally break at the characters / and -. The option breaklinks=true in hyperref can be invoked too but for me it had no effect.

share|improve this answer
Hi and welcome, how about Forcing linebreaks in \url – Johannes_B Jul 10 at 18:41
The original post requested line breaks in document text, not \footnotes. – Werner Jul 10 at 18:52
I´m sorry, guys for the not perfectly matching answer. As a justification and a mapping to the real world where search phrases most often not match an exact question title (often because a user doesn´t know the terms yet), a user ends up at not perfectly matching threads. So there is always a chance a non-perfectly-matching answer offers the correct solution to a problem. This is my experience so far :) – Karl Jul 12 at 21:38
it should read \def\UrlBreaks{\do\/\do\-} I needed it to break at = and it would only work with the \ in front of the breaking char. even better would be \makeatletter \g@addto@macro{\UrlBreaks}{\do\/\do\-} \makeatother so you would not overwrite the original \UrlBreaks symbols – Garonenur Oct 31 at 15:05

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.