![Revtex. 一些 DOI 链接因长参考书目而中断](https://linux22.com/image/384153/Revtex.%20%E4%B8%80%E4%BA%9B%20DOI%20%E9%93%BE%E6%8E%A5%E5%9B%A0%E9%95%BF%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%E8%80%8C%E4%B8%AD%E6%96%AD.png)
考虑这个最小的例子
\documentclass[aps,longbibliography]{revtex4-1}
\usepackage{hyperref}
\begin{document}
\cite{Caves1981,Holland1993}
\bibliography{library}
\end{document}
文件内容library.bib
:
@article{Caves1981,
title = {{Quantum-mechanical noise in an interferometer}},
author = {Caves, Carlton M.},
journal = {Phys. Rev. D},
volume = {23},
issue = {8},
pages = {1693},
numpages = {0},
year = {1981},
month = {Apr},
publisher = {American Physical Society},
doi = {10.1103/PhysRevD.23.1693}
}
@article{Holland1993,
title = {{Interferometric detection of optical phase shifts at the Heisenberg limit}},
author = {Holland, M. J. and Burnett, K.},
journal = {Phys. Rev. Lett.},
volume = {71},
issue = {9},
pages = {1355},
numpages = {0},
year = {1993},
month = {Aug},
publisher = {American Physical Society},
doi = {10.1103/PhysRevLett.71.1355},
}
生成的 PDF 在参考书目中有两个条目,期刊参考文献链接到文章 DOI。但单击第一个条目没有任何反应(尝试使用多个 PDF 阅读器),而第二个条目则运行正常。
如果我longbibliography
从类别选项中删除,这两个链接将按预期工作。
为什么会发生这种情况?
我使用 MacTeX 2018 生成了它。
答案1
更新,这不再是最新版本 REVTeX 4.2 的问题。正如我的旧帖子所指出的,这个问题已通过不再使用 \doibase 命令得到解决。在新版本中,stack.bbl 直接附加字符串https://doi.org/到 doi 编号,而两者之间不可能出现空格。
看起来这种情况的发生既是因为 Preview/Skim 处理链接的方式与 Acrobat 不同(如上所述),也是 Latex 编译器的一点不幸,也是 doi 网站的幸运。参考书目中的链接是使用 \href 命令在辅助文件 stack.bbl 中创建的。为了使链接正常工作,它们被附加到字符串http://dx.doi.org/.这样 PDF 中的链接就会转到http://dx.doi.org/10.1103/PhysRevD.23.1693。您可以通过右键单击链接并单击“复制”来检查。出现问题的原因是,此附加操作是通过首先定义命令 \doibase 来完成的,该命令包含字符串http://dx.doi.org/,然后将此命令放在 doi 编号之前,如 \doibase 10.1103/PhysRevD.23.1693 。如果由于某种原因,在自动创建的 bbl 文件中,doibase 命令出现在一行末尾,而 doi 编号出现在下一行开头,则超链接指向 'http://dx.doi.org/10.1103/PhysRevLett.71.1355'(请注意网站和 doi 编号之间的空格)。由于这个空格,Preview 和 Skim 无法识别该链接,但 Acrobat 可以识别并将您定向到 'http://dx.doi.org/%2010.1103/PhysRevD.23.1693',其中 %20 代表 Acrobat 为使链接有效而放置的空格。最后,幸运的是,doi 网站忽略了 %20 并查找正确的 DOI。
我不知道如何自动解决它,只能手动打开 .bbl 文件,确保所有 doibase 命令与 doi 编号出现在同一行,然后再次编译 bibtex 而不删除 aux 文件。这并不方便,因为如果出于某种原因您需要从头开始重新编译并删除 aux 文件,您将不得不再次手动修改 .bbl 文件。
如果您将 stack.bbl 文件替换为以下文件,则可以检查链接是否在 Preview/Skim 中起作用,其中我确保将 doibase 命令与 doi 编号放在同一行。
%merlin.mbs apsrev4-1.bst 2010-07-25 4.21a (PWD, AO, DPC) hacked
%Control: key (0)
%Control: author (0) dotless jnrlst
%Control: editor formatted (1) identically to author
%Control: production of article title (0) allowed
%Control: page (1) range
%Control: year (0) verbatim
%Control: production of eprint (0) enabled
\begin{thebibliography}{2}%
\makeatletter
\providecommand \@ifxundefined [1]{%
\@ifx{#1\undefined}
}%
\providecommand \@ifnum [1]{%
\ifnum #1\expandafter \@firstoftwo
\else \expandafter \@secondoftwo
\fi
}%
\providecommand \@ifx [1]{%
\ifx #1\expandafter \@firstoftwo
\else \expandafter \@secondoftwo
\fi
}%
\providecommand \natexlab [1]{#1}%
\providecommand \enquote [1]{``#1''}%
\providecommand \bibnamefont [1]{#1}%
\providecommand \bibfnamefont [1]{#1}%
\providecommand \citenamefont [1]{#1}%
\providecommand \href@noop [0]{\@secondoftwo}%
\providecommand \href [0]{\begingroup \@sanitize@url \@href}%
\providecommand \@href[1]{\@@startlink{#1}\@@href}%
\providecommand \@@href[1]{\endgroup#1\@@endlink}%
\providecommand \@sanitize@url [0]{\catcode `\\12\catcode `\$12\catcode
`\&12\catcode `\#12\catcode `\^12\catcode `\_12\catcode `\%12\relax}%
\providecommand \@@startlink[1]{}%
\providecommand \@@endlink[0]{}%
\providecommand \url [0]{\begingroup\@sanitize@url \@url }%
\providecommand \@url [1]{\endgroup\@href {#1}{\urlprefix }}%
\providecommand \urlprefix [0]{URL }%
\providecommand \Eprint [0]{\href }%
\providecommand \doibase [0]{http://dx.doi.org/}%
\providecommand \selectlanguage [0]{\@gobble}%
\providecommand \bibinfo [0]{\@secondoftwo}%
\providecommand \bibfield [0]{\@secondoftwo}%
\providecommand \translation [1]{[#1]}%
\providecommand \BibitemOpen [0]{}%
\providecommand \bibitemStop [0]{}%
\providecommand \bibitemNoStop [0]{.\EOS\space}%
\providecommand \EOS [0]{\spacefactor3000\relax}%
\providecommand \BibitemShut [1]{\csname bibitem#1\endcsname}%
\let\auto@bib@innerbib\@empty
%</preamble>
\bibitem [{\citenamefont {Caves}(1981)}]{Caves1981}%
\BibitemOpen
\bibfield {author} {\bibinfo {author} {\bibfnamefont {Carlton~M.}\
\bibnamefont {Caves}},\ }\bibfield {title} {\enquote {\bibinfo {title}
{{Quantum-mechanical noise in an interferometer}},}\ }\href
{\doibase 10.1103/PhysRevD.23.1693} {\bibfield {journal} {\bibinfo {journal} {Phys.
Rev. D}\ }\textbf {\bibinfo {volume} {23}},\ \bibinfo {pages} {1693}
(\bibinfo {year} {1981})}\BibitemShut {NoStop}%
\bibitem [{\citenamefont {Holland}\ and\ \citenamefont
{Burnett}(1993)}]{Holland1993}%
\BibitemOpen
\bibfield {author} {\bibinfo {author} {\bibfnamefont {M.~J.}\ \bibnamefont
{Holland}}\ and\ \bibinfo {author} {\bibfnamefont {K.}~\bibnamefont
{Burnett}},\ }\bibfield {title} {\enquote {\bibinfo {title}
{{Interferometric detection of optical phase shifts at the Heisenberg
limit}},}\ }\href {\doibase 10.1103/PhysRevLett.71.1355} {\bibfield
{journal} {\bibinfo {journal} {Phys. Rev. Lett.}\ }\textbf {\bibinfo
{volume} {71}},\ \bibinfo {pages} {1355} (\bibinfo {year}
{1993})}\BibitemShut {NoStop}%
\end{thebibliography}%