8

Problem

I want to cite references in text as well as quote the entire entry plus have a reference list at the end. For this I use hyperref, bibentry and natbib. I've taken as inspiration this post. The only difference is that I want to include a reference list as well.

The problem is that the hyperlink points to the \bibentry rather than the entry in the reference.

MWE

\documentclass{article}
\usepackage{natbib}
\bibliographystyle{abbrvnat}

\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\usepackage{hyperref}
\makeatletter\let\@bibitem\saved@bibitem\makeatother

\begin{document}
\nobibliography*
Here is a citation \citet{elvis}
%\newpage %uncomment this line and the line below eliminates error but hyperlink still points to \bibentry

Here is the full entry \bibentry{elvis}
%\newpage %uncomment this line 

\bibliography{bibliography}
\end{document}

The bib file, bibliography.bib

@Book{elvis,
    author = "Elvis Presley",
    title = "Turn Me One More Time",
    publisher = "Jail House Books",
    year = 1963,
}

Warning

The above code gives a warning:

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

Solution?

  • Interestingly, adding \newpages to split up the \citet and \bibentry onto separate pages eliminates the warning but the hyperlinking is still wrong.
  • Removing natbib but again hyperlinking does not work.

Does anybody have any ideas how I can solve this problem?

11

Wrap the \bibentry in NoHypers i.e.

\begin{NoHyper}\bibentry{elvis}\end{NoHyper}

The hyperlink now points to the correct entry in the references.

  • 1
    Do you know if there is a way to avoid the hyperlink to point to the reference (and not to the bibentry) and to have an hyperlink in the bibentry itself (for example an url for the preprint)? Thank you in advance for your answer. -Pierre – Marca85 Jul 5 '13 at 15:19
  • This does indeed fix the internal document link, but if there is a hyperlink in the bibliography entry itself, it is not hyperlinked anymore, unfortunately. A way to have both would be brilliant. – rubenvb Jun 26 '15 at 13:24
  • this is the only answer that fixes my problem of aligning references in a tabular. – Tu Bui Mar 4 '18 at 13:31
2

I'd add this to the top answer's comment thread, but I do not yet have the requisite reputation for commenting. With regard to rubenvb's request in response to wrapping \bibentry in a NoHyper environment:

This does indeed fix the internal document link, but if there is a hyperlink in the bibliography entry itself, it is not hyperlinked anymore, unfortunately. A way to have both would be brilliant.

You can eschew NoHyper for a simple solution to correctly hyperlink citations to their corresponding non-\bibentry reference items (while maintaining existing hyperlinks within the \bibentry like URLs):

In your .bib file (or if you've defined your bibliographic entries in your preamble), duplicate those references in full and add some differentiating text in the citekey. I like to add -in to the end of the citekeys I'll use for \bibentry items, since they'll be incorporated -in the text. Then, add the multibib environment to your .tex file as described in this answer. If you try to use multibib without duplicating the .bib entry of interest, citations will still jump to \bibentry instead of your bibliography.

MWE

Broken hyperlinks

test.bib file:

@article{Lee:2011ct,
author = {Lee, Hun and Lee, Kangsun and Ahn, Byungwook and Xu, Jing and Xu, Linfeng and Oh, Kwang W},
title = {{A new fabrication process for uniform SU-8 thick photoresist structures by simultaneously removing edge bead and air bubbles}},
journal = {Journal of Micromechanics and Microengineering},
year = {2011},
volume = {21},
number = {12},
pages = {125006--9},
month = nov,
doi = {10.1088/0960-1317/21/12/125006},
read = {Yes},
date-added = {2018-06-21T17:15:45GMT},
url = {http://stacks.iop.org/0960-1317/21/i=12/a=125006?key=crossref.dabe730af97ae5fbb7d5b6bb62b8eb90}}

test.tex file:

\documentclass{article}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{bibentry}

\begin{document}
\nobibliography*

Here is a citation \citet{Lee:2011ct}

Here is the full entry \bibentry{Lee:2011ct}

\newpage

\bibliography{test}
\bibliographystyle{abbrvnat}

\end{document}

With this, we'll see improper hyperlinking from the first instance of \citet to the \bibentry (instead of the References section on the next page).

Fixed hyperlinks

This is easily resolved by duplicating and modifying our .bib item that we want to include as a \bibentry and adjusting the .tex file:

test.bib file:

@article{Lee:2011ct,
author = {Lee, Hun and Lee, Kangsun and Ahn, Byungwook and Xu, Jing and Xu, Linfeng and Oh, Kwang W},
title = {{A new fabrication process for uniform SU-8 thick photoresist structures by simultaneously removing edge bead and air bubbles}},
journal = {Journal of Micromechanics and Microengineering},
year = {2011},
volume = {21},
number = {12},
pages = {125006--9},
month = nov,
doi = {10.1088/0960-1317/21/12/125006},
read = {Yes},
date-added = {2018-06-21T17:15:45GMT},
url = {http://stacks.iop.org/0960-1317/21/i=12/a=125006?key=crossref.dabe730af97ae5fbb7d5b6bb62b8eb90}}

@article{Lee:2011ct-in,
author = {Lee, Hun and Lee, Kangsun and Ahn, Byungwook and Xu, Jing and Xu, Linfeng and Oh, Kwang W},
title = {{A new fabrication process for uniform SU-8 thick photoresist structures by simultaneously removing edge bead and air bubbles}},
journal = {Journal of Micromechanics and Microengineering},
year = {2011},
volume = {21},
number = {12},
pages = {125006--9},
month = nov,
doi = {10.1088/0960-1317/21/12/125006},
read = {Yes},
date-added = {2018-06-21T17:15:45GMT},
url = {http://stacks.iop.org/0960-1317/21/i=12/a=125006?key=crossref.dabe730af97ae5fbb7d5b6bb62b8eb90}}

test.tex file:

\documentclass{article}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{bibentry}
\usepackage{natbib}
\usepackage{multibib}
\newcites{q}{References}

\begin{document}
\nobibliography*

Here is a citation \citetq{Lee:2011ct}

Here is the full entry \bibentry{Lee:2011ct-in}

\newpage

\bibliographystyleq{abbrvnat}
\bibliographyq{test.bib}
\bibliographystyle{abbrvnat}
\nobibliography{test.bib}

\end{document}

This produces your desired output: the in-text citation links to the bibliography, and the URL in the \bibentry item is still functional without being hyperlinked to the in-text citation. To compile this .tex file, use the following build order:

pdflatex test.tex
bibtex q
bibtex test
pdflatex test
pdflatex test

I know it's been almost six years since this was first asked, but I recently found this solution useful and wanted it to be available for anyone else who might come across this thread.

1

What also helps is to use BOTH packages: natbib AND bibentry.

The issue is then ressolved for me.

Thus, make use of:

\usepackage{natbib}
\usepackage{bibentry}
\usepackage{fancyhdr}
\usepackage{hyperref}

Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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