I have to gather, in a single source file, source files from several authors,
each of them with its own (many) \newcommand, \newtheorem, etc. I'd like to limit the scope of each of these customizations, in the spirit of Limit macro/newcommand scope to section. The egreg's nice solution with \onlysectioncommands{...,...,...} has in my case the drawback that these \newcommand, \newtheorem, etc. may each time be numerous.
Hence, if each customization set is put in an auxiliary file, say
⟨author⟩-customization.tex, I'm looking for a clever \cleancustomization
macro that lets me able to do something like:
...
%
\input{author1-customization}
\input{author1-source}
\cleancustomization{author1-customization}
%
\input{author2-customization}
\input{author2-source}
\cleancustomization{author2-customization}
%
\input{author3-customization}
\input{author3-source}
\cleancustomization{author3-customization}
%
...
In other words, \cleancustomization should be given a fixed list of
customization macros (\newcommand, \newtheorem, etc.), and then be able to parse the file given in argument and automatically \undefine all the commands, theorems, etc. defined inside this file.
Do you see a (LaTeX3) way for doing this?
\newcommand,\newtheoremetc... so that they add the macros names in a list similar to egreg's\sectioncommandslist, then\cleancustomizationwould process it. – TonioElGringo Jan 15 '15 at 08:55