I have these lines




\input{commands} % global vars and fucntions



when I try to compile this with texmaker using MiKTeX Windows 10, I get the error that lines 3, 4 and 5 (the ones with \usepackage) should be in the preamble. Aren't they? These are the only errors in the project, my commands.tex is getting recognized just fine.

  • 1
    The preamble can terminate early, but you should get a message for that as well. BTW, I crash on your document class. Dec 26, 2019 at 15:28
  • 1
    it is very hard to debug a fragment of code that references files not shown, please edit the question to provide a test file (or files) that shows the problem. Dec 26, 2019 at 15:33
  • Sorry, I was hoping this was a fairly common error. I'll try to reduce the project to a minimum and if the error persists, I'll get back to you. Just FYI: the .tex is in a folder called Chapters, it's included in the main.tex which is in the root folder, using the package subfiles. Dec 26, 2019 at 15:52

1 Answer 1


If you want your file to compile, just remove the preamble from sub file and put it in the main.tex only (this preamble will be shared by all sub files of main).

If you want an explanation of why the error message is misleading, I can't help.

  • Thank you so much, I was hoping it would be a noob mistake like this. Dec 30, 2019 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.