0

I'm using the following tags to generate a project:

\documentclass{book}
\begin{document}
\frontmatter
\include{fm}
\mainmatter
\include{ch01}
...
\include{ch10}
\backmatter
\bibliographystyle{...}
\bibliography{...}
\printindent
\end{document}

This was produced the output in a nice manner, but today I saw some post regarding \usepackage{subfiles}, and the usage is:

\documentclass{book}


 \usepackage{subfiles}
\begin{document}
\frontmatter
\subfile{fm}
\mainmatter
\subfile{ch01}
...
\subfile{ch10}
\backmatter
\bibliographystyle{...}
\bibliography{...}
\printindent
\end{document}

This also working fine, and this is allowed to treat each chapter as separate compilation, i.e., we able to use \documentclass...\end{document} in each file, but the first method doesn't allow to run each chapter as separate file.

Kindly suggest which one is opt to use, please

I'm not an expert in TeX, so can't able to take decision, please advise.

7
  • 2
    \include is the standard latex command. subfiles is OK but is quite an invasive change as it has to change a lot of file handling, so you may get package conflicts. I would use the standard system until you are used to that but feel free to experiment with alternatives Commented Apr 27, 2023 at 8:14
  • 2
    you can run separate files with \include by using \includeonly{ch10} this is good for quick editing when working on chapter 10. It formats a chapter10 not as a new document, which is better or worse depending on what you want Commented Apr 27, 2023 at 8:17
  • I'm the current maintainer of the subfiles package, and also suggest to avoid the subfiles package unless really needed, for the reason David gave. Personally, I usually use \input commands in the main file and comment/uncomment them as needed.
    – gernot
    Commented Apr 28, 2023 at 13:21
  • @gernot Much thanks for your honest comment, it helps me a lot
    – GowriSaro
    Commented May 2, 2023 at 5:39
  • 1
    @GowriSaro My comment is not suitable as a general answer. To me it seemed that you did not have a particular use case requiring the subfiles package, so the recommendation is not to use it (as it potentially may have side-effects). Your question is not so specific that there is a clear-cut answer for other users as well. I know that there are quite some people out there who like to use subfiles.
    – gernot
    Commented May 7, 2023 at 11:24

0

You must log in to answer this question.

Browse other questions tagged .