Code: Select all
\def\tmptmptmptmp{\lpxx}
\def\lpxx{\lpx}
\def\lpx{\tmptmptmptmp}
The code above does this: (1) define a macro
\tmptmptmptmp that expands to
\lpxx; (2) define another one,
\lpxx, that expands to
\lpx; (3) define
\lpx to expand to
\tmptmptmptmp, which of course expands to
\lpxx, which expands to
\lpx, which expands to
\tmptmptmptmp, which...I'm sensing an infinite loop here.
The command you probably want is
\let, not
\def.
\let is a TeX primitive that takes the current definition of the second macro and copies that definition to the first. If the second later changes, the first is still the same.
Compare the output of these:
Code: Select all
\def\macroa{world!}
\def\macrob{\macroa}
\def\macroa{Hello }
% versus
\def\macroc{world!}
\let\macrod\macroc
\def\macroc{Hello }
\noindent
\macroa\macrob\\
\macroc\macrod