[Tex/LaTex] \bibentry command do not work with bibunit environment

bibentrybibunits

I would like to use \bibentrycommand to list my personal article in a PhD thesis. However, I use the bibunits environement to separate bibliography into parts and this prevents \bibentry to work.

Any ideas?

\usepackage{bibunits}
\usepackage{bibentry}
\nobibliography*  

\begin{document}

\begin{bibunit}[customstyle]
\include{intro/intro} % in this files I placed \bibentry

\include{chapter1/chapter1}
\include{chapter2/chapter2}
\include{chapter4/chapter3}
\putbib[biblio/biblio]
\end{bibunit}

\begin{bibunit}
\include{articel1/article1}
\putbib[biblio/biblio]
\end{bibunit}

\end{document}

Best Answer

I think that for bibentry to works, the reference must be written in one way or another within the global bibliography, which is not something that is done by default within a bibunit environment since it uses its own .bbl file. It is said in the documentation of bibentry:

There is only one .bbl file, and hence one list of references. Since \nobibliography* does not have its own list of database files, one cannot take the \bibentry citations from separate databases.

I've found two ways that seems to make this work:

  • use the option globalcitecopy of the package bibunits. This will create an entry in the global bibliography for each cite command within a bibunit ;
  • call the citation with a \nocite command before and outside of bibunit.

In either cases, you need to call \nobibliography before and outside the first bibunit. Here is a MWE that illustrates what I said above:

\documentclass[]{article}

\usepackage[globalcitecopy]{bibunits}
\usepackage{bibentry}

\usepackage{natbib}
\bibliographystyle{plainnat}

\begin{document}

    \nobibliography{MyLibrary}
    % Use \nobibliography* if a global \bibliography environment
    % is present to avoid the "multiply" warning.
    \nocite{*} % Or call each citation separately

    \begin{bibunit}[plainnat]

        \section{First Bibunit environment with bibentry}

        This is some \emph{bibentry}:

        \begin{itemize}
            \item \bibentry{stallman_steady_1965}
            \item \bibentry{taniguchi_evaluation_1993}
        \end{itemize}

        \putbib[MyLibrary]

    \end{bibunit}

    \begin{bibunit}[plainnat]

        \section{Second Bibunit environment with bibentry}

        This is some \emph{bibentry}:

        \begin{itemize}
            \item \bibentry{stallman_steady_1965}
            \item \bibentry{anderson_heat_2005}
        \end{itemize}

        \putbib[MyLibrary]

    \end{bibunit}

\end{document}

Here is the content of the MyLibrary.bib file:

@article{anderson_heat_2005,
         title = {Heat as a {Ground} {Water} {Tracer}},
         volume = {43},
         doi = {10.1111/j.1745-6584.2005.00052.x},
         number = {6},
         journal = {Ground Water},
         author = {Anderson, Mary P.},
         year = {2005},
         pages = {951--968}
}

@article{stallman_steady_1965,
         title = {Steady one-dimensional fluid flow in a semi-infinite porous     medium with sinusoidal surface temperature.},
         volume = {70},
         doi = {10.1029/JZ070i012p02821},
         number = {12},
         journal = {Journal of Geophysical Research},
         author = {Stallman, R W},
         year = {1965},
         pages = {2821--2827}
}

@article{taniguchi_evaluation_1993,
         title = {Evaluation of vertical groundwater fluxes and thermal properties of aquifers based on transient temperature-depth profiles.},
         volume = {29},
         doi = {10.1029/93WR00541},
         journal = {Water Resources Research},
         author = {Taniguchi, M},
         year = {1993},
         note = {D031},
         pages = {2021--2026}
}

Here is the result:

enter image description here