[Tex/LaTex] Preamble not found in subfile when using \input{Preamble.tex} in main file

inputpreamblesubfiles

When using the following for my main TeX file Graduation_report.tex, in the main folder:

\documentclass[11pt,a4paper]{report}

\input{Preamble.tex}

\begin{document}

\subfile{Introduction/Introduction.tex}

\end{document}

and the following for my subfile Introduction.tex (which is in the folder Introduction)

\documentclass[../Graduation_report.tex]{subfiles}

\begin{document}

...

\end{document}

I get the error 'Preamble.tex not found'. However, when I just paste my Preamble in the main file (Graduation_report.tex), instead of using \input, it works. Is there a solution to input my preamble in the main file? So that I can create my preamble in a separate TeX file and still run my subfiles separately with the same preamble.

Best Answer

Solved it by defining the input path for the preamble in my main file.

\documentclass[11pt,a4paper]{report}

% Define path Preamble
\makeatletter 
\def\input@path{{../}} 
\makeatother
\input{Preamble.tex}

\begin{document}

\tableofcontents
\subfile{Introduction/Introduction.tex}

\end{document}
Related Question