I am writing my PhD thesis, which is split into multiple chapter subfiles with a masterfile that combines them all for convenience of editing.
I have attempted to implement citations in the subfiles so I can see my references when I am editing my subfiles by defining the command \biblio in the masterfile for use in the subfiles as follows:
\providecommand{\main}{.}
\documentclass[12pt]{report}
\usepackage[numbers]{natbib}
\usepackage{subfiles}
\def\biblio{\bibliographystyle{ieeetran}\bibliography{\main/references}} % *Modification: added `\main/` to specify relative file location.
\begin{document}
\def\biblio{}
\chapter{Chapter 1}
\subfile{ThesisSubfiles/Chapter 1}
\chapter{Chapter 2}
\subfile{ThesisSubfiles/Chapter 2}
\chapter{Chapter 3}
\subfile{ThesisSubfiles/Chapter 3}
\bibliographystyle{ieeetran}
\bibliography{references.bib}
\end{document}
With each chapter subfile calling \biblio as follows:
%!TeX root = Chapter 1.tex
\providecommand{\main}{..}
\documentclass[../ThesisMasterfile.tex]{subfiles}
\begin{document}
\section{Section 1}
Some text.
\section{Section 2}
Some text.
\biblio
\end{document}
This works fine on my laptop, but when I attempt to compile the same script on my desktop PC, any new citations (invoked using \cite{}) added to any subfile which I compile on its own just appear as question marks with the warning "Citation 'citation' on page x undefined". Even stranger is that if I compile it on my laptop to make it work and then recompile it on my desktop PC, the new references then show up. Both PCs use the same relative file paths (the files are all saved to a shared cloud storage), both are running Windows 10 and MikTex with TexStudio editor. The only differences is, the packages on the desktop PC have been updated more recently.
Does anyone have any idea what the problem is? Thanks in advance!