From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/56574 Path: news.gmane.org!not-for-mail From: Otared Kavian Newsgroups: gmane.comp.tex.context Subject: Macro with variable number of arguments Date: Sun, 28 Feb 2010 09:54:14 +0100 Message-ID: <4C6F69ED-2E35-4260-B2FE-125D1EF31611@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1267347278 27965 80.91.229.12 (28 Feb 2010 08:54:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 28 Feb 2010 08:54:38 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Feb 28 09:54:34 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from [195.12.62.10] (helo=balder.ntg.nl) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nlev4-0007bT-LV for gctc-ntg-context-518@m.gmane.org; Sun, 28 Feb 2010 09:54:34 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 45819C9D13; Sun, 28 Feb 2010 09:54:33 +0100 (CET) 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 zVIyAsF5o-hg; Sun, 28 Feb 2010 09:54:30 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 87BA6C9CFA; Sun, 28 Feb 2010 09:54:30 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E0306C9CFA for ; Sun, 28 Feb 2010 09:54:29 +0100 (CET) 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 T6x3Hw4gOFTd for ; Sun, 28 Feb 2010 09:54:18 +0100 (CET) Original-Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com [74.125.82.41]) by balder.ntg.nl (Postfix) with ESMTP id 8DEB9C9CF7 for ; Sun, 28 Feb 2010 09:54:18 +0100 (CET) Original-Received: by wwb24 with SMTP id 24so759435wwb.14 for ; Sun, 28 Feb 2010 00:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:content-type :content-transfer-encoding:subject:date:message-id:to:mime-version :x-mailer; bh=kOH49FhamShmaNNEeuCL15iJEkP6qwWSa7uws4MbdV8=; b=aT/A1AEN45KrIZWr7b+2g7eiWobJ6j4MyajVNKJ7puT8PgsWN9bTd7UncJGJFGD7gq wCn40gsGbO3gcPZ3N0JIFYu3az1N8wgaYEbiSDEWdjXEVVu1FnVVJlLROgl8PJffpMGc lS+dr3DjXavNT/bA5vXwbyyAygCxuNAfzLbkA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; b=f+qSRYQQiSxt62TMxj0mlUX0FezQG7Tqq9JrzOaD2nXbIaAkgJ9IMCQjTrpUPjq1SS 3W2TFq0D74vT+My5Eth61pJYO+4d57WdwwQ25UVoQjU5OFMj/4j/HmhH6O4IHArqMaj/ dva8wOvalWachNNbFZGbZd3gq7b6NIfL/TrDY= Original-Received: by 10.216.161.196 with SMTP id w46mr142431wek.105.1267347258048; Sun, 28 Feb 2010 00:54:18 -0800 (PST) Original-Received: from [192.168.0.11] (mna75-3-82-66-231-76.fbx.proxad.net [82.66.231.76]) by mx.google.com with ESMTPS id 5sm3174902eyh.11.2010.02.28.00.54.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Feb 2010 00:54:17 -0800 (PST) X-Mailer: Apple Mail (2.1077) 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:56574 Archived-At: Hi all, I would like to write a macro which may have sometimes two, sometimes three= arguments. The first and the last one are always present, but not necessar= ily the middle one. The unsatisfactory solution I have now is something lik= e the example below: \define[2]\myMacroTwo{Name: #1\crlf Email: #2\crlf\thinrule\blank[small]} \define[3]\myMacroThree{Name: #1\crlf Address: #2 \crlf Email: #3\crlf\thin= rule\blank[small]} \starttext \myMacroTwo{Hans}{hans@hagen.context.nl} \myMacroThree{Wolfgang}{Paradise of TeX, 2010}{wolfgang@schuster.context.de} \stoptext I think that (or rather I am certain=85) in ConTeXt it is possible to defin= e a unique macro called \myMacro which automatically tests the number of ar= guments: if there are only two of them the commands in \myMacroTwo are exe= cuted, while if three arguments are present, the commands in \myMacroThree = are executed. Can anyone give a hint on this matter? = ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________