From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/33515 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Question about defining a math macro Date: Sat, 24 Feb 2007 03:55:30 -0500 (EST) Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1172307547 24175 80.91.229.12 (24 Feb 2007 08:59:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 24 Feb 2007 08:59:07 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Feb 24 09:58:59 2007 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1HKsk6-0005lR-1v for gctc-ntg-context-518@m.gmane.org; Sat, 24 Feb 2007 09:58:58 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id A03DB20173; Sat, 24 Feb 2007 09:55:53 +0100 (CET) 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 13585-03; Sat, 24 Feb 2007 09:55:52 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id F17AC2017C; Sat, 24 Feb 2007 09:52:37 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E7D0220176 for ; Sat, 24 Feb 2007 09:52:34 +0100 (CET) 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 13613-01-5 for ; Sat, 24 Feb 2007 09:52:30 +0100 (CET) Original-Received: from hellskitchen.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.82]) by ronja.ntg.nl (Postfix) with ESMTP id 3BFC320170 for ; Sat, 24 Feb 2007 09:52:29 +0100 (CET) Original-Received: FROM aditya.annarb01.mi.comcast.net (c-68-40-50-205.hsd1.mi.comcast.net [68.40.50.205]) BY hellskitchen.mr.itd.umich.edu ID 45DFFD83.EC2B8.1107 ; 24 Feb 2007 03:55:32 -0500 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 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: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:33515 Archived-At: Hi, Can I define a math macro, say \EXP that does the following: 1) \EXP{something} gives me, say E(something) 2) \EXP_a^b{something} gives my E_a^b(something) That is, I want to write a macro that will only be used in the math mode, that does something with its argument. But, I also want it to handle _ and ^ if they are present. The only method that I can think of is to check _ or ^ with \ifnextcharacter and go through all 5 cases (nothing, only _, only ^, _ followed by ^, ^ followed by _) but this seems very inefficient. Is there a better way? Aditya