My question is similar to this one, but is not covered in the answers.
I am writing a document using subfiles as chapters, for which I use standalone. I work on each chapter separately, and each chapter will appear in the final document with its own bibliography, for which I am using chapterbib. Each file has a \biblio command at the end.
Each of my chapter files compiles separately, but when I try to compile the whole document I get the warning "...Illegal, another \bibdata command"..."I'm skipping whatever remains of this command".
Wrapping the \biblio command in each chapter file prevents this from happening, but then I don't get bibliographies in each chapter, as I need.
Here's a minimal example with the errror:
Preamle for all files:
\documentclass{book}
\usepackage{chapterbib}
\usepackage{standalone}
\usepackage[noadjust]{cite}
\bibliographystyle{unsrt}
Main file:
\begin{document}
\title{MyBook}
\include{Chap1}
\include{Chap2}
\end{document}
Chapter 1 file:
\begin{document}
\chapter{Chapter 1}
\chaptermark{Chap1}
\label{chap:1}
BlaBla\cite{Allen2013}.
\bibliography{biblio}
\end{document}
Chapter2 file:
\begin{document}
\chapter{Chapter 2}
\chaptermark{Chap2}
\label{chap:2}
BlaBla\cite{Baronchelli2018}\cite{Abraham1998}.
\bibliography{biblio}
\end{document}