完整示例

完整示例

威利似乎正在分配DOIs为一些期刊使用他们自己的语义模式。例如 10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V

此类 DOI 在通过 biblatex 处理时会产生两个不良副作用:

  1. 它们包含非 URL 安全字符。Biblatex 似乎无法正确处理这些 DOI。因此,文档中生成的链接不起作用。
  2. DOI 本身很长,会引入空格,因此很难将其复制为文本。

以下是示例 DOI 的输出:

巴德多伊

包含.bblDOI 原件:

\verb{doi}
\verb 10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V
\endverb

所以我猜测问题稍后会出现,可能是在 biblatex-hyperref 界面中。

有没有办法让这些 DOI 与 biblatex 一起工作?


完整示例

LaTeX 源

\documentclass{article}
\usepackage{plex-otf}
\usepackage{filecontents}

\begin{filecontents}[overwrite]{sample.bib}
@article{lynch-jasist01,
  author        = {Lynch, Clifford A.},
  title         = {When documents deceive: Trust and provenance as new factors for information retrieval in a tangled web},
  journal       = {Journal of the American Society for Information Science and Technology},
  volume        = {52},
  number        = {1},
  pages         = {12--17},
  month         = {11},
  year          = {2000},
  doi           = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
}
\end{filecontents}

\usepackage[colorlinks]{hyperref}
\usepackage{xpatch}
\usepackage[backend=biber,natbib=true,bibstyle=alphabetic,citestyle=alphabetic]{biblatex}
\ExecuteBibliographyOptions{sorting=nyt, sortlocale=auto}
\addbibresource{sample.bib}

\begin{document}
\title{BibLaTeX and weird DOIs}
\maketitle

On StackExchange, there's a
discussion\footnote{\url{https://tex.stackexchange.com/q/558432/}} about
whether DOIs with non URL-safe characters (e.g. \autocite{lynch-jasist01})
are properly handled by BibLaTeX.

\printbibliography[title=References]
\end{document}

使用的软件

  • 乳胶:This is LuaTeX, Version 1.10.0 (TeX Live 2019)
  • 比伯:biber version: 2.14
  • 查看器:预览版 10.1 (MacOS Mojave)、Skim 1.5.11

答案1

它并没有准确回答您的问题,但您可能仍对以下内容感兴趣。明确指出 DOI(长或短)对读者来说并没有太大用处。重要的是指向引用文档的可点击链接。然后,我们的想法是让单词“DOI”可点击,并以实际 DOI 作为底层链接。实现此目的的一种方法是使用addendum.bib输入的字段来插入\href{actual link}{clickable term}命令:

@article{Clifford2001,
author = {Lynch, Clifford A.},
title = {When documents deceive: Trust and provenance as new factors for information retrieval in a tangled web},
journal = {Journal of the American Society for Information Science and Technology},
volume = {52},
number = {1},
pages = {12-17},
ddoi = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year = {2001},
addendum = {\href{https://doi.org/10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V}{DOI}}
}

请注意,我已将该doi字段修改为,ddoi以便在编译期间将其忽略。更好的解决方案是保留原始.bib条目:

@article{Clifford2001,
author = {Lynch, Clifford A.},
title = {When documents deceive: Trust and provenance as new factors for information retrieval in a tangled web},
journal = {Journal of the American Society for Information Science and Technology},
volume = {52},
number = {1},
pages = {12-17},
doi = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year = {2001},
}

并要求biblatex在编译期间实现上述目标,但我不知道如何实现。

答案2

在我的测试中,您的条目以及来自sigfridsson的条目biblatex-examples.bib都可以很好地链接 Windows 10 上的多个 PDF 查看器(Sumatra PDF、Adobe Reader、Firefox、Chrome、Edge 等),也可以很好地复制和粘贴(减去换行符)。

\documentclass{article}
\usepackage{plex-otf}

\usepackage[backend=biber, style=alphabetic]{biblatex}
\usepackage[colorlinks]{hyperref}

\begin{filecontents}{\jobname.bib}
@article{lynch,
  author  = {Lynch, Clifford A.},
  title   = {When Documents Deceive:
             Trust and Provenance as New Factors
             for Information Retrieval in a Tangled Web},
  journal = {Journal of the American Society
             for Information Science and Technology},
  volume  = {52},
  number  = {1},
  pages   = {12-17},
  doi     = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
  year    = {2001},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{lynch, sigfridsson}
\printbibliography[title=References]
\end{document}

DOI 链接正确

MacOS 上的某些查看器存在一些已知问题,请参阅https://github.com/latex3/hyperref/issues/110Revtex. 一些 DOI 链接因长参考书目而中断据我所知,大家一致认为这是这些查看器中的一个错误,而不是 LaTeX 的问题。


转义 DOI 中的某些特殊字符可能会有所帮助,如https://www.doi.org/doi_handbook/2_Numbering.html

如果您仍想显示未转义的 DOI,则需要一些技巧。

\documentclass{article}
\usepackage{plex-otf}

\usepackage[backend=biber, style=alphabetic]{biblatex}
\usepackage[colorlinks]{hyperref}

\DeclareSourcemap{
  \maps{
    \map{
      \step[fieldsource=doi]
      \step[fieldset=verba, origfieldval]
      \step[fieldsource=doi, match=\regexp{\x{28}}, replace=\regexp{\x{25}28}]
      \step[fieldsource=doi, match=\regexp{\x{29}}, replace=\regexp{\x{25}29}]
      \step[fieldsource=doi, match=\regexp{\x{3C}}, replace=\regexp{\x{25}3C}]
      \step[fieldsource=doi, match=\regexp{\x{3E}}, replace=\regexp{\x{25}3E}]
    }
  }
}

\DeclareFieldFormat{doi}{%
  \mkbibacro{DOI}\addcolon\space
  \ifhyperref
    {\href{https://doi.org/#1}{\nolinkurl{\thefield{verba}}}}
    {\nolinkurl{\thefield{verba}}}}

\begin{filecontents}{\jobname.bib}
@article{lynch,
  author  = {Lynch, Clifford A.},
  title   = {When Documents Deceive:
             Trust and Provenance as New Factors
             for Information Retrieval in a Tangled Web},
  journal = {Journal of the American Society
             for Information Science and Technology},
  volume  = {52},
  number  = {1},
  pages   = {12-17},
  doi     = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
  year    = {2001},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{lynch, sigfridsson}
\printbibliography[title=References]
\end{document}

当然,令人不快的换行总是一个问题。biblatex有一些选项可以调整 URL 和 DOI 换行,请参阅biblatex 书目中的长 URL 的换行符?尽管使用了 biburllcpenalty,BibLaTeX 长 URL 仍延伸到边框一个简单的解决方案可能是加载xurl包,它允许在任何地方的 URL 中换行。

\documentclass{article}
\usepackage{plex-otf}

\usepackage[backend=biber, style=alphabetic]{biblatex}
\usepackage{xurl}
\usepackage[colorlinks]{hyperref}

\begin{filecontents}{\jobname.bib}
@article{lynch,
  author  = {Lynch, Clifford A.},
  title   = {When Documents Deceive:
             Trust and Provenance as New Factors
             for Information Retrieval in a Tangled Web},
  journal = {Journal of the American Society
             for Information Science and Technology},
  volume  = {52},
  number  = {1},
  pages   = {12-17},
  doi     = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
  year    = {2001},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\begin{document}
\autocite{lynch, sigfridsson}
\printbibliography[title=References]
\end{document}

略有不同的 DOI 损坏。

相关内容