0

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.

  • Where exactly is Preamble.tex in relation to Graduation_report.tex? – daleif Jun 7 '17 at 14:43
  • 2
    Using subfiles with sub-directories isn't a good idea. You could extend environment variable TEXINPUTS or modify \input@path similar to package import. – Schweinebacke Jun 7 '17 at 14:48
  • daleif, my Preamble.tex is in the same folder as Graduation_report.tex – Bas Jun 7 '17 at 19:32
  • Yes, but ./Introduction/Introduction.tex is not. Subfiles package causes ./Introduction/Introduction.tex to be compiled with ./Graduation_report.tex preamble, therefore the complier searches \input{Preamble.tex} (you can omit .tex) inside the folder ./Introduction/. – Taekwondavide May 19 '18 at 17:28
2

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.