I'm using etoolbox
. How can I create a new command that returns a boolean value? For example if I create the following command:
\newcommand\ifkeyempty[1]{
\def\novalue{\pgfkeysnovalue}%
\def\empty{}%
\pgfkeysgetvalue{#1}{\value}%
\ifboolexpr{test {\ifdefequal{\value}{\empty}} or test {\ifdefequal{\value}{\novalue}}}{true}{false}%
}
I would like to be able to use it in a boolean expression like this:
\ifboolexpr{test {\ifkeyempty{/keyname}} or ... }{expression is true}{expression is false}
Is this possible?
Best Answer
Wow! It was actually easy! I just removed the clauses that should be performed if the expression is true or false in the definition of the command. It now works both in tests like
\ifboolexpr
and by using it directly like\ifkeyempty{<key>}{<true>}{<false>}
.