I am getting a value by a command. Now I am temporarily changing a saved variable which changes the command output. After I finished some code I want to reset the stored value if the value before the temporare code was 1.
My example can be stripped down to:
\newcommand{\storedvalue}{1}
\newcommand{\getstoredvalue}{\storedvalue}
\newcommand{\resetstoredvalue}{Resetting}
Some text
\let\oldvalue\protect\getstoredvalue
\renewcommand{\storedvalue}{0}
Some text which needs the stored value to be changed
\ifnum\numexpr\oldvalue>0%
\resetstoredvalue{}%
\fi%
Of course the \getstoredvalue
and the \resetstoredvalue
are a lot more complicated.
I tried to use \protect
. This will return the correct value, not the command. But I get Missing number, treated as zero
in my if
-clause.
I think this is a rather easy question. But I did not find a solution by googling. Also this may be because I was looking for the wrong searching term.
I hope somebody can help me or post a website where I can find the solution myself.