0

This is similar to a previous question, however I cannot find fixes using their answers. MWE code below. Using Overleaf, I want to include a bibliography at the end of each chapter plus one cohesive bibliography at the end, using the natbib package and plainnat style. When I compile, I get the intended result, however also the following errors:

enter image description here

(Text for copying: "BibTeX Illegal, another \bibstyle command : \bibstyle : {plainnat}", "BibTeX Illegal, another \bibdata command : \bibdata : {References}")

Even though the output is what I want, I like to be pedantic with my code and deal with any errors if possible. I have already cleared the cached files and refreshed. My minimum working example code is:

chapter1.tex

\chapter{Title}

Content, including a reference \citep{solopova2014bet}.

\bibliographystyle{plainnat}
\bibliography{References}

chapter2.tex

\chapter{Title}

Content, including a reference \citep{godin2010using}.

\bibliographystyle{plainnat}
\bibliography{References}

References.bib

@article{solopova2014bet,
  title={Bet-hedging during bacterial diauxic shift},
  author={Solopova, Ana and van Gestel, Jordi and Weissing, Franz J and Bachmann, Herwig and Teusink, Bas and Kok, Jan and Kuipers, Oscar P},
  journal={Proceedings of the National Academy of Sciences},
  volume={111},
  number={20},
  pages={7427--7432},
  year={2014},
  publisher={National Acad Sciences}
}

@article{godin2010using,
  title={Using buoyant mass to measure the growth of single cells},
  author={Godin, Michel and Delgado, Francisco Feij{\'o} and Son, Sungmin and Grover, William H and Bryan, Andrea K and Tzur, Amit and Jorgensen, Paul and Payer, Kris and Grossman, Alan D and Kirschner, Marc W and others},
  journal={Nature methods},
  volume={7},
  number={5},
  pages={387--390},
  year={2010},
  publisher={Nature Publishing Group}
}

Thesis.tex

\documentclass{report}

\usepackage{natbib}
\usepackage{chapterbib}

\begin{document}

\include{chapter1}
\include{chapter2}

\bibliography{References}

\end{document}
1

[Disclaimer: I'm a support personnel at Overleaf.]

This isn't specific to Overleaf; compiling your MWE files on a local computer would also yield the same error messages. When using chapterbib, there's usually no "global bibliography" so the \bibliography{References} in Thesis.tex would cause problems: see item #2 in "Usage, Restrictions, and Options" section of the chapterbib package documentation.

You may want to use the bibunits package instead, which has an option to also list "local" citations in a "global" reference list.

  1. Load bibunits with the globalcitecopy option to add an entry to the global bibliography as well. If you are using the same .bib file and the same bibliography style for all units, you can use \defaultbibliography{...} and \defaultbibliographystyle{...} to specify them.

  2. Use \bibliographyunit[\chapter] to activate each \chapter as a local bibliography unit. Within each \include file containing the chapter, use \putbib to insert the local bibliography/reference list.

  3. For the "global" bibliography in the root Thesis.tex file: use the usual \bibliographystyle{...} and \bibliography{...}.

Here are the sample Thesis.tex and chapter1.tex files (chapter2.tex would be similar).

Thesis.tex

\documentclass{report}

\usepackage[sectionbib]{natbib}
\usepackage[globalcitecopy]{bibunits}
\defaultbibliographystyle{plainnat}
\defaultbibliography{References}

\begin{document}
\bibliographyunit[\chapter]

\include{chapter1}
\include{chapter2}

\bibliographystyle{plainnat}
\bibliography{References}

\end{document}

chapter1.tex (similarly chapter2.tex)

\chapter{Title}

Content, including a reference \citep{solopova2014bet}.

\putbib
| improve this answer | |
  • Clear explanation and it works perfectly, thank you! (And sorry for such a late reply - classic thesis-avoidance) – ddm_ingram Mar 26 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.