8

I have one bib file containing a full list of references, and show them in three different lists using bibentry.

For this to work, I need to add the bibliography file to the document, but this automatically inserts a "References" section in the document.

Is there a way to include the bibliography, but not show it explicitly?

MNWE:

\documentclass{article}
\usepackage{natbib}
\usepackage{bibentry}
\nobibliography*

\begin{filecontents}{bibliography.bib}
@article{bla,
  title={blabla},
  author={me}
}
@book{blabook,
  title={blablabook},
  author={me}
 }  
\end{filecontents}

\begin{document}
\section*{Some of my finest work}
\bibentry{bla}

\section*{A list of my books}
\bibentry{blabook}

\bibliographystyle{plainnat}
\bibliography{bibliography}
\end{document}

I don't want all the entries duplicated in a "References" list, but I want bibentry to work. I also can't have a strong coupling between my document structure and separate bibliographies (like chapterbib or something), and I'd rather avoid multiple bibliographies altogether.

rubenvb
  • 3,883
  • 4
  • 26
  • 36

2 Answers2

10

It's almost as easy as changing \nobibliography* into \nobibliography{<file>}:

\begin{filecontents*}{\jobname.bib}
@article{bla,
  title={blabla},
  author={me}
}
@book{blabook,
  title={blablabook},
  author={me}
 }
\end{filecontents*}

\documentclass{article}

\usepackage{natbib}
\usepackage{bibentry}
\bibliographystyle{plainnat}

\begin{document}
\nobibliography{\jobname}

\section*{Some of my finest work}
\bibentry{bla}

\section*{A list of my books}
\bibentry{blabook}

\end{document}

I used \jobname not to clobber files on my system, the argument to \nobibliography should be the one of your .bib file.

Note that the command must go after \begin{document}.

egreg
  • 1,121,712
  • Brilliantly simple. I read the docs (bibentry and natbib), and found no mention of this. Thanks (again :)). – rubenvb Feb 24 '15 at 14:24
0

egreg's solution gives me funny errors about list items, but the following works for me:

\hphantom{\vphantom{
    \begin{minipage}{\textwidth}
        \bibliography{mybibfile.bib}
    \end{minipage}
}}

Note that nesting hphantom and vphantom has the effect of typesetting the contents but replacing them with a 0x0 box. See this answer.

Without the minipage, I still get the errors about list items.

dremodaris
  • 464
  • 4
  • 13