# Manually breaking a long URL (in the bibliography)

I have a large bibliography in which a few items are causing underfull hboxes due to a long URL. Answers to similar questions suggest a number of global options for fixing this; e.g.

Forcing linebreaks in \url

hyperref url breaking

perform a line break of an URL in bibliography manually (biblatex, hyperref)

However, I don't want a global solution (like applying \sloppy or \raggedright to the whole bibliography), because all the other bibliography items behave as I want them to.

In most cases, I have been able to resolve the issue by inserting a manual line break at the start of the url entry in the .bib file. However, in one case that isn't working. MWE:

\documentclass[natbib]{svmono}
\usepackage{url}

\begin{document}
\cite{koepke2009naturalness}
\bibliographystyle{harvard}
\bibliography{test}
\end{document}


test.bib

@article{koepke2009naturalness,
year={2009},
title={Naturalness in formal mathematics},
journal={\\\url{http://www.math.uni-bonn.de/people/koepke/Preprints/Naturalness_in_formal_mathematics.pdf}},
author={Koepke, Peter}
}


I've tried inserting \\ at various points inside the url; it breaks the line, but I still get an underfull hbox. How can I break the url in a way which doesn't cause an underfull hbox?

-
Is this a minimal working example (MWE)? harvard.bst? svmono.cls? –  Qrrbrbirlbel Oct 17 '12 at 22:32
Normally, the journal field should not be for a \url –  Guido Oct 17 '12 at 23:08
After adding the missing ,, it looks good. The underfull box is still there, but I don't think you can avoid that with such long URLs. You have a tt font and no space. What should LaTeX do wit that line in your opinion? –  Qrrbrbirlbel Oct 17 '12 at 23:10
@Guido: where should the url go? –  Mohan Oct 17 '12 at 23:29
Between the jornal and the author field. With {\url{http://www.math.uni-bonn.de/people/koepke/}\\\url{Preprints/Naturalness_in_‌​formal_mathematics.pdf}} I don't have an underfull box. Either way, journal is for the journal's name, you can use note for the URL. –  Qrrbrbirlbel Oct 17 '12 at 23:39

Update: This question's OP himself has found a good solution between an extra \\ and a working hyperref.

With the help of the hyperref package one can write (the example is changed to an unpublished publication because there is, apparently, no journal):

@unpublished{koepke2009naturalness,
year={2009},
title={Naturalness in formal mathematics},
note={\\
\href{http://www.math.uni-bonn.de/people/koepke/Preprints/Naturalness_in_formal_mathematics.pdf}
\\
\href{http://www.math.uni-bonn.de/people/koepke/Preprints/Naturalness_in_formal_mathematics.pdf}
},
author={Koepke, Peter}
}


which gives

If only one \href is used, like

  note={\\
\href{http://www.math.uni-bonn.de/people/koepke/Preprints/Naturalness_in_formal_mathematics.pdf}
\\
}
},


the link-active area spans the whole first line:

An underfull hbox doesn't mean that there's necessarily something wrong. It is merely a warning.

Compare the bibliography entries of the following code.
The one with the extra \\ doesn't give a warning (but breaks the hyperlink, by the way), the other one does give a warning, but looks the same.

(The italic setting from the journal field did mess up the spacing either way.)

## Code

\documentclass[natbib]{svmono}
\usepackage{url}
\usepackage[showframe,pass]{geometry}
\begin{filecontents}{test.bib}
@article{koepke2009naturalness,
year={2009},
title={Naturalness in formal mathematics},
journal={Same Journal Name},
note={\\\url{http://www.math.uni-bonn.de/people/koepke/Preprints/Naturalness_in_}\\\url{formal_mathematics.pdf}},
author={Koepke, Peter}
}
@article{koepke2009naturalnessa,
year={2009},
title={Naturalness in formal mathematics},
journal={Same Journal Name},
note={\\\url{http://www.math.uni-bonn.de/people/koepke/Preprints/Naturalness_in_formal_mathematics.pdf}},
author={Koepke, Peter}
}
\end{filecontents}
\begin{document}
\cite{*}
\bibliographystyle{harvard}
\bibliography{test}
\end{document}


## Output

-
See below for a way of not breaking the hyperlink. –  Mohan Oct 18 '12 at 12:26