3

In some of my projects, Overleaf would not compile the current file I had open (but rather the original file that was open), while in other projects it would always compile the current file. Any idea why this might occur?

1 Answer 1

4

Turns out that the issue was that I did not have the \documentclass command written at the top of the file (I had instead written this in a separate preamble.tex file and done \input{preamble}). If there is no \documentclass command in the file, then Overleaf will not compile it when you switch to that file!

4
  • How many document classes are there? The only one I have encountered is article. Commented Sep 29, 2020 at 19:40
  • @A-levelStudent Maybe take a look at tex.stackexchange.com/questions/782/….
    – Grayscale
    Commented Sep 30, 2020 at 0:21
  • Could you link a reference for your insight? I came here with a similar problem. In my project, I have one file preamble.tex and one file main.tex and other files containing the content. I use \input{preamble.tex} in main.tex. The command \documentclass occurs only in preamble.tex. However, the compiling process is successful if and only if I am not in preamble.tex. If I understand your answer correctly, then this is precisely opposite to the behaviour you encounter.
    – NerdOnTour
    Commented Aug 2 at 6:42
  • @NerdOnTour I don't think I have a reference. I think I just inferred this from trial and error. I could be wrong, or it could have changed more recently. I don't use this "preamble" approach on Overleaf much anymore. However, the behavior I am referring to involved having many files I wanted to compile (e.g. main.tex, notes.tex). If I was in notes.tex in the editor but main.tex was the default thing to be open, it would compile main.tex instead of notes.tex. So, I think our observations could still be consistent.
    – Grayscale
    Commented Aug 20 at 16:35

You must log in to answer this question.

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