# Should I still define a main file as master document when using the subfiles package?

This is pretty much very straightforward and probably a really naive question, but I need to know:

I'm using the `subfiles` package to manage my project files and I have all the paths set so every file compiles correctly. However, I noticed I still have my main document defined as master. If I undefine* it as master and try to compile any of the subordinate files, I get lots of errors regarding references, bibliography, graphics, etc., depending on what I'm using in the current file.

My understanding is that subordinate files should compile on their own without problems but I might be misunderstanding the whole thing. So, should I have a master file if I'm using subfiles? If this is not the case, then the errors I'm getting are very likely due to wrongly set paths, for which a nightmare of trial and error awaits me in order to solve the problems.

I don't feel this needs a MWE but I will gladly include one if necessary.

* Edit for clarification: I'm using TexMaker and one of the options allows to define the main tex file as a master document, which builds the file structure with all the `\include` or `\input` files. This is done so the quick compiling can be done while any of the files is open (thus not having to switch from file to main to file, etc., every time one needs to quick compile).

From the subfiles docs:

If the subfile is typeset by itself, it takes as preamble the one of the main file (including its `\documentclass`). The rest is typeset normally.

It depends what you mean by "undefine" (and I don't have enough rep to ask in a comment for you to clarify), but I read it as one of two things:

1. You removed `\documentclass[master.tex]{subfiles}` from the subfile
2. You renamed the master.tex document without changing the `\documentclass` parameter in the subfile

In either case, as per the quote above, this means that the preamble from the master document isn't included in the subfile (by the `subfiles` package) when you compile the subfile on it's own. Therefore all the basic package imports you mention (references, bibliography, graphics) aren't included in the file and thus the file won't compile on it's own.

It would only do so if you re-hooked up the master document through the subfile's `\documentclass`, or included the `\usepackage` commands needed in the preamble of the subfile itself.

• Thanks for your answer, Harry. I have edited my question to clarify on the "undefining the master document" part. I followed the example on ShareLatex.com where they make use of `\includegrpahics`and the subfile succeeded to compile as a standalone file, printing the picture and all. I guess for bibliography or glossaries the logic is the same though I can't get it to work, so I think my problem is indeed bad paths. – absay Jul 11 '15 at 2:07