Hyperref, bibentry & natbib conflict - incorrect hyperlink
Wrap the \bibentry
in NoHyper
s i.e.
\begin{NoHyper}\bibentry{elvis}\end{NoHyper}
The hyperlink now points to the correct entry in the references.
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.