tags:

views:

768

answers:

2

Why is this item not shown properly in my bibliography?

@misc{ann,
    abstract = {ANN is an implbmentation of nearest neighbor search.},
    author = {David M. Mount and Sunil Arya},
    howpublished = {\url{http://www.cs.umd.edu/~mount/ANN/}},
    keywords = {knn},
    posted-at = {2010-04-08 00:05:04},
    priority = {2},
    title = {ANN.},
    url = "http://www.cs.umd.edu/~mount/ANN/",
    year = {2008}
}

@misc{Nilsson96introductionto,  
    author = {Nilsson, Nils J.},  
    citeulike-article-id = {6995464},  
    howpublished = {\url{http://robotics.stanford.edu/people/nilsson/mlbook.html}},  
    keywords = {*file-import-10-04-11},  
    posted-at = {2010-04-11 06:52:28},  
    priority = {2},  
    title = {Introduction to Machine Learning: An Early Draft of a Proposed Textbook.},  
    year = {1996}  
}  

alt text


EDIT:

I am using

\usepackage{hyperref}

not

\usepackage{url}

. It produces error when using url package together with it. So can the two not work together?

I would like to use hyper links inside pdf file, so I want to use hyperref package instead of url package. I googled a bit, and try

\usepackage[hyperindex,breaklinks]{hyperref}

but there is still no line break just as before. How can I do it?


EDIT:

When using url and hyperref together, if it is just

\usepackage{hyperref}  
\usepackage{url}

the compilation by latex is fine, but the link is still hyperlink and has still no linebreak. If I do not use hyperref package, the link has linebreak, but I lose hyper links. Since \url can be used in both hyperref and url packages, how can I specify which package's \url is being used?

If it is

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

the compilation by latex command will report clash with url:

! LaTex Error: Option clash for package url.

So I wonder how I should do?

+2  A: 

Normally URLs are hyphenated, but in your bibliography they seem not to be. When the URLs don't fit on one line, they are moved to the next line, and the text before them is stretched to fill out the preceding lines. Since there is only one place to break the line, it's not very likely that the preceding text will fit nicely into a whole number of lines, and so you get all the extra space.

EDIT: When you changed your bib entry, you happened to change it in such a way that the text did fit nicely. This is just a coincidence, you didn't fix your problem.

I suspect that putting

\usepackage{url}

in your preamble will solve it.

ptomato
Thanks, ptomato! I would like to use hyper links inside pdf file, so I still want to use hyperref package instead of url package. I googled a bit, and try \usepackage[hyperindex,breaklinks]{hyperref}, but there is still no line break just as before. How can I do it?
Tim
Use them both. There is nothing to stop you using url *and* hyperref.
Rob Hyndman
Using them both either still does not work or reports clash with url package.
Tim
+4  A: 

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.

AVB
Thanks, AVB! I would like to use hyper links inside pdf file, so I still want to use hyperref package instead of url package. I googled a bit, and try \usepackage[hyperindex,breaklinks]{hyperref}, but there is still no line break just as before. How can I do it?
Tim