2

I am trying to separate a document into components then only include whole components, however one of the components contains an include tag for a tikz diagram and I am receiving: LaTeX Error: \include cannot be nested.

Is there any way that I can simply include the Tikz figure within that component, that will allow it to be included in the main document as is?

This is the set up:

a.tex (diagram)

\begin{tikzpicture}
...
\end{tikzpicture}

component.tex

\begin{center}
    \include{diagrams/a}
\end{center}

main.tex

\section{"component"}
\include{components/component}
  • Use \input rather than \include. \include is intended for e.g. complete chapters and cannot be nested. \input can be nested and can be used in \included files. – cfr Sep 30 '16 at 11:31
  • @cfr perfect, thank you! Would you mind writing that out as the answer so that I can close this question? – Warosaurus Sep 30 '16 at 11:34
  • It is actually a duplicate, so I've marked it appropriately ;). – cfr Sep 30 '16 at 11:34

Browse other questions tagged or ask your own question.