From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: checking for an undefined constant
Date: Fri, 25 Jun 2010 20:16:44 +0200 [thread overview]
Message-ID: <4C24F28C.50802@googlemail.com> (raw)
In-Reply-To: <alpine.LNX.2.01.1006250937470.17627@ybpnyubfg.ybpnyqbznva>
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2010-06-25 18:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.2040.1277469608.4277.ntg-context@ntg.nl>
2010-06-25 12:42 ` two languages hyphenation Vyatcheslav Yatskovsky
2010-06-25 13:06 ` checking for an undefined constant Vyatcheslav Yatskovsky
2010-06-25 13:39 ` Aditya Mahajan
2010-06-25 18:16 ` Wolfgang Schuster [this message]
[not found] <mailman.2045.1277489811.4277.ntg-context@ntg.nl>
2010-06-25 21:36 ` Vyatcheslav Yatskovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C24F28C.50802@googlemail.com \
--to=schuster.wolfgang@googlemail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).