I would like to have the following (it's a part of a large code block):
\def\C{foobar}
\def\A{}
\g@addto@macro\A{\B{\C}}
Now \show\A outputs \B{\C}
I would like to modify the 3rd line so that \show\A outputs \B{foobar}
I believe that some trick with \expandafter should help, but I'm not familiar with it. (Note: expl3 would surely help here, but I'd like to avoid it.)
Full MWE:
\documentclass{article}
\begin{document}
\makeatletter
\def\C{foobar}
\def\A{}
\g@addto@macro\A{\B{\C}}
\show\A
\makeatother
\end{document}
\Cor to expand it exactly once? Can we assume\Cis fully-expandable inside an\edef? – Joseph Wright♦ Aug 16 '12 at 7:50\Cis expandable. I should have specified it, sorry. – tohecz Aug 16 '12 at 7:56