See the examples below:
\documentclass{article}
\begin{document}
\def\a{1}
\def\b{\def\a{2}}
\def\c{\b}
\c\a
\end{document}
In expansion stage, \def
, its parameter text and replacement text is not expanded. Then how can TeX processor know \c
, \a
is a macro in this stage?
And the tokens are expanded one by one, so I have
\c\a ==>
\b 1 ==>
\def\a{2} 1
but the output is 2
. It is the correct and normal output if I don't think about this things, but apparently I have misunderstanded something about the expansion stage and execution stage.