我想在我的文档中使用\bibentry
和hyperref
。但是当我像下面的示例一样使用它时,我得到了错误
具有相同标识符(名称{cite.Duhm_AppliedPhysicsLetters_2009})的目标已被使用,重复项被忽略
我发现 这项工作效果很好(下面示例中的注释版本)。然而,参考书目风格斯塔托,将标题超链接到相应的 URL,我也想将其保留在bibentry
(我不关心参考书目本身中是否有指向该项目的超链接)。这个问题有解决方案吗?这不是一个简单的解决方法,而是完全忽略超链接?
\begin{filecontents}{mytestbib.bib}
@ARTICLE{Duhm_AppliedPhysicsLetters_2009,
author = {Duhm, Steffen and Salzmann, Ingo and Bröker, Benjamin and Glowatzki,
Hendrik and Johnson, Robert L. and Koch, Norbert},
title = {Interdiffusion of molecular acceptors through organic layers to metal
substrates mimics doping-related energy level shifts},
journal = {Applied Physics Letters},
year = {2009},
volume = {95},
pages = {093305},
doi = {10.1063/1.3213547},
issn = {00036951},
url = {http://link.aip.org/link/APPLAB/v95/i9/p093305/s1&Agg=doi},
urldate = {2011-11-05}
}
\end{filecontents}
\documentclass{article}
\usepackage{filecontents}
\usepackage{natbib}
\usepackage[pdftex]{hyperref}
\usepackage{fancyhdr}
\usepackage{bibentry}
\makeatother \nobibliography*
\begin{document}
A full in-text cite of
%\begin{NoHyper}\bibentry{Duhm_AppliedPhysicsLetters_2009}\end{NoHyper}.
\bibentry{Duhm_AppliedPhysicsLetters_2009}.
A regular citation \cite{Duhm_AppliedPhysicsLetters_2009}.
\bibliographystyle{statto}
\bibliography{mytestbib}
\end{document}
答案1
您可以\bibentry
通过添加以下代码重新定义该命令,使其不创建超链接目标:
\makeatletter
\renewcommand\bibentry[1]{\nocite{#1}{\frenchspacing
\@nameuse{BR@r@#1\@extra@b@citeb}}}
\makeatother
你的序言。
例如您的示例(natbib
从您的评论中添加了选项,因此不会引发错误);文中的普通引用现在链接到参考书目:
\begin{filecontents}{mytestbib.bib}
@ARTICLE{Duhm_AppliedPhysicsLetters_2009,
author = {Duhm, Steffen and Salzmann, Ingo and Bröker, Benjamin and Glowatzki,
Hendrik and Johnson, Robert L. and Koch, Norbert},
title = {Interdiffusion of molecular acceptors through organic layers to metal
substrates mimics doping-related energy level shifts},
journal = {Applied Physics Letters},
year = {2009},
volume = {95},
pages = {093305},
doi = {10.1063/1.3213547},
issn = {00036951},
url = {http://link.aip.org/link/APPLAB/v95/i9/p093305/s1&Agg=doi},
urldate = {2011-11-05}
}
\end{filecontents}
\documentclass{article}
\usepackage{filecontents}
\usepackage[square, sort&compress, numbers]{natbib}
\usepackage{fancyhdr}
\usepackage{bibentry}
\usepackage[pdftex]{hyperref}
\nobibliography*
\makeatletter
\renewcommand\bibentry[1]{\nocite{#1}{\frenchspacing
\@nameuse{BR@r@#1\@extra@b@citeb}}}
\makeatother
\begin{document}
A full in-text cite of
\bibentry{Duhm_AppliedPhysicsLetters_2009}.
A regular citation \cite{Duhm_AppliedPhysicsLetters_2009}.
\bibliographystyle{statto}
\bibliography{mytestbib}
\end{document}
新的定义只是来自的代码bibentry.sty
,即
\newcommand\bibentry[1]{\nocite{#1}{\frenchspacing
\hyper@natanchorstart{#1\@extra@b@citeb}%
\@nameuse{BR@r@#1\@extra@b@citeb}\hyper@natanchorend}}
已删除 hyperref anchor 开始/结束命令。