这是我论文中的一段代码片段。
\RequirePackage{filecontents}
\begin{filecontents}{bib.bib}
@article{baumert62,
author = {Baumert, Leonard and Golomb, Solomon W. and Hall, Jr, Marshall},
doi = {10.1090/S0002-9904-1962-10761-7},
journal = {Bulletin of the American Mathematical Society},
number = 3,
pages = {237--238},
title = {Discovery of an Hadamard Matrix of Order 92},
volume = 68,
year = 1962
}
\end{filecontents}
\documentclass{article}
% for back reference in bibliography
\usepackage[ocgcolorlinks,pdfusetitle]{hyperref}
% for biblatex with biber
\usepackage[
backend=biber,
style=alphabetic,
citestyle=alphabetic,
backref=true]{biblatex}
% for DOI field
\usepackage{doi}
\addbibresource{bib.bib}
\begin{document}
The first missing order of 92 was resolved in 1962 by Baumert, Golomb,
and Hall Jr. \cite{baumert62} who ran computer experiment on Williamson's method.
%%% bibliography
\printbibliography
\end{document}
它生成一个书目项目,其多伊字段太长。
当然,我想每个人都想修复它。我知道我可以使用以下内容,如这线。
\setcounter{biburlnumpenalty}{100} % allow breaks at numbers
\setcounter{biburlucpenalty}{100} % allow breaks at uppercase letters
\setcounter{biburllcpenalty}{100} % allow breaks at lowercase letters
我不希望在数字、小写字母和大写字母处换行,而是希望在特殊字符处换行,例如/
、.
和-
。由于我正在处理 DOI 字段,我认为这些位置比普通字母数字字符更适合换行。我该怎么做?
答案1
该选项ocgcolorlinks
不允许链接中换行。
实验选项‘ocgcolorlinks’
这个想法是,链接在浏览时是彩色的,但打印出来时却是无色的。
...
- 主要缺点:链接不能跨行断开。
换句话说,它与选项几乎相同colorlinks
,但有两个区别。
colorlinks
允许链接中换行,而ocgcolorlinks
不允许;colorlinks
打印文档时保留颜色,而ocgcolorlinks
打印时则以黑色显示。
那么,你可以做什么来避免这种情况呢?
使用该colorlinks
选项代替ocgcolorlinks
,并在打印文档时选择以“黑白”打印。
梅威瑟:
\RequirePackage{filecontents}
\begin{filecontents}{bib.bib}
@article{baumert62,
author = {Baumert, Leonard and Golomb, Solomon W. and Hall, Jr, Marshall},
doi = {10.1090/S0002-9904-1962-10761-7},
journal = {Bulletin of the American Mathematical Society},
number = 3,
pages = {237--238},
title = {Discovery of an Hadamard Matrix of Order 92},
volume = 68,
year = 1962
}
\end{filecontents}
\documentclass{article}
% for back reference in bibliography
\usepackage[colorlinks,pdfusetitle]{hyperref}
% for biblatex with biber
\usepackage[
backend=biber,
style=alphabetic,
citestyle=alphabetic,
backref=true]{biblatex}
% for DOI field
\usepackage{doi}
\addbibresource{bib.bib}
\begin{document}
The first missing order of 92 was resolved in 1962 by Baumert, Golomb,
and Hall Jr. \cite{baumert62} who ran computer experiment on Williamson's method.
%%% bibliography
\printbibliography
\end{document}
输出:
答案2
只是为了完整性ocgcolorlinks
(彩色链接打印为黑色)现在可以环绕换行符(和分页符,如果需要)ocgx2
包裹:
\usepackage{hyperref} \usepackage[ocgcolorlinks]{ocgx2}
梅威瑟:
\RequirePackage{filecontents}
\begin{filecontents}{bib.bib}
@article{baumert62,
author = {Baumert, Leonard and Golomb, Solomon W. and Hall, Jr, Marshall},
doi = {10.1090/S0002-9904-1962-10761-7},
journal = {Bulletin of the American Mathematical Society},
number = 3,
pages = {237--238},
title = {Discovery of an Hadamard Matrix of Order 92},
volume = 68,
year = 1962
}
\end{filecontents}
\documentclass{article}
% for back reference in bibliography
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[pdfusetitle]{hyperref}
\usepackage[ocgcolorlinks]{ocgx2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for biblatex with biber
\usepackage[
backend=biber,
style=alphabetic,
citestyle=alphabetic,
backref=true]{biblatex}
% for DOI field
\usepackage{doi}
\addbibresource{bib.bib}
\begin{document}
The first missing order of 92 was resolved in 1962 by Baumert, Golomb,
and Hall Jr. \cite{baumert62} who ran computer experiment on Williamson's method.
%%% bibliography
\printbibliography
\end{document}
答案3
您可以使用http://shortdoi.org为 DOI 创建一个简短的永久别名,如 @matth 所述。这些缩短的 DOI 比规范 DOI 有几个优点:
- 它们足够短,因此不需要换行。
- 它们很容易从纸质文件上复制。如果你只有一篇文章的纸质副本,那么长的 DOI 几乎毫无用处(搜索标题/作者更方便)。
- 它们更加美观,这意味着来自出版商和合著者的阻力更小。
我编写了一个脚本,它可以处理现有的 BibTeX 文件并用缩短的 DOI 替换所有 DOI 名称: https://github.com/mosco/bibtex-shorten-doi
需要注意的是:遗憾的是,短 DOI 不被视为正确的 DOI,不能用于在 doi.org 以外的任何网站上进行手动查找,例如 CrossRef、Sci-Hub 等。所以目前,我不建议自动转换参考书目中的所有 DOI。