Closed alan-isaac closed 4 years ago
This is something subfiles
always did, nothing has changed. When the subfile is included, only the three commands \documentclass[...]{...}
, \begin{document}
and \end{document}
are redefined to do nothing, everything else is typeset, including the stuff after \end{document}
. See also section 3.4 of the documentation.
Is there a use case where the stuff after \end{document}
should be skipped (given that one can just end the file after \end{document}
? Right now some people use this behavior for adding stuff that is only visible when typesetting the main file. If there is the need for a different behavior of subfiles
, one might add an option ...
The behavior is implicit in the docs.
If LATEX is run on the main file, the subfile is loaded like with an\inputcommand, except that the three lines\documentclass[..]{subfiles},\begin{document}, and\end{document}are ignored.
Nevertheless, I did not expect it, and ended up with undesired material in the main file. So I suggest being even more explicit, adding after the above sentence:
(This means that content following the
\end{document}
of a subfile will be included when the main document is compiled.
Thanks for the input. I hope that the documentation of the next release will be clearer in this respect.
The default behaviour of subfiles
2.0 now is to ignore any stuff after \end{document}
. To obtain the old behaviour, one has to use the option v1
when loading the package.
In version 1.5, compiling the main document will include subfile content that follows the
end{document}
in the subfile.