Based on my previous questions, I now have the following code (snippet):
\usepackage{currfile}
\usepackage{filehook}
\usepackage{environ}
\usepackage{amsmath}
\def\Introduction{Introduction}
\NewEnviron{introduction}{%
\expandafter\long\expandafter\xdef\csname \currfilebase \Introduction \endcsname{\expandafter\unexpanded\expandafter{\BODY}}%
}%
\AtEndOfIncludeFile{Fourier}{%
\section{\currfilebase}%
\subsection{Introduction}%
\csname \currfilebase \Introduction \endcsname%
}%
And then I use \include{Fourier} and this works. But how do I make this work for more than one file without copy-pasting the \AtEndOfIncludeFile part? If I do this for all files I get quite strange behavior, so I would like to add the files manually. Preferably only in one spot, but you can't have it all :-).
That is, I want to include more files, like \include{Pie} without having to use
\AtEndOfIncludeFile{Pie}{%
\section{\currfilebase}%
\subsection{Introduction}%
\csname \currfilebase \Introduction \endcsname%
}%
which would be just verbatim copying...
Edit: I have an idea. Perhaps I can put all my includes in a folder Includes and then use something like How to iterate through the name of files in a folder. To include all files from that folder (there is no harm in doing that as they only provide content in environments which I print using my main file). The only problem is: the order. How do I set the order in that case?
\includeonce such that I do not have to type the file I have to include twice. The second method is also a good idea. I will see which one is the best. – JT_NL Jul 16 '12 at 08:17