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 _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context