Closed CSQ223 closed 4 years ago
增加
\usepackage{xpatch}
\AtBeginDocument{%
\xpatchcmd\doi
{doi: }{}
{}{\fail}%
}
完整例子
\begin{filecontents}{bib-example.bib}
% ref: https://www.overleaf.com/learn/latex/Bibliography_management_with_bibtex
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
\end{filecontents}
\documentclass{article}
\usepackage{gbt7714}
\usepackage{bibentry}
\usepackage{xpatch}
\AtBeginDocument{%
\xpatchcmd\doi
{doi: }{}
{}{\fail}%
}
\begin{document}
\nobibliography{bib-example}
\bibentry{einstein}
\end{document}
输出效果
PS:提问时请尽量提供完整的例子,方便彼此。
谢谢。 下次提问会附上完整例子的^_^
natbib
提供的 plainnat.bst
是这样写的:
"\expandafter\ifx\csname urlstyle\endcsname\relax"
write$ newline$
" \providecommand{\doi}[1]{doi: #1}\else"
write$ newline$
" \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
write$ newline$
这一段是写在 .bbl
文件中 thebibliography
环境的开始处的。
然后有人提出需要给 doi 加上 超链接,这个稍微修改下也不难解决。
结果后来有人提出可能有多个 DOI (https://github.com/ustctug/ustcthesis/issues/181 ),所以为了加超链接就把 \doi
改了……
编译环境
宏包版本:随texlive2019发布的 标注样式:super
描述问题
配合使用bibentry宏包,造成的doi三个字母的重复。
在宏包里面定义了DOI三个字母标识的输出,但是其他的原包里面也有doi三个字母的输出,造成重复。具体可以看到截图。
如果您有更合适引用bibentry的方法,也望告知。谢谢。
截图: