10

I know it is not possible to nest one \include inside another, but what about \input? Is it possible to have something like:

\documentclass{article}

\begin{document}

\include{file1}

\end{document}

and then in file1.tex:

\section{samplesection}
\input{file2}

in file2.tex;

\section{samplesection2}
Hello
3
  • 3
    Did you try to do this?
    – Sigur
    Commented Apr 10, 2013 at 22:04
  • 1
    I did, and it worked, but I wanted to know if it was because of luck (or such a small example) and if I was going to have any problems in the future for using it this way Commented Apr 10, 2013 at 22:10
  • 1
    You can nest \input{macros} and You can't nest \include{files} files. See "When should I use \input vs. \include?" : Martin Scharrer Answer Commented Apr 10, 2013 at 22:16

1 Answer 1

12

Quoting Kopka and Daly, Guide to LaTeX, 4th edition (2004), p. 207:

\include commands may not be nested: They may only appear in the main processing file. However, an \input command may be given within a file that is \included.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .