I have a pretty simple problem but have been unable to look for a simple answer. It's about macro expansion.
Let's say I define 4 symbols:
\documentclass{minimal}
\newcommand* \A {1}
\newcommand* \B {2}
\newcommand* \C {\A + \B}
\newcommand* \D {\C + 1}
\begin{document}
A = \A, B = \B, C = \C, D = \D
\end{document}
The print out is A = 1, B = 2, C = 1+ 2, D = 1+ 2+ 1
. Is there are way to expand the macros so that A = 1, B = 2, C = 3, D = 4
? I know there is the \expandafter
macro but its syntax is brutal. I would like to remain within the simplicity of Latex if possible.
$2+2=4$
, after all.calc
.