As far as I understand the subfiles for use in the subfiles package should all end with \end{document}, so that they can be built independently. However, I'm finding that, in order for each of my subfiles to be included in the output of my main.tex file, I need to delete the \end{document} line. I'm using TeXstudio.
My main file looks like this:
\documentclass{book}
\usepackage{expl3}
\usepackage{subfiles}
\begin{document}
\subfile{title}
\subfile{introduction}
\end{document}
If the subfiles look like this:
\documentclass[main]{subfiles}
\begin{document}
title content OR introduction content
\end{document}
then I get only the content of the first subfile (title.tex) in main.pdf, even if the content is as simple as just the word 'content'. If they look like this instead:
\documentclass[main]{subfiles}
\begin{document}
content
then I get the content of both.
subfilespackage (v2.2) with an old LaTeX (older than Oct 2020), or the other way around. You find the version numbers in the log file. I see therepreloaded format=pdflatex 2021.4.16andsubfiles 2020/11/14 v2.2. – gernot Jul 13 '21 at 15:48