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.

4
  • Where exactly is Preamble.tex in relation to Graduation_report.tex?
    – daleif
    Jun 7, 2017 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. Jun 7, 2017 at 14:48
  • daleif, my Preamble.tex is in the same folder as Graduation_report.tex
    – Bas
    Jun 7, 2017 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/. May 19, 2018 at 17:28

1 Answer 1

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}
1
  • I didn't do that and it worked. It may be because I have \usepackage{subfiles} outside of Preamble.tex May 12, 2021 at 18:45

You must log in to answer this question.

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