##  Class files

The main document in ShareLaTeX is the file which LaTeX will be told to compile first. It is the main file of the project, which all other parts (classes, packages, chapters etc.) will be inputted into. By default in ShareLaTeX, the main document will be set to be the document in the project which begins with the \documentclass[...]{...} command. For this reason, if you have a separate file for your preamble, you must not include the \documentclass[...]{...} command in the preamble file, but rather at the start of the main document. If you do not do this, only the preamble will be compiled. To set the main document on a project, simply click into the left hand menu and go to Main document: See here to learn more about managing large projects in LaTeX