I am currently using LyX for my mathematical typesetting, and I really like the macro functionality. However, I can imagine that the source code from such an output must be a pain for others to look at.
I am curious to know if there is a way of "flattening" any LaTeX output that arises from macros? Consider the following minimal example (with the preamble and document begin/end declarations removed):
\global\long\def\testMacroA#1{{\color{red}#1}}%
\global\long\def\testMacroB#1{\tilde{#1}}%
\global\long\def\testMacroC#1{\underrightarrow{#1}}%
$\testMacroA{\testMacroB{\testMacroC A}}$
Is there anything in LaTeX that can be used to remove any trace of the original macros and replace any instances of them with the code that they represent, so that when the source code is compiled, it simply gives
${\color{red}\tilde{\underrightarrow{A}}}$ ?