# Can be used only in the preamble error - and yes, it's in the preamble

I have these lines

\documentclass[../main.tex]{subfiles}

\usepackage{float}
\usepackage[font=small,skip=2pt]{caption}
\usepackage{graphicx}

\graphicspath{{Images}{../Images/}}

\input{commands} % global vars and fucntions

\begin{document}


...

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.

• The preamble can terminate early, but you should get a message for that as well. BTW, I crash on your document class. Dec 26 '19 at 15:28
• 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 '19 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 '19 at 15:52