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}
\C
or to expand it exactly once? Can we assume\C
is fully-expandable inside an\edef
?\C
is expandable. I should have specified it, sorry.