From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/19120 Path: news.gmane.org!not-for-mail From: Taco Hoekwater Newsgroups: gmane.comp.tex.context Subject: Re: special macro problem again... Date: Thu, 17 Mar 2005 20:13:03 +0100 Message-ID: <4239D6BF.8060706@elvenkind.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1111086769 4242 80.91.229.2 (17 Mar 2005 19:12:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 17 Mar 2005 19:12:49 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 17 20:12:49 2005 Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1DC0Q0-0007rN-Ak for gctc-ntg-context-518@m.gmane.org; Thu, 17 Mar 2005 20:12:28 +0100 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5496412914; Thu, 17 Mar 2005 20:14:00 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10581-06-3; Thu, 17 Mar 2005 20:13:55 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DC25D127C2; Thu, 17 Mar 2005 20:13:55 +0100 (CET) Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DC0B4127C2 for ; Thu, 17 Mar 2005 20:13:54 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (ronja.vet.uu.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10581-06-2 for ; Thu, 17 Mar 2005 20:13:54 +0100 (CET) Original-Received: from post-23.mail.nl.demon.net (post-23.mail.nl.demon.net [194.159.73.193]) by ronja.ntg.nl (Postfix) with ESMTP id 1F1291278E for ; Thu, 17 Mar 2005 20:13:54 +0100 (CET) Original-Received: from boo.demon.nl ([82.161.175.147]:37521 helo=[192.168.1.3]) by post-23.mail.nl.demon.net with esmtp (Exim 4.43) id 1DC0RN-000NdU-Vm for ntg-context@ntg.nl; Thu, 17 Mar 2005 19:13:54 +0000 User-Agent: Mozilla Thunderbird 1.0 (X11/20050215) X-Accept-Language: en-us, en Original-To: ConTeXt list In-Reply-To: X-Virus-Scanned: by amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 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 X-Virus-Scanned: by amavisd-new at ntg.nl X-MailScanner-From: ntg-context-bounces@ntg.nl X-MailScanner-To: gctc-ntg-context-518@m.gmane.org Xref: news.gmane.org gmane.comp.tex.context:19120 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:19120 Peter M=FCnster wrote: > It's a repost. > Does anybody have an idea to solve this problem? > If not, I'm going to buy the TeXbook... This particular problem can be solved thus: \unexpanded\def\MyNumber#1#2#3{% \doifmode{aaa}{#1}\doifmode{bbb}{#2}\doifmode{ccc}{#3}} There are some other syntactical possibilities, but the general algorithm is always the same: making sure that the \expanded within \MyMacro doesn't expand \doifmode, since \doifmode breaks under pressure like that. You were not expected to know about that (because this is undocumented), so you do not have to feel badly about not owning a copy of the TeXbook. :-) However, the TeXbook does explain the basic underlying problem, and since the LaTeX Companion is not very helpful to ConTeXt users , it is absolutely *the* book to buy. Greetings, Taco > I try to expose the problem a bit clearer: >=20 > \newcount\MyVersion > \def\MyMacro#1{% This macro is somewhere in an environment file. > \getgparameters[XXX][#1] > \global\advance\MyVersion by 1 > \bTR \expanded{\bTD \the\MyVersion \eTD} \expanded{\bTD \XXXNumber \e= TD}\eTR > } >=20 > \def\MyNumber#1#2#3{% This macro is a special one for the document. > \doifmode{aaa}{#1}\doifmode{bbb}{#2}\doifmode{ccc}{#3}} >=20 > \enablemode[bbb] >=20 > \starttext > \bTABLE > \bTR \bTD Version \eTD \bTD Number \eTD \eTR > \MyMacro{Number=3D123} > \MyMacro{Number=3D\MyNumber{111}{222}{333}} % error: Incomplete \iffals= e > \MyMacro{Number=3D456} > \eTABLE > \stoptext >=20 > Greetings, Peter >=20