From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/30492 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: New math feature requests Date: Thu, 24 Aug 2006 21:34:12 -0400 (EDT) Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1156469673 6804 80.91.229.2 (25 Aug 2006 01:34:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Aug 2006 01:34:33 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Fri Aug 25 03:34:31 2006 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 ciao.gmane.org with esmtp (Exim 4.43) id 1GGQac-0001Ix-7W for gctc-ntg-context-518@m.gmane.org; Fri, 25 Aug 2006 03:34:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id C7D491FF3B; Fri, 25 Aug 2006 03:34:28 +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 06652-01; Fri, 25 Aug 2006 03:34:22 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4E4FF1FF18; Fri, 25 Aug 2006 03:34:21 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id F2F3E1FF18 for ; Fri, 25 Aug 2006 03:34:16 +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 04479-05 for ; Fri, 25 Aug 2006 03:34:12 +0200 (CEST) Original-Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by ronja.ntg.nl (Postfix) with SMTP id 5592F1FF10 for ; Fri, 25 Aug 2006 03:34:11 +0200 (CEST) Original-Received: FROM aditya.annarb01.mi.comcast.net (c-68-40-50-205.hsd1.mi.comcast.net [68.40.50.205]) BY hackers.mr.itd.umich.edu ID 44EE538F.D6F2E.17479 ; 24 Aug 2006 21:34:09 -0400 Original-To: mailing list for ConTeXt users In-Reply-To: X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 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:30492 Archived-At: On Tue, 8 Aug 2006, Aditya Mahajan wrote: > 3. Formula tagging > > amsmath allows formulas to be tagged. I will explain amsmath's > behaviour and hope that Hans can come up with the context way of doing > such things. > > Occasionally, one wants to tag a formula, e.g. > > \placefomrula[a] \startformula > a x = b > \stopformula > > \placetaggedformula[b]{*} \startformula > x = \frac {b}{a} > \stopformula > > should come out as > > a x = b (1) > x = b/a (*) > > Notice that ( and ) correspond to left and right in setupformulas. It > should also be possible to place a tag without these brackets, so > > \placetaggedformulawithoutbrackets[c]{**} \startformula > b = ax > \stopformula > > should come out as > b = ax ** <--- no brackets here > > Maybe, instead of placetaggedformulawithout brackets, one can simply > have > > \placetaggedformula[c][left=,right=]{**} > > but in such cases it is easy to get confused with the reference and > options. I am not sure what is a good way to do this. > > It should also be possible to refer to these tagged formulas. So > \in{formula}[b] should give * and \in{formula}[c] should give **. > > The tag should be set in text mode, so that one can say > \placetagformula {Answer} and the Answer will come out in text mode. I got an idea of using conversion for formula tagging. For single line formulas, the idea is pretty simple. I define a dummyconversion which always maps to the tag and set the formula conversion to dummyconversion. Then, I save the formula number, let startformula, work as normal and refine stopformula to restore formula number. The internal macros take care of referencing. This is my first attempt %------------------------8<-------------------------- \def\placeformulatag% {\dosingleempty\doplaceformulatag} \def\doplaceformulatag[#1]#2% {\let\normalstopformula\stopformula \def\stopformula% {\normalstopformula \restorenumber[formula] \egroup \let\stopformula\normalstopformula} \bgroup \savenumber[formula] \def\dummyconversion##1{#2} \defineconversion[dummyconversion][\dummyconversion] \setupformulas[conversion=dummyconversion] \placeformula[#1]} \starttext \placeformulatag[tag]{test} \startformula E = mc^2 \stopformula See \in formula[tag] for a tagged formula \stoptext %----------------------------8<------------------------- This one places (test) with the brackets in place of the formula number. It is easy to get rid of the brackets by using \setupformulas[left=,right=]. However, I do not know what will be a good interface for this. In Latex, \tag{whatever} give (whatever) and \tag*{whatever} gives whatever without the brackets. But context does not use starred form of commands, and I do not want to introduce them here. One way is \placeformulatag[ref][left=,right=] {my tag} .... Is this fine? We can also have tagleft=... and tagright=... as part of setupformulas, or, if that is too confusion, have \setupformulatagging[left=...,right=...]. However, this idea does not work inside \startmathalignment as the conversion can not be changed inside a formula. \placeformula \startformula \startalign \NC a \NC = b \NR[+] \setupformulas[conversion=set 1] \NC c \NC = d \NR[+] \stopalign \stopformula Is there some better way to achieve the same effect inside a mathalignment? Aditya