I want to call some files in folders. So I have 3 files : 1. main.tex (in the root) 2. commands.tex (in ./chapters) 3. control1.tex (in ./chapters) These files contains below codes: main:
\documentclass{report}
\usepackage{subfiles}
\input{chapters/commands}
\begin{document}
\subfile{./chapters/control1.tex}
\end{document}
commands:
\usepackage{graphicx}
control1:
\documentclass[../main.tex]{subfiles}
\begin{document}
\chapter{Control }
\section{intro}
some text
\end{document}
When I run main.tex everything looks good and without error. But if I run control1.tex I got this error:
It should be mentioned that without commands it runs perfect. What should I do? My goal is to put commands line in separate file.

\include{filename}? That's what I placed in my university's thesis template to insert parts into the document. – Sean Roberson Aug 04 '16 at 18:19\inputshould work properly. Otherwise, you may want to try the solution given in this answer: http://tex.stackexchange.com/a/79060/74960 – MarcoG Aug 05 '16 at 05:46