Wrap URL (ignores margin) in BibTeX using pdfLaTeX

Andee picture Andee · Nov 10, 2010 · Viewed 15.8k times · Source

I'm using the breakurl package and the hyperref package with pdfLatex and BibTeX to cite a url. The url is breaking, but not according to my margins. Is there any way I can make the url recognize my margins or force a line break? Thanks in advance.

Code:

\usepackage{hyperref} \usepackage[vertfit]{breakurl}

@MISC{cmm:dataset,
author = {University of Bristol Centre for Multilevel Modelling},
    title = {Datasets used in reviews},
    howpublished = {\url{http://www.cmm.bristol.ac.uk/learning-training/multilevel-m-software/exam.shtml}},
}

Answer

Diego Sevilla picture Diego Sevilla · Nov 10, 2010

Sometimes, when LaTeX cannot break lines nicely, it leaves them unadjusted. You can control that behavior putting \sloppy at the beginnig of your document and see if the behavior suits you more. Also, you have spaces in your URL, as I've seen in your post. Remove them. The url package usuallly does a nice job breaking urls (I have not used the breakurl package and my URLs break nicely by the slashes or dashes).