From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: New math feature requests
Date: Thu, 24 Aug 2006 21:34:12 -0400 (EDT) [thread overview]
Message-ID: <Pine.WNT.4.63.0608242116030.3448@nqvgln> (raw)
In-Reply-To: <Pine.WNT.4.63.0608080147040.3232@nqvgln>
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
next prev parent reply other threads:[~2006-08-25 1:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-08 5:49 Aditya Mahajan
2006-08-08 5:59 ` Aditya Mahajan
2006-08-08 8:14 ` Hans Hagen
2006-08-08 14:20 ` Taco Hoekwater
2006-08-08 15:38 ` Aditya Mahajan
2006-08-25 1:34 ` Aditya Mahajan [this message]
2006-08-25 5:15 ` Aditya Mahajan
2006-08-26 16:37 ` Aditya Mahajan
2006-08-28 15:12 ` Wolfgang Schuster
2006-08-28 15:21 ` Hans Hagen
2006-08-28 17:10 ` Aditya Mahajan
2006-08-28 21:55 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.WNT.4.63.0608242116030.3448@nqvgln \
--to=adityam@umich.edu \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).