3

So, David's answer appeared to work for a long time, but recently I found some citations, such as the top one here, the DOI move to the next line, despite lots and lots of room left.

Example:

\documentclass[11pt]{article} 
\begin{filecontents}[force]{\jobname.bib}
@Article{Janiak2010,
  author    = {Aakeroy, Christer B. and Champness, Neil R. and Janiak, Christoph},
  title     = {Recent advances in crystal engineering},
  journal   = {CrystEngComm},
  year      = {2010},
  volume    = {12},
  pages     = {22--43},
  doi       = {10.1039/B919819A},
  issue     = {1},
  publisher = {The Royal Society of Chemistry},
}
@article{VESTA,
author = "Momma, Koichi and Izumi, Fujio",
title = "{{\it VESTA3} for three-dimensional visualization of crystal, volumetric and morphology data}",
journal = "J. App. Cryst.",
year = "2011",
volume = "44",
number = "6",
pages = "1272--1276",
doi = {10.1107/S0021889811038970}
}
@Article{Charpin1985,
  author  = {Charpin, P. and Folcher, G. and Lance, M. and Nierlich, M. and Vigner, D.},
  title   = {Structure d'un complexe binucl\'{e}aire du nitrate d'uranyle et du N,N-dim\'{e}thyl-formamide: \(\mu\)-peroxo-bis[bis(N,N-dim\'{e}thyl-formamide)nitratodioxouranium(VI)], [(UO2)2(NO3)2O2(C3H7NO)4]},
  journal = {Acta Crystallogr. Sect.~C: Struct. Chem.},
  year    = {1985},
  volume  = {41},
  number  = {9},
  pages   = {1302--1305},
  doi     = {10.1107/S0108270185007533},
}
@inproceedings{Meshlab,
    booktitle = {Eurographics Italian Chapter Conference},
    editor = {Vittorio Scarano and Rosario De Chiara and Ugo Erra},
    title = {{MeshLab: an Open-Source Mesh Processing Tool}},
    author = {Cignoni, Paolo and Callieri, Marco and Corsini, Massimiliano and Dellepiane, Matteo and Ganovelli, Fabio and Ranzuglia, Guido},
    year = {2008},
    publisher = {The Eurographics Association},
    ISBN = {978-3-905673-68-5},
    DOI = {10.2312/LocalChapterEvents/ItalChap/ItalianChapConf2008/129-136}
}
@Article{Vittal2011,
  author  = {Leong, Wei Lee and Vittal, Jagadese J.},
  title   = {One-Dimensional Coordination Polymers: Complexity and Diversity in Structures, Properties, and Applications},
  journal = {Chem. Rev.},
  year    = {2011},
  volume  = {111},
  number  = {2},
  pages   = {688--764},
  doi     = {10.1021/cr100160e},
}
@Article{HBond,
  author  = {Steiner, Thomas},
  title   = {The Hydrogen Bond in the Solid State},
  journal = {Angew. Chem., Int. Ed.},
  year    = {2002},
  volume  = {41},
  number  = {1},
  pages   = {48--76},
  doi     = {10.1002/1521-3773(20020104)41:1<48::AID-ANIE48>3.0.CO;2-U},
}
\end{filecontents}

\usepackage[left=1.25in,right=1.25in]{geometry} \usepackage{showframe}

\usepackage[backend=biber, style=chem-rsc, doi=true, articletitle=true, pageranges=true, biblabel=dot, url=true, chaptertitle=true]{biblatex} \addbibresource{\jobname.bib}

\DeclareFieldFormat{doi}{% \hfil\penalty50\hfilneg\space DOI\addcolon\addnbspace \ifhyperref {\href{https://doi.org/#1}{\nolinkurl{#1}}} {\nolinkurl{#1}}}

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

All the citations work fine, except for the first one.

All the citations in this example work fine, except the first one: Citations 5 and 6 stay on the correct line, for example.

Canageek
  • 17,935

1 Answers1

7

You ran into this problem: https://tex.stackexchange.com/a/523832/2388. There is a hyphenation in the line before and TeX tries to avoid that such hyphenations in the last line and so produce one line more. You can set \finalhyphendemerits=0 at the begin of the bibliography (probably biblatex should do it by default):

\documentclass[11pt]{article}
\begin{filecontents}{testdoibreak.bib}
@Article{Janiak2010,
  author    = {Aakeroy, Christer B. and Champness, Neil R.  and Janiak, Christoph},
  title     = {Recent advances in crystal engineering},
  journal   = {CrystEngComm},
  year      = {2010},
  volume    = {12},
  pages     = {22--43},
  doi       = {10.1039/B919819A},
}
\end{filecontents}

\usepackage[left=1.25in,right=1.25in]{geometry} \usepackage{showframe}

\usepackage[backend=biber, style=chem-rsc, doi=true, articletitle=true, pageranges=true, biblabel=dot, url=true, chaptertitle=true ]{biblatex} \addbibresource{testdoibreak.bib}

\DeclareFieldFormat{doi}{% \hfil\penalty50\hfilneg\space DOI\addcolon\addnbspace \ifhyperref {\href{https://doi.org/#1}{\nolinkurl{#1}}} {\nolinkurl{#1}}}

\AtBeginBibliography{\finalhyphendemerits=0 } \begin{document}

\nocite{*}

\printbibliography \end{document}

enter image description here

Ulrike Fischer
  • 327,261