1

I am writing my thesis using overleaf and jabref as the reference manager. I am also using LuaLatex for compiling. Right now I have separate bib file for each chapter and I am trying to get references at the end of each chapter. There are multiple references which are used in (may be) every chapter. Here is my minimized preamble

\documentclass[12pt,a4paper]{report}
\usepackage{lipsum}
\usepackage[numbers,sort&compress]{natbib}
\usepackage[sectionbib]{chapterbib}
\input{chapter01}
\input{chapter02}

and then for my chapters;

\chapter{Introduction}
\input{Introduction}

\bibliographystyle{apalike}
\bibliography{chapter01}

and

\chapter{Theory}
\input{Theory}

\bibliographystyle{apalike}
\bibliography{chapter02}

The problem is for the first chapter, it works perfectly. All the references are cited and they appear at the end of the chapter. However, for the second chapter only some of them are cited and others just look like "?"s. And the reference list is not even the relevant references. There are multiple duplicate questions asked on this topic, I tried almost all of them, none of them seem to work. If anybody has an idea how to fix this it would be greatly appreciated

1
  • Welcome to TeX.SE!
    – Mensch
    Oct 29, 2021 at 22:33

1 Answer 1

1

Make 2 chapter files: chap1.tex and chap2.tex, and 2 bib files: bib1.bib and bib2.bib. Save these files in your project folder on Overleaf. Make the main file: TeXSE.tex Compile TeXSE.tex.

Chap1.tex file:

\section{First section of chapter 1}

This is Chapter 1 from the input file chap1.tex.
    
This is a citation for Acemoglu (2000) \cite{acemoglu2000} from bib1.
    
Acemoglu (2012) \citep{acemoglu2012} is a citation for the second reference. 
    
The Reference list for introductory chapter appears next. 
    
\bibliographystyle{apalike}
\bibliography{bib1}

Chap2.tex file:

\section{First section of chapter 2}

This is Chapter 2 from the input file chap2.tex. 

This is a citation for Acemoglu (2000) \cite{acemoglu2000} from bib2. 

Ackerberg (2006) \cite{ackerberg2006} is a citation for the second reference. 

The Reference list for the chapter appears next. 

\bibliographystyle{apalike}
\bibliography{bib2}

bib1.bib file:

@article{acemoglu2000,
    title={The colonial origins of comparative development: An empirical investigation},
    author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
    year={2000},
    institution={National bureau of economic research}
}
@book{acemoglu2012,
    title={Why nations fail: the origins of power, prosperity and poverty},
    author={Acemoglu, Daron and Robinson, James A and Woren, Dan},
    volume={4},
    year={2012},
    publisher={SciELO Chile}
}

bib2.bib file:

@article{acemoglu2000,
    title={The colonial origins of comparative development: An empirical investigation},
    author={Acemoglu, Daron and Johnson, Simon and Robinson, James A},
    year={2000},
    institution={National bureau of economic research}
}
@article{ackerberg2006,
    title={Structural identification of production functions},
    author={Ackerberg, Daniel and Caves, Kevin and Frazer, Garth},
    year={2006}
}

Make the main document file, TeXSE.tex:

\documentclass[12pt,a4paper]{report}   
                                          
\usepackage[numbers,sort&compress,sectionbib]{natbib}          
\usepackage{chapterbib}                                        

\begin{document}

\chapter{First chapter}
\include{Chap1}

\chapter{Second chapter}
\include{Chap2}

\end{document}

Upload each of these files to your project folder on Overleaf.

Compile TeXSE.tex gives (the chapter titles are omitted):

enter image description here

enter image description here

This is the same approach as described here: Different bibliographies for each chapter with shared references except that using filecontents to save the files does not create the example files on Overleaf. Here, I just avoided that by making 5 separate files. Welcome to TeX.SE.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .