In my main.tex I am requesting my preamble to be loaded through the command \usepackage{preamble}, which is in the same folder as my main.tex. My subfiles are located one folder below, e.g. MAIN/introduction/introduction.tex.
I would like to compile my subfiles as individual documents as well, but I get the error preamble.sty not found, which I presume is because I do not have a preamble.tex file located in my subfile folders, only in the main folder.
Is there a possible way around this? For example, would I be able to specify two paths for my preamble, e.g. \usepackage{preamble} when I am compiling my main document and \usepackage{../preamble} when I am compiling my subfile?
Thanks for the help.
EDIT:
My preamble is in .sty format, and I load it in my main.tex with \usepackage{preamble}. I am unable to write the same thing in my subfile document because AFAIK the layout of a subfile has to only have \documentclass[main.tex]{subfiles}. Otherwise, I would also write \usepackage{../preamble} in my subfile document.
My folder structure is as follows:
main_folder/
preamble.sty
main.tex
introduction_folder/
introduction.tex
When I compile main.tex with \usepackage{preamble}, it works just fine. When I compile introduction.tex, I get the error that preamble.sty not found, even if I add \usepackage{../preamble}. I am using the subfiles package to create my subfiles.
\usepackage{preable}tells LaTeX to install a package (typically with extension.sty) named preamble... and so far as I know there is no such package by that name. If you want to includepreamble.tex, just use\input{preamble.tex}instead-- if it is in the main folder with yourmain.tex, I think it should connect properly. – Partha D. Feb 11 '19 at 04:39\input{../preamble.tex}there. – Partha D. Feb 11 '19 at 04:48\usepackage. I have tried writing\usepackage{../preamble}in my subfile document to tell it to locate the preamble one folder above, but I am thrown an error. I suspect it's becausesubfilesis strict on the subfiles' layout (i.e. only\documentclass[main.tex]{subfiles}) is permitted. – elihpoivulp Feb 11 '19 at 07:15