![为什么在有大量空间的情况下,此 DOI 最终会出现在新行上?](https://linux22.com/image/426718/%E4%B8%BA%E4%BB%80%E4%B9%88%E5%9C%A8%E6%9C%89%E5%A4%A7%E9%87%8F%E7%A9%BA%E9%97%B4%E7%9A%84%E6%83%85%E5%86%B5%E4%B8%8B%EF%BC%8C%E6%AD%A4%20DOI%20%E6%9C%80%E7%BB%88%E4%BC%9A%E5%87%BA%E7%8E%B0%E5%9C%A8%E6%96%B0%E8%A1%8C%E4%B8%8A%EF%BC%9F.png)
所以,大卫的回答似乎工作了很长时间,但最近我发现一些引用,比如这里最上面的引用,尽管还剩下很多空间,但 DOI 移动到了下一行。
例子:
\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}
此示例中的所有引用均正常,除第一个引用外:例如,引用 5 和 6 保持在正确的行上。
答案1
您遇到了这个问题:https://tex.stackexchange.com/a/523832/2388。前一行有连字符,TeX 会尝试避免在最后一行出现这样的连字符,因此会多生成一行。您可以\finalhyphendemerits=0
在参考书目开头设置(biblatex 可能默认会这样做):
\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}