# Independent Chapters and Unique References

I am trying to setup a report structure so that each author can work on their chapter on their own and once all chapters are finished I can put all together. For this to work well I need each chapter to be completely independent (I was thinking on standalone package) and have their own references. Right now I have all chapters being compiled independently, but once I try to integrated them using import on the main file it just does not work. I am using natbib package.

If anyone have an working example with natbib working together with standalone and import packages, please, share with me! :)

Each chapter should have its own reference file as well!

Thanks!

• Welcome to TeX.SX! In my opinion, \include{chapter1} should work, since the references are maintained, but I am unsure about natbib in this case. Perhaps you should give us a starter document that shows your setup – user31729 Dec 16 '15 at 18:41
• when this need came up at the american math society, the approach we took was to create an add-on package for amsbook that makes certain modifications to the processing of \chapter (to allow an author line as part of the chapter heading) and carries that information into the toc. each author is provided with a copy of the main file that is used to pull all chapters together; an author-specific version contains only one \include statement, for that author's chapter. having a single main file ensures, among other things, that all packages used are compatible. – barbara beeton Dec 16 '15 at 19:06
• Thank you for your responses. After some trials I finally came up with a 'ok' solution. I was trying to setup something like in this [website] (sharelatex.com/learn/Multi-file_LaTeX_projects) . But all worked out nicely when I removed the document class statement for the subfiles \documentclass[float=false, crop=false]{standalone} and used just normal document class statement on them like if they were separate files. As a summary, I used \usepackage{chapterbib}, \usepackage[colon, sort&compress]{natbib} and \usepackage{standalone} all together. I will add example later. – Diogo Silva Dec 17 '15 at 18:58
• I posted a solution, but it was deleted. Worked for me. – Diogo Silva Dec 22 '15 at 7:04
• @DiogoSilva: That wasn't recognizable as solution – user31729 Dec 31 '15 at 9:55

Introduction copied from author's comment and screenshot added by cfr to try to get this recognised as a solution and undeleted.

After some trials I finally came up with a 'ok' solution. I was trying to setup something like in this website.

But all worked out nicely when I removed the document class statement for the subfiles \documentclass[float=false, crop=false]{standalone} and used just normal document class statement on them like if they were separate files.

As a summary, I used \usepackage{chapterbib}, \usepackage[colon, sort&compress]{natbib} and \usepackage{standalone} all together.

# Working solution

The main file (main.tex) contains:

\documentclass[12pt,letterpaper,oneside]{report}
\usepackage{standalone}
\usepackage[colon, sort&compress]{natbib}
\setlength{\bibsep}{12pt}
\usepackage{chapterbib}
\title{Independent Chapters}
\author{Diogo Silva}
\begin{document}
\maketitle
\include{chapter1}
\include{chapter2}
\end{document}


The chapter1.tex contains:

\documentclass[12pt,letterpaper,oneside]{report}
\usepackage[colon, sort&compress]{natbib}
\setlength{\bibsep}{12pt}
\begin{document}
\chapter{Chapter1}
Reference \cite{deutsch1992}.
\bibliographystyle{apalike}
\bibliography{./ch01}
\end{document}


The chapter2.tex contains:

\documentclass[12pt,letterpaper,oneside]{report}
\usepackage[colon, sort&compress]{natbib}
\setlength{\bibsep}{12pt}
\begin{document}
\chapter{Chapter2}
Reference \cite{journel1999markov}.
\bibliographystyle{apalike}
\bibliography{./ch02}
\end{document}


The ch01.bib contains:

@article{deutsch1992,
title={Geostatistical software library and user’s guide},
author={Deutsch, Clayton V and Journel, Andr{\'e} G},
journal={New York},
year={1992}
}


The ch02.bib contains:

@article{journel1999markov,
title={Markov models for cross-covariances},
author={Journel, AG},
journal={Mathematical Geology},
volume={31},
number={8},
pages={955--964},
year={1999},
publisher={Springer}
}