![如果参考书目中没有空间,如何将 DOI 移至新行,而无需在当前行上中断,而不是中断?](https://linux22.com/image/422265/%E5%A6%82%E6%9E%9C%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E4%B8%AD%E6%B2%A1%E6%9C%89%E7%A9%BA%E9%97%B4%EF%BC%8C%E5%A6%82%E4%BD%95%E5%B0%86%20DOI%20%E7%A7%BB%E8%87%B3%E6%96%B0%E8%A1%8C%EF%BC%8C%E8%80%8C%E6%97%A0%E9%9C%80%E5%9C%A8%E5%BD%93%E5%89%8D%E8%A1%8C%E4%B8%8A%E4%B8%AD%E6%96%AD%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E4%B8%AD%E6%96%AD%EF%BC%9F.png)
关于如何正确分解参考书目中的 URL 和 DOI 存在许多问题。(这个似乎应该有帮助,但我不知道如何使用它。
我的 DOI是正确打破,但我对结果不满意并想尝试其他方法。
如果我的 DOI 会导致换行,那么我希望将其分流到新行,但如果它们仍然会填满整行,那么我就不会这样做,因为这并不能改善情况。
有人告诉我这个问题的答案可以调整,但说实话我不确定如何将其纳入参考书目。(或者,实际上其中的大部分代码都有很多定义而没有文档。)
下面是一个生成 DOI 的示例,该 DOI 会分行,但不会需要如果是在新行上,则将使用相同的总行数,但复制/粘贴 DOI 会更容易(例如,如果我的超链接最终被 PDF 处理程序破坏,我以前见过有人想批量插入版权页或类似内容时发生这种情况)。
\documentclass[letter]{article}
\usepackage[left= 4 cm, right=4 cm]{geometry}
\begin{filecontents}{MWE.bib}
@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}
}
\end{filecontents}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[
backend=biber,
style=chem-rsc,
doi=true,
articletitle=true,
pageranges=true,
]{biblatex}
\def\UrlFont{\rm} %Make the URL font roman instead of typewriter, so DOI in body and bib are the same size.
\addbibresource{MWE.bib}
\begin{document}
\begin{itemize}
\item DOI = {10.2312/LocalChapterEvents/ItalChap/ItalianChapConf2008/129-136}\autocite{Meshlab}
\end{itemize}
\printbibliography
\end{document}
答案1
以下是几个选项:
1. 制作参考书目\raggedright
只需添加\AtBeginBibliography{\raggedright}
序言即可。
平均能量损失
\documentclass{article}
\usepackage[left= 4 cm, right=4 cm]{geometry}
\begin{filecontents}[overwrite]{\jobname.bib}
@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}
}
@inproceedings{Meshlab2,
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}
}
@inproceedings{Meshlab3,
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/ItalianChapConf2008/129-136}
}
\end{filecontents}
\usepackage[
style=chem-rsc,
doi=true,
articletitle=true,
pageranges=true,
]{biblatex}
\def\UrlFont{\rm}
\addbibresource{\jobname.bib}
\AtBeginBibliography{\raggedright}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
2. 鼓励在 DOI 之前休息一下。
您可以使用一些代码来设置 DOI 字段格式,这些代码稍作修改TeX 书鼓励在此之前休息一下:
\DeclareFieldFormat{doi}{%
\nobreak\hfil\penalty50\hbox{}\nobreak
DOI\addcolon\addnbspace
\ifhyperref
{\href{https://doi.org/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}
\hfil
如果 DOI 不适合放在最后一行,则会创建一个空格,因此我们尝试在\hfill
记录末尾使用一个来缓解这个问题:
\renewbibmacro{finentry}{\finentry\hfill\null}
平均能量损失
\documentclass{article}
\usepackage[left= 4 cm, right=4 cm]{geometry}
\begin{filecontents}[overwrite]{\jobname.bib}
@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}
}
@inproceedings{Meshlab2,
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}
}
@inproceedings{Meshlab3,
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/ItalianChapConf2008/129-136}
}
\end{filecontents}
\usepackage[
style=chem-rsc,
doi=true,
articletitle=true,
pageranges=true,
]{biblatex}
\def\UrlFont{\rm}
\addbibresource{\jobname.bib}
\DeclareFieldFormat{doi}{%
\nobreak\hfil\penalty50\hbox{}\nobreak
DOI\addcolon\addnbspace
\ifhyperref
{\href{https://doi.org/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}
\renewbibmacro{finentry}{\finentry\hfill\null}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案2
这是我的做法:
\documentclass{article}
\usepackage[left= 4 cm, right=4 cm]{geometry}
\begin{filecontents}{MWE.bib}
@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}
}
\end{filecontents}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[
backend=biber,
style=chem-rsc,
doi=true,
articletitle=true,
pageranges=true,
]{biblatex}
\renewcommand*\UrlFont{\sffamily}
%\renewcommand*\UrlFont{\ttfamily\small}
\newcommand*\doi[1]{{\UrlFont #1}}
\renewcommand*\bibsetup{\raggedright}
\DeclareFieldFormat{doi}{%
\mkbibacro{DOI}\addcolon\addnbspace
\ifhyperref
{\href{https://doi.org/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}
\addbibresource{MWE.bib}
\begin{document}
\begin{itemize}
\item DOI = \doi{10.2312/LocalChapterEvents/ItalChap/ItalianChapConf2008/129-136}\autocite{Meshlab}
\end{itemize}
\printbibliography
\end{document}
那是:
- 制作参考书目
\raggedright
。 - 禁止在“DOI:”和 DOI 之间换行。为此,我
doi
从 复制了字段格式的定义biblatex.def
并将其替换\space
为\addnbspace
。(这对于防止 DOI 中断不是必需的,但我发现将“DOI:”也移动到下一行会更好。)
进一步的建议:
- 我喜欢对 URL 使用
\ttfamily\small
(与默认的罗马字体相比,它更适合\ttfamily
)或\sffamily
(与网上占主导地位的无衬线字体的使用相匹配)。 - 您不需要使 URL 字体与常规字体一致,而是可以在任何地方以 URL 字体打印 DOI。
- 另一个选择是使用比文档其余部分略小的字体打印参考书目(例如,
10pt
而不是11pt
),这样总体上就减少了所需的换行符。不过,使用这种方法时要非常小心。