I have a URL in my bibliography which line-breaks in an unpleasant way.

The URL breaks as follows: http://www.mathworks.se/help/matlab/matlab_oop/(break) implementing-operators-for-your-class.html

I want to allow breaks at "-" so that the URL would look something like: http://www.mathworks.se/help/matlab/matlab_oop/implementing-operators-(break) for-your-class.html

I'm using a customized plainnat.bst file in order to get surnames first if that makes some difference.

  • Have you tried "\-" ? – C.Colden May 5 '14 at 14:03
  • Adds ..."(break)discretionary{-}{}{}"... so it doesn't work. – David May 5 '14 at 14:22

If the urls are typeset with the url package, then you can load it as


to allow breaks at hyphens. This is not the default, since these breaks can be confusing for the reader who doesn't know if the hyphen is actually part of the url or not. (With strings like implementing-operators-for-your-class.html that shouldn't be a problem.)

This answer is only about how to add these as possible breaks. The default breaks are still allowed (and I don't think there is anything unpleasant about them).

Often the url package isn't loaded explicitly, but from the hyperref package. Then just put this line before you load hyperref.

| improve this answer | |
  • Thank you for your help! One problem is that it doesn't work together with the hyperref package, is that a way of getting the benefits from both? I like the links within the document. – David May 5 '14 at 19:44
  • I didn't know you used hyperref. That's one danger of not giving a complete example in the question. But it's no problem; hyperref loads url, so it does indeed work. Load hyperref last. – pst May 5 '14 at 19:51
  • That's good. I added that about hyperref now. – pst May 6 '14 at 7:11

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.