Am 25.06.10 15:39, schrieb Aditya Mahajan:
On Fri, 25 Jun 2010, Vyatcheslav Yatskovsky wrote:
Hi,
Now I check for an undefined constant like this:
\ifx \Homeworks \undefined \else Home works -- {\Homeworks} \fi
The useful part is in "else" clause. How to swap this check so that "else" is not needed?
From syst-gen.mkii
%D \macros %D {doifundefined,doifdefined, %D doifundefinedelse,doifdefinedelse, %D doifalldefinedelse} %D %D The standard way of testing if a macro is defined is %D comparing its meaning with another undefined one, usually %D \type{\undefined}. To garantee correct working of the next %D set of macros, \type{\undefined} may never be defined! %D %D \starttyping %D \doifundefined {string} {...} %D \doifdefined {string} {...} %D \doifundefinedelse {string} {then ...} {else ...} %D \doifdefinedelse {string} {then ...} {else ...} %D \doifalldefinedelse {commalist} {then ...} {else ...} %D \stoptyping %D
So
\doifdefined{Homeworks}{...}
Low level (etex) solutions: \ifdefined\Homeworks ... \fi \unless\ifx\Homeworks\undefined ... \fi Wolfgang