From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/59855 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: checking for an undefined constant Date: Fri, 25 Jun 2010 20:16:44 +0200 Message-ID: <4C24F28C.50802@googlemail.com> References: <4C24A9DA.2080608@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1277489824 18953 80.91.229.12 (25 Jun 2010 18:17:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Jun 2010 18:17:04 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Jun 25 20:17:02 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OSDSR-0006Q9-9a for gctc-ntg-context-518@m.gmane.org; Fri, 25 Jun 2010 20:16:55 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7CE99C9AFD; Fri, 25 Jun 2010 20:16:54 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id RIvtQazag8dT; Fri, 25 Jun 2010 20:16:51 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9D43BC9AE3; Fri, 25 Jun 2010 20:16:51 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AE586C9AE3 for ; Fri, 25 Jun 2010 20:16:50 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jbL9DlxO3CJu for ; Fri, 25 Jun 2010 20:16:48 +0200 (CEST) Original-Received: from mail-wy0-f169.google.com (mail-wy0-f169.google.com [74.125.82.169]) by balder.ntg.nl (Postfix) with ESMTP id 7F14DC9A70 for ; Fri, 25 Jun 2010 20:16:48 +0200 (CEST) Original-Received: by wyb39 with SMTP id 39so1926948wyb.14 for ; Fri, 25 Jun 2010 11:16:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=FHLE+lsB408wZlJIWlFNUdI5HZF4BYU0J+oH+B2nLUg=; b=HkWGTH7afj+bhVQcyODwSJCVjA1ggyIQFG9wqPyHFmLhh5APXMWBE5xYE/0TT7enH4 G4mrJev5sb9XXH9iIhxVbf9OV9R0BQ+s71Uep2OtsksemWLvdjSR81DR0bYrM0tle/nu 1qr5NJnjl2PfOn6dNb2wyA8BXA5ps046s1oRE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=kbnbNRjymh4iSOxEjhAsBvqSJNNeXUIs2Tbw9JxQTXuWkHSQBFBV8MmS8gC5wGRZtY lS3bcsWAtQvqrJ6ppschlp9DU3b2TDX2Vw2qD2K393aErFoFChTYF13KbrSiaOVbdt+6 aGqgE7TLj8cFZsWVkdyP2oQ0LCIpqjyGfPkyk= Original-Received: by 10.227.143.149 with SMTP id v21mr917917wbu.125.1277489807921; Fri, 25 Jun 2010 11:16:47 -0700 (PDT) Original-Received: from rover.fritz.box (dslb-188-099-080-054.pools.arcor-ip.net [188.99.80.54]) by mx.google.com with ESMTPS id t15sm41887097wbc.17.2010.06.25.11.16.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Jun 2010 11:16:46 -0700 (PDT) User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:59855 Archived-At: 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 ___________________________________________________________________________________