BibTeX – How to Use Multiple .bib Files in a Single .tex File

bibliographiesbibtexsubdividing

I am writing a collaborative document in which each author
edits a main.tex file and provides a <author>.bib file (no \include, no \input … I know it's not the ideal choice but it was not my decision).

What we are having issues with is that we can't manage to have multiple bibliographies at the end of each chapter (chapterbib requires to use \include, it mention something in the manual to have a single file, but it is not very clear to me how to do it)

A minimal example is like this:

% main.tex
\documentclass[a4paper,11pt,oneside,openright]{book}
\usepackage{natbib}
\usepackage{chapterbib}

\begin{document}
\chapter{Author 1}
\section{author 1 section}
..something
\addcontentsline{toc}{section}{\bibname}
\bibliographystyle{unsrtnat}
\pagestyle{plain}
\bibliography{author_1}

\chapter{Author 2}
\section{author 2 section}
..something
\addcontentsline{toc}{section}{\bibname}
\bibliographystyle{unsrtnat}
\pagestyle{plain}
\bibliography{author_2}

\end{document}

author_1.bib

@article{lagrange1772essai,
  title={Essai sur le probleme des trois corps},
  author={Lagrange, J.L.},
  journal={{\OE}uvres},
  volume={6},
  pages={229--324},
  year={1772}
}

author_2.bib

@article{euler1741solutio,
  title={Solutio problematis ad geometriam situs pertinentis},
  author={Euler, L.},
  journal={Commentarii academiae scientiarum Petropolitanae},
  volume={8},
  pages={128--140},
  year={1741}
}

It might happen that author_1.bib and author_2.bib contain the same reference (with the same id key probably).

Any hint how to do that?

Best Answer

The answer is pretty straightforward when using the biblatex package. It is somehow compatible with natbib, but if you can ditch it all together, it is even better.

With biblatex you can list different bib files to your latex document and assign them to specific section considered for the separate bibliographies (refsections in biblatex terms) with \addbibresource[]{}

\documentclass[a4paper,11pt,oneside,openright]{book}
\usepackage{biblatex}
\addbibresource{author_1}
\addbibresource{author_2}
\begin{document}
\chapter{author 1 section}
\begin{refsection}[author_1]
...
\printbibliography[heading=subbibliography]
\end{refsection}
\chapter{author 2 section}
\begin{refsection}[author_2]
...
\printbibliography[heading=subbibliography]
\end{refsection}
\end{document}

I advise you to read the full doc of biblatex, you can also automatically affect refsection to chapter, part, or section, without having to specify the environment.