I'd like to have the bibliography of each chapter at its end. Here is an MWE of how I built my thesis:
I have a directory tree which looks like this:
|-main.tex
|-ref.bib
|--Ch1
|---ch1.tex
|--Ch2
|---ch2.tex
And I'm using \subfiles
to build the document.
main.tex
\documentclass{article}
\usepackage{subfiles}
\usepackage{natbib}
\begin{document}
\subfile{Ch1/ch1.tex}
\subfile{Ch2/ch2.tex}
% Experimenting with configurations of bibliography
% \bibliography{ref}
\end{document}
Ch1/ch1.tex
\documentclass[../main.tex]{subfiles}
\begin{document}
\chapter{Chapter 1}
I am a reference from chapter 1.\citep{lamport1994latex}
\bibliographystyle{agsm}
\bibliography{ref}
\end{document}
Ch2/ch2.tex
\documentclass[../main.tex]{subfiles}
\begin{document}
\chapter{Chapter 2}
I am a reference from chapter 2.\citep{goossens1997latex}
\bibliographystyle{agsm}
\bibliography{ref}
\end{document}
ref.bib
@article{lamport1994latex
title={LATEX user’s guide and reference manual},
author={Lamport, Leslie},
year={1994},
publisher={Addison-Wesley, Reading, Massachusetts}
}
@book{goossens1997latex,
title={The LATEX graphics companion: illustrating documents with TEX and PostScript},
author={Goossens, Michel and Rahtz, Sebastian PQ and Mittelbach, Frank},
volume={3},
year={1997},
publisher={Addison-Wesley Professional}
}
I've tried several possibilities of \bibliography{ref.bib}
in the three files and none of them produced a desirable output, which would be as I expect: two bibliographies at all; one at the end of chapter 1 and one at the end of chapter 2, with only lamport1994latex
in the first bibliography and only goossens1997latex
in the second bibliograhy. Is this possible?