From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/23023 Path: news.gmane.org!not-for-mail From: Peter Rolf Newsgroups: gmane.comp.tex.context Subject: Re: def with if..else fails in TABLE Date: Tue, 18 Oct 2005 12:18:24 +0200 Message-ID: <4354CBF0.1090101@gmx.net> References: <5F09E8CF-F566-4ED8-AA97-F27017EF7969@fiee.net> <4354B10D.6000700@gmx.net> <4288D93B-C643-4B9E-AD62-D49EAEF10A22@fiee.net> 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 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1129630707 9783 80.91.229.2 (18 Oct 2005 10:18:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Oct 2005 10:18:27 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Tue Oct 18 12:18:20 2005 Return-path: 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 1ERoWx-0006LJ-Ou for gctc-ntg-context-518@m.gmane.org; Tue, 18 Oct 2005 12:17:15 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CCAAB127FB; Tue, 18 Oct 2005 12:17:14 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14664-04; Tue, 18 Oct 2005 12:17:12 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CF3EB127EE; Tue, 18 Oct 2005 12:17:11 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 923E5127EE for ; Tue, 18 Oct 2005 12:17:10 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14774-05-2 for ; Tue, 18 Oct 2005 12:17:09 +0200 (CEST) Original-Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by ronja.ntg.nl (Postfix) with SMTP id 983CF127C1 for ; Tue, 18 Oct 2005 12:17:09 +0200 (CEST) Original-Received: (qmail invoked by alias); 18 Oct 2005 10:17:09 -0000 Original-Received: from i5387FC92.versanet.de (EHLO [192.168.0.3]) [83.135.252.146] by mail.gmx.net (mp021) with SMTP; 18 Oct 2005 12:17:09 +0200 X-Authenticated: #24293357 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <4288D93B-C643-4B9E-AD62-D49EAEF10A22@fiee.net> X-Enigmail-Version: 0.93.0.0 X-Y-GMX-Trusted: 0 X-Virus-Scanned: 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-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on smtp.ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:23023 Archived-At: Henning Hraban Ramm wrote: > Am 2005-10-18 um 10:23 schrieb Peter Rolf: >=20 >>> I tried to write a macro for a TABLE line: >>> >>> \def\TestCmd{\dodoubleempty\doTestCmd} >>> \def\doTestCmd[#1][#2]#3{\bTR\bTD #3 >>> \iffirstargument\hfill (#1)\fi >>> \eTD \bTD >>> \ifsecondargument >>> 3: #2 and #3 >>> \else >>> 2: only #3 >>> \fi >>> \eTD\eTR >>> } >>> >>> But it never goes into "else" (if #2 is empty, I get "3: and #3")! >>> And it's only with the table commands around. >>> Why? What can I do? >>> >> the numbering is not bound to the parameter number; it's just a count= er. >> calling the macro with two arguments -> >> \iffirstargument is true >> \ifsecondargument is true >> \ifthirdargument is false >=20 >=20 sorry, my fault. you are right :) the numbers are bound to the parameter. and \ifthirdargument is always true (not an optional parameter). ----- \def\TestCmd{\dodoubleempty\doTestCmd} \def\doTestCmd[#1][#2]#3{% \ifsecondargument \iffirstargument 3(#1/#2/#3) \else 2a(#1.#2.#3) \fi \else \iffirstargument 2b(#1/#2/#3) \else 1(#1/#2/#3) \fi \fi } \starttext \TestCmd{C} \TestCmd[A]{C} \TestCmd[][B]{C} \TestCmd[A][B]{C} \stoptext ----- this gives 1(//C) 2b(A//C) 3(/B/C) 3(A/B/C) thanks for the lesson ;) Peter > But why *does it work* without the TABLE commands?? ??? maybe an expansion problem. have you tried \expanded{\TestCmd...} > If it would be true (or at least the reason for my problem) what you=20 > wrote, the following should work: >=20 > \def\TestCmd{\dodoubleempty\doTestCmd} > \def\doTestCmd[#1][#2]#3{\bTR\bTD #3 > \ifsecondargument > \iffirstargument\hfill (#1)\fi > \eTD \bTD > 3(#1.#2.#3) > \else > \iffirstargument\hfill (#1)\fi > \eTD \bTD > 2(#1/#2/#3) > \fi > \eTD\eTR > } >=20 > But there I get only a > ! Incomplete \iftrue; all text was ignored after line 63. > > \fi >=20 >=20 >=20 > Gr=FC=DFlis vom Hraban! > --- > http://www.fiee.net/texnique/ > http://contextgarden.net > http://www.cacert.org (I'm an assurer) >=20 > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context >=20 >=20