In this answer, egreg uses
\NewDocumentCommand{\refprefix}{m}{%
\ifinproofref\else #1\fi
}
The command \refprefix
is part of code that's written to the aux file. Defining the command with
\newcommand{\refprefix}[1]{%
\ifinproofref\else #1\fi
}
does not work, apparently, because \refprefix
is already expanded on writing the aux file.
Why is that so, and which other definition-like commands behave in what way in this context?