7

I have BibTeX imported as

\usepackage[backend=bibtex,style=numeric,natbib=true]{biblatex}

I have three entries in my bibliography, as:

@inproceedings{arthur2007,
 author = {Arthur, David and Vassilvitskii, Sergei},
 title = {K-means++: The Advantages of Careful Seeding},
 booktitle = {Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms},
 series = {SODA '07},
 year = {2007},
 isbn = {978-0-898716-24-5},
 location = {New Orleans, Louisiana},
 pages = {1027--1035},
 numpages = {9},
 url = {http://dl.acm.org/citation.cfm?id=1283383.1283494},
 acmid = {1283494},
 publisher = {Society for Industrial and Applied Mathematics},
 address = {Philadelphia, PA, USA},
} 

@article{barshan2014,
    author = {Barshan, Billur and Y\"{u}ksek, Murat C.},
    day = {01},
    doi = {10.1093/comjnl/bxt075},
    issn = {1460-2067},
    journal = {The Computer Journal},
    keywords = {sport},
    month = nov,
    number = {11},
    pages = {1649--1667},
    posted-at = {2015-02-09 03:55:41},
    priority = {2},
    publisher = {Oxford University Press},
    title = {{Recognizing Daily and Sports Activities in Two Open Source Machine Learning Environments Using Body-Worn Sensor Units}},
    url = {http://dx.doi.org/10.1093/comjnl/bxt075},
    volume = {57},
    year = {2014}
}

@article{bahmani2012,
 author = {Bahmani, Bahman and Moseley, Benjamin and Vattani, Andrea and Kumar, Ravi and Vassilvitskii, Sergei},
 title = {Scalable K-means++},
 journal = {Proc. VLDB Endow.},
 issue_date = {March 2012},
 volume = {5},
 number = {7},
 month = mar,
 year = {2012},
 issn = {2150-8097},
 pages = {622--633},
 numpages = {12},
 url = {http://dx.doi.org/10.14778/2180912.2180915},
 doi = {10.14778/2180912.2180915},
 acmid = {2180915},
 publisher = {VLDB Endowment},
}

which, however, render as

enter image description here

I would like the bibliography to be justified (as they are) and with hyphenation (see Louisiana). Also, is it possible to flush URLs/DOIs to newline?
I've tried \raggedright, but it does not suit me. I've also tried adding babel=hyphen in the \usepackage definition, with no luck.

Update
I was able to flush DOIs and URLs to newline thanks to this and this, respectively.

4
  • 4
    You can add hyphenation for specific words via \hyphenation{Lou-is-i-ana} in your tex file. If you need more help, then we will need see the set-up of your tex file including the documentclass used etc. in the form of a minimal working example with bibliography (MWEB). Aug 29, 2016 at 9:53
  • 2
    You probably mean “justified” instead of “centered”. You also get the warning Can't use 'location' + 'address' for arthur2007.
    – egreg
    Aug 29, 2016 at 9:59
  • @AndrewSwann, thank you very much indeed for your insight. Works fine. However I shall say I'm rather disappointed it can't be done automatically. Sorry I didn't attach any MWEB, but the documentclass is personalised (no built-in e.g. article) @egreg, fixed "justified" (I was thinking of the centering command whilst asking the question). However, I'm not experiencing any warnings
    – AlessioX
    Aug 29, 2016 at 12:21
  • 1
    @Alessiox (La)TeX has a sophisticated hyphenation algorithm, but it errs on the side of caution and so does not provide break points in all known words. Place names often fall outside the standard patterns, and so one sometimes has to provide a helping hand. In many ways it is surprising how rarely one has to this. Aug 29, 2016 at 13:16

1 Answer 1

5

You can add hyphenation for specific words via \hyphenation{Lou-is-i-ana} (or Lou-i-si-ana) in your tex file. An example would be as follows, where I have used geometry to provide a text width causing the break and have placed your references in mybib.bib:

Sample output

\documentclass{article}

\usepackage[width=11.55cm]{geometry}
\usepackage[backend=bibtex,style=numeric,natbib=true]{biblatex}
\addbibresource{mybib.bib}

\hyphenation{Lou-is-i-ana}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

If you prefer to keep the hyphenation exception with your bibliography source, then you can place a @preamble entry in the .bib file instead:

@preamble{"\hyphenation{Lou-is-i-ana}"}

or you can add hyphenation suggestions directly in the .bib entry:

  location =     {New Orleans, Lou\-is\-i\-ana},

(La)TeX has a sophisticated hyphenation algorithm, but it errs on the side of caution and so does not provide break points in all known words. Place names often fall outside the standard patterns, and so one sometimes has to provide a helping hand. In many ways it is surprising how rarely one has to this.

If your document is in US English, you could load the file ushyphex.tex as suggested by egreg: \input{ushyphex}. This contains a list of exceptions compiled over the years, and in particular covers Louisiana as Lou-i-si-ana.

2
  • Glad you did summarise your comments within a proper answer. I was about to ask you the very same thing. Also thank you very much indeed for your explanation regarding the hyphenation algorithm and I must certainly agree with you on the fact that very rarely (first time for me, actually) I had to use the \hyphenation{} trick (usually babel works fine). The @preamble is just a massive suggestion: last thing I want is to clutter up my main script.
    – AlessioX
    Aug 29, 2016 at 13:40
  • One can also do \input{ushyphex}, that loads several hundreds of hyphenation exceptions for American English; on line 1352 it has Lou-i-si-ana
    – egreg
    Aug 29, 2016 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .