3

I am getting an error when I use hyperref and bibentry packages together. The error is:

./Test.bbl:1: LaTeX Error: Command \BR@bibitem already defined.
               Or name \end... illegal, see p.192 of the manual.

Pointing to l.1 \begin{thebibliography}{2}, which is, of course, the first line of the Text.bbl file.

Test is the name of my MWE file:

\documentclass{article}

\usepackage[pagebackref=true,linktocpage]{hyperref}
\usepackage[square]{natbib}
\usepackage{bibentry}
\nobibliography*

\begin{document}

\section{Introduction}

Look ma, inline bibtex entries:

\begin{itemize}
\item \begin{NoHyper}\bibentry{McCune:2015}\end{NoHyper}
\item \begin{NoHyper}\bibentry{Deshpande:2018aa}\end{NoHyper}
\end{itemize}

\section{And now for something completely different}
Lorem ipsum yada yada,
also see \citep{McCune:2015}, 
yada yada, and \citep{Deshpande:2018aa} too.

\bibliographystyle{abbrvnat}
\bibliography{testref}

\end{document}

The testref.bib file is the following:

@STRING{COMPSUR     = {ACM Comput. Surv.}}

@book{Deshpande:2018aa,
    Author = {Deshpande, Amol and Gupta, Amarnath},
    Date-Added = {2017-04-12 14:27:29 +0000},
    Date-Modified = {2017-04-12 14:28:23 +0000},
    Note = {Forthcoming},
    Publisher = {ACM Books},
    Title = {Principles of Graph Data Management and Analytics},
    Year = {2018}}

@article{McCune:2015,
    Author = {McCune, Robert Ryan and Weninger, Tim and Madey, Greg},
    Journal = COMPSUR,
    Number = {2},
    Numpages = {39},
    Pages = {25:1--25:39},
    Title = {Thinking Like a Vertex: A Survey of Vertex-Centric Frameworks for Large-Scale Distributed Graph Processing},
    Url = {http://doi.acm.org/10.1145/2818185},
    Volume = {48},
    Year = {2015}}

Any suggestions of what I might be doing wrong? If I delete the hyperref package, things work. I did read articles here, but the suggested solutions do not help -- one was to wrap the \bibentry with NoHyper that I have in the MWE (in fact, the MWE is taken from one of those).

0

2 Answers 2

3

Load hyperref after the other packages, see Which packages should be loaded after hyperref instead of before? for excpetions.

\begin{filecontents}{testref.bib}
@STRING{COMPSUR     = {ACM Comput. Surv.}}

@book{Deshpande:2018aa,
    Author = {Deshpande, Amol and Gupta, Amarnath},
    Date-Added = {2017-04-12 14:27:29 +0000},
    Date-Modified = {2017-04-12 14:28:23 +0000},
    Note = {Forthcoming},
    Publisher = {ACM Books},
    Title = {Principles of Graph Data Management and Analytics},
    Year = {2018}}

@article{McCune:2015,
    Author = {McCune, Robert Ryan and Weninger, Tim and Madey, Greg},
    Journal = COMPSUR,
    Number = {2},
    Numpages = {39},
    Pages = {25:1--25:39},
    Title = {Thinking Like a Vertex: A Survey of Vertex-Centric Frameworks for Large-Scale Distributed Graph Processing},
    Url = {http://doi.acm.org/10.1145/2818185},
    Volume = {48},
    Year = {2015}}

\end{filecontents}


\documentclass{article}

\usepackage[square]{natbib}
\usepackage{bibentry}
\nobibliography*
\usepackage[pagebackref=true,linktocpage]{hyperref}

\begin{document}

\section{Introduction}

Look ma, inline bibtex entries:
%
\begin{itemize}
\item \begin{NoHyper}\bibentry{McCune:2015}\end{NoHyper}
\item \begin{NoHyper}\bibentry{Deshpande:2018aa}\end{NoHyper}
\end{itemize}

\section{And now for something completely different}
Lorem ipsum yada yada,
also see \citep{McCune:2015}, 
yada yada, and \citep{Deshpande:2018aa} too.

\bibliographystyle{abbrvnat}
\bibliography{testref}

\end{document}

enter image description here

1
  • Thank you!... I knew hyperref was finicky about order, but I did not think about this for some reason. Many thanks.
    – ozsu
    Apr 12, 2017 at 15:48
0

Loading hyperref after the other packages may not be enough. The hyperref manual suggests the following workaround (change "database" with your own bib file):

  \makeatletter
  \let\saved@bibitem\@bibitem
  \makeatother

  \usepackage{bibentry}
  \usepackage{hyperref}

  \begin{document}

  \begingroup
    \makeatletter
    \let\@bibitem\saved@bibitem
    \nobibliography{database}
  \endgroup

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .