Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrap URL (ignores margin) in BibTeX using pdfLaTeX

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}},
}
like image 208
Andee Avatar asked Nov 10 '10 16:11

Andee


2 Answers

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).

like image 200
Diego Sevilla Avatar answered Nov 07 '22 07:11

Diego Sevilla


Better to add 'breaklinks' to the options for hyperref or if using url explicitly format the url in the bibtex file "\url{http:....}". This fixed the problem for me. You may still need to redefine the format for the url if the default box does not suit your purposes.

like image 4
user1143325 Avatar answered Nov 07 '22 07:11

user1143325