Closed muzimuzhi closed 6 years ago
The \ifx
test has to have exactly equivalent definitions. In particular, if you test with a \long
or \protected
macro it give the unexpected result:
\def\testa{}
\long\def\testb{}
\protected\def\testc{}
\ifx\testa\empty\TRUE\else\FALSE\fi
\ifx\testb\empty\TRUE\else\FALSE\fi
\ifx\testc\empty\TRUE\else\FALSE\fi
For the purposes of etoolbox
, it's the net outcome that's important: the result of using the macro is 'nothing'.
Thanks for your explanation.
Currently,
\etb@ifdefempty{control sequence}
uses\ifstrempty
internally (see etoolbox.sty#L275-L280). But in kernel of latex2e, the scheme\ifx{<control sequence>}\@empty ... \else ... \fi
is commonly used to test if a control sequence is empty.Are there any benefits the
etoolbox
way has?