10

I'm using the bibentry package for inserting my bibitems into a CV without printing the bibliography. This works just fine until I load hyperref. Then I get the error message Lonely \item--perhaps a missing list environment. There is supposed to be a workaround (see here), which I included as deactivated in the code below. When using it, I still get the error message. Is there another solution (no biblatex please) or am I not using the workaround correctly?

\begin{filecontents}{\jobname.bib}
@Book{elvis,
    author = "Elvis Presley",
    title = "Turn Me One More Time",
    publisher = "Jail House Books",
    year = 1963,
}
\end{filecontents}
\documentclass{article}
%\makeatletter
%\let\saved@bibitem\@bibitem
%\makeatother
\usepackage{bibentry}
\nobibliography*
\usepackage{hyperref}
\begin{document}
\bibentry{elvis}
%\bibliographystyle{plain}           % works fine
\bibliographystyle{elsart-harv}     % gives an error
\nobibliography{\jobname}       % comment out when using the workaround
%\begingroup
%\makeatletter
%\let\@bibitem\saved@bibitem
%\nobibliography{\jobname}
%\endgroup
\end{document}

EDIT: Turns out, the problem is not just about bibentry and hyperref. For your convenience I replaced my actual bib-style elsart-harv with plain. It didn't come to my mind that the style could be the crux of this matter, but it obviously is.

lockstep
  • 250,273
meep.meep
  • 16,905
  • 2
    Your example (plus workaround) works for me. Try to update your TeX distribution and/or delete all auxiliary files and compile again. – lockstep Jul 31 '12 at 15:34
  • You are right. The problem lies at another point. I edited my question accordingly. – meep.meep Aug 01 '12 at 07:34

1 Answers1

7

This seems simpler:

\begin{filecontents}{\jobname.bib}
@Book{elvis,
    author = "Elvis Presley",
    title = "Turn Me One More Time",
    publisher = "Jail House Books",
    year = 1963,
}
\end{filecontents}
\documentclass{article}
\bibliographystyle{plain}

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

\begin{document}
\nobibliography*
\bibentry{elvis}
\nobibliography{\jobname}
\end{document}

The following shows how to integrate elsarticle-harv.bst

\begin{filecontents}{\jobname.bib}
@Book{elvis,
    author = "Elvis Presley",
    title = "Turn Me One More Time",
    publisher = "Jail House Books",
    year = 1963,
}
\end{filecontents}
\documentclass{article}
\usepackage{natbib}
\bibliographystyle{elsarticle-harv}

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

\begin{document}
\nobibliography*
\bibentry{elvis}
\nobibliography{\jobname}       % comment out when using the workaround
\end{document}
egreg
  • 1,121,712
  • Thanks for your help. This is surely simpler than my given code. Unfortunately, I just realized, the actual problem lies with the bibliographystyle. i edites my question accordingly. – meep.meep Aug 01 '12 at 07:36
  • @meep.meep The elsarticle-harv.bst style requires the natbib package (I guess that elsart-harv is an obsolete version). I added a working version with the more modern style. – egreg Aug 01 '12 at 09:19
  • Thanks a lot. Once for calling my attention to the never version and for the solution. I really was a blokhead on this one. I actually know about the need for natbib, but it slipped my mind here. – meep.meep Aug 01 '12 at 10:23
  • I had a similar problem. I changed the style to plain and I still get the error. pdflatex compiles fine the first time, bibtex compiles fine too. The second time I run pdflatex I get the error. I am using the splitbib package. Any ideas? – fiacobelli Mar 07 '13 at 22:04
  • @fiacobelli I guess that a new question is in order, with a M(non)WE. – egreg Mar 07 '13 at 22:19
  • Just came across this myself without an embedded bib file though. I'm new to latex, but what is the actual reason for this bug? To describe a workaround like the document does w/out reason/symptom is not helpful. It was a very frustrating process figuring out why. Are there idiomatic ways to debug such conflicts? Thanks. – nlucaroni Sep 09 '13 at 14:52
  • @nlucaroni This workaround disables any trick hyperref is doing to \@bibitem, which is redefined by bibentry in a way that seems to displease hyperref. – egreg Sep 09 '13 at 15:27