如何强制参考文献中的 DOI 换行?

如何强制参考文献中的 DOI 换行?

在我的参考书目中,有四项超出了列宽,其中三项是因为 DOI。我使用 biblatex。

我的 MWE 看起来像这样

\documentclass[11pt,twoside]{report} 
\usepackage[url=false,isbn=false,giveninits=true,maxbibnames=999]{biblatex} 
\RequirePackage{filecontents}

\begin{filecontents}{bib.bib}
@inproceedings{hofmann_numerical_1999,
    address = {San Francisco, USA},
    series = {{FEDSM99}-6755},
    title = {Numerical and experimental investigations on the oscillating behavior of cloud cavitation: {Part} 1 visualisation},
    booktitle = {{ASME}{/}{JSME} {Joint} {Fluids} {Engineering} {Conference}},
    author = {Hofmann, Michael and Lohrberg, H and Ludwig, G and Stoffel, B and Reboud, JL and Fortes-Patella, R},
    year = {1999}
}
@article{kravtsova_high-speed_2014,
    title = {High-speed visualization and {PIV} measurements of flows of plates and {NACA0015} hydrofoil},
    volume = {110},
    issn = {03019322},
    url = {https://linkinghub.elsevier.com/retrieve/pii/S0301932213002164},
    doi = {10.10160/j.ijmultiphaseflow.2013.12.004},
    urldate = {2018-10-23},
    journal = {International Journal of Multiphase Flow},
    author = {Kravtsova, A.Yu. and Markovich, D.M. and Pervunin, K.S. and Timoshevskiy, M.V. and Hanjali{\'c}, K.},
    year = {2014},
    pages = {1190--1220}
}
@article{jasak_high_1999,
    title = {High resolution differencing scheme}, % for arbitrarily unstructured meshes},
    volume = {31},
    issn = {02712091, 10970363},
    doi = {10.10020/(SICI)1097-01363(19990930)31:2<431::AID-FLD884>3.0.CO;2-T},
    number = {110},
    urldate = {2018-10-24},
    journal = {International Journal for Numerical Methods in Fluids},
    author = {Jasak, H. and Weller, H.G. and Gosman, A.D.},
    year = {1999},
    pages = {1431--1449}
}
@article{vogel_optical_1989,
    title = {Optical and acoustic investigations of the bubbles near a solid cute boundary},
    number = {110},
    volume = {206},
    issn = {0022-1120, 1469-7645},
    doi = {10.1017/S0022112089002314},
    urldate = {2019-11-29},
    journal = {Journal of Fluid Mechanics},
    author = {Vogel, A. and Lauterborn, W. and Timm, R.},
    year = {1989},
    pages = {299--338}
}
\end{filecontents}

\addbibresource{bib.bib}

\begin{document}
\cite{kravtsova_high-speed_2014,hofmann_numerical_1999,vogel_optical_1989} and \cite{jasak_high_1999}.
\printbibliography[heading=bibintoc]

\end{document}

根据在 DOI 中实现换行我尝试用以下方法改变惩罚,但没有任何效果:

\DeclareBibliographyCategory{badbreaks}
\addtocategory{badbreaks}{hofmann_numerical_1999,kravtsova_high-speed_2014,jasak_high_1999,vogel_optical_1989}

\AtEveryBibitem{%
  \ifcategory{badbreaks}
    {\defcounter{biburlnumpenalty}{100}}
    {}}

先感谢您。

答案1

我有两点建议:

  • 加载xurl包。这允许 LaTeX 不仅在 URL 字符串中引入换行符,而且在 doi 字符串中也可以引入换行符。

  • 在条目中hofmann_numerical_1999,更改字段

    booktitle = {{ASME}{/}{JSME} {Joint} {Fluids} {Engineering} {Conference}},
    

    booktitle = {ASME\slash JSME Joint Fluids Engineering Conference},
    

    这允许 LaTeX 在斜线符号 (“斜线”) 后立即引入换行符/。注意:不是需要将单词ASMEJSMEJoint等括在花括号中。

  • 请勿输入缩写的中间名首字母,例如,

    Kravtsova, A.Yu. and Markovich, D.M.
    

    因为这样做会让biblatex/biber(BibTeX 也是如此)认为只有一个名字——没有中间名首字母。请将作者信息更改为

    Kravtsova, A. Yu. and Markovich, D. M.
    

    ETC。

以下示例文档实现了这些想法。我用黄色突出显示了现在不再突出到边距的换行符。

在此处输入图片描述

\documentclass[11pt,twoside]{report} 
\usepackage[T1]{fontenc} % new
\usepackage[url=false,isbn=false,giveninits=true,
           maxbibnames=999]{biblatex} 
%\RequirePackage{filecontents} % not needed
\begin{filecontents}[overwrite]{bib.bib}
@inproceedings{hofmann_numerical_1999,
    address = {San Francisco, USA},
    series = {FEDSM99-6755},
    title = {Numerical and experimental investigations on the oscillating behavior of cloud cavitation: {Part}~1 visualisation},
    booktitle = {ASME\slash JSME Joint Fluids Engineering Conference},
    author = {Hofmann, Michael and Lohrberg, H. and Ludwig, G. and Stoffel, B. and Reboud, J.L. and Fortes-Patella, R.},
    year = {1999}
}
@article{kravtsova_high-speed_2014,
    title = {High-speed visualization and {PIV} measurements of flows of plates and {NACA0015} hydrofoil},
    volume = {110},
    issn = {03019322},
    url = {https://linkinghub.elsevier.com/retrieve/pii/S0301932213002164},
    doi = {10.10160/j.ijmultiphaseflow.2013.12.004},
    urldate = {2018-10-23},
    journal = {International Journal of Multiphase Flow},
    author = {Kravtsova, A. Yu. and Markovich, D. M. and Pervunin, K. S. and Timoshevskiy, M. V. and Hanjali{\'c}, K.},
    year = {2014},
    pages = {1190--1220}
}
@article{jasak_high_1999,
    title = {High resolution differencing scheme},
    volume = {31},
    issn = {02712091, 10970363},
    doi = {10.10020/(SICI)1097-01363(19990930)31:2<431::AID-FLD884>3.0.CO;2-T},
    number = {110},
    urldate = {2018-10-24},
    journal = {International Journal for Numerical Methods in Fluids},
    author = {Jasak, H. and Weller, H. G. and Gosman, A. D.},
    year = {1999},
    pages = {1431--1449}
}
@article{vogel_optical_1989,
    title = {Optical and acoustic investigations of the bubbles near a solid cute boundary},
    number = {110},
    volume = {206},
    issn = {0022-1120, 1469-7645},
    doi = {10.1017/S0022112089002314},
    urldate = {2019-11-29},
    journal = {Journal of Fluid Mechanics},
    author = {Vogel, A. and Lauterborn, W. and Timm, R.},
    year = {1989},
    pages = {299--338}
}
\end{filecontents}
\addbibresource{bib.bib}

\usepackage{xurl} % new

\begin{document}
\cite{kravtsova_high-speed_2014, hofmann_numerical_1999, vogel_optical_1989} and \cite{jasak_high_1999}.
\printbibliography[heading=bibintoc]
\end{document}

相关内容