0

I am trying to include two tex files at the end of my report. The first file is included as usual but anything I write after that does not appear.

This is my code:

\section{Code for Question 1}
\include{Q1.tex}

\section{Code for Question 2}

\include{Q2.tex}

Even the title for the section does not appear. Any ideas? I used \input aswell but the problem was exactly the same.

Thanks!

David Carlisle
  • 757,742
  • 4
    Perhaps your Q1.tex included an \end{document}. – Peter Wilson Feb 02 '22 at 18:31
  • unrelated but you should better use \input, \include would force a new page. – Ulrike Fischer Feb 02 '22 at 18:46
  • as Ulrike says Q1.tex most likely has \end{document} (or \stop) also do not use \include after a section heading. – David Carlisle Feb 02 '22 at 19:00
  • Yes, it seems like the \end{document} is the problem. How do I solve this? if I exclude it from the Q1.tex document it means that I have to also remove the begin{document} command which results in my main tex file not compiling. Any ideas? thanks! – Kyriacos Xanthos Feb 03 '22 at 12:23
  • 2
    Only the main file should have \begin{document} and \end{document}. The included files should basically be copies of what you would have written in your main file instead of including them. It would have helped if you had given an MWE of your main file and Q1.tex. – Peter Wilson Feb 03 '22 at 18:25

0 Answers0