Sunday, 11 August 2013

Have subfiles declare sections to be included in different places of the document

Have subfiles declare sections to be included in different places of the
document

I'd like to have several Latex files, imported or included in a master
document.tex file, which declare different sections to be included in the
master file, like:
% in file a.tex
\begin{notes}
My notes from file A
\end{notes}
\begin{examples}
An example from file A
\end{examples}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% in file b.tex
\begin{notes}
My notes from file B
\end{notes}
\begin{examples}
An example from file B
\end{examples}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% in file document.tex
\section{Notes}
% input notes from a.tex and b.tex
\section{Examples}
% input examples from a.tex and b.tex
And have the following output:
Notes
My notes from file A
My notes from file B
Examples
An example from file A
An example from file B
I could have 4 separate files instead of 2 (a.notes.tex, a.examples.tex,
etc), but I'd like to keep everything related to a in a single file, if
possible. Do you know if there is a way to achieve this behaviour?

No comments:

Post a Comment