Interchange variables in LaTeX (to be used with TikZ)
The easiest way is probably to replace \renewcommand{\signU}{\signS}
by \let\signU\signS
, etc. Then \signU
is assigned the current meaning of \signS
.
Your method does not work because \renewcommand
does not expand the definition text at the time of definition. Instead, it is expanded when the command is used.
Try using \let
instead of \renewcommand
:
\documentclass{article}
%
\newcommand{\signS}{$+$}%
\newcommand{\signT}{$-$}%
\newcommand{\signU}{}%
%
\begin{document}
old \textbackslash signS: \signS
\let\signU\signS
\let\signS\signT
\let\signT\signU
new \textbackslash signS: \signS
\end{document}