Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to used \bibentryand hyperref in my document. However when I use it as in the sample below I get the error

destination with the same identifier (name{cite.Duhm_AppliedPhysicsLetters_2009}) has been already used, dublicate ignored

I found this work around which works well (commented version in the sample below). However, the bibliography style statto, hyperlinks the title to the respective url, which I would like to keep also in the bibentry (I don't care if there is a hyperlink to the item in the bibliography itself). Is there a solution for this problem, which is not a simple work around which completely ignores the hyperlink?

\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}
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can redefine the \bibentry command so it does not create a hyperref target by adding

\makeatletter
\renewcommand\bibentry[1]{\nocite{#1}{\frenchspacing
     \@nameuse{BR@r@#1\@extra@b@citeb}}}
\makeatother

to your preamble.

E.g. your example (with natbib options added from your commet so it does not throw an error); the in text ordinary citation now links to the bibliography:

Sample output

\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}

The new definition is just the code from bibentry.sty, i.e.

\newcommand\bibentry[1]{\nocite{#1}{\frenchspacing
     \hyper@natanchorstart{#1\@extra@b@citeb}%
     \@nameuse{BR@r@#1\@extra@b@citeb}\hyper@natanchorend}}

with the hyperref anchor start/end commands removed.

share|improve this answer
    
I added your solution to my file and it works fine. I seems that using \usepackage[square, sort&compress, numbers]{natbib} (instead of just natbibonly) as I have it in my file gives no error. Could you quickly explain the different elements you use in the solution? –  Tanja Oct 30 '13 at 15:05
    
@user2758804 natbib options now added to my code. Short explanation of where the command comes from added. –  Andrew Swann Oct 30 '13 at 15:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.