On Mon, 15 Mar 2010, Mehdi Omidali wrote:
> On 3/15/2010 2:21 AM, Aditya Mahajan wrote:
>> On Mon, 15 Mar 2010, Mehdi Omidali wrote:
>>
>>
>>> Hi,
>>> Finally, after reading source code of math-ali.mkiv, I found the best way
>>> to
>>> typeset my multiline equation as follows
>>>
>>> \starttext
>>> \placeformula
>>>
>>> \startformula
>>>
>>> \startalign[n=3]
>>>
>> This means that you must have three "columns" in each line
>>
>>
>>
>>> \NC x^2 + y^2 \NC = z^2 \NC \NR[eq:1]
>>>
>>> \NC\NC = w^2 \NC + u^2\NC \text{(by \in{Equation}[eq:2])} \cr
>>>
>> This has 4 columns. You do not get an error message because you use \cr
>> instead of \NR. That also messes up the alignment of the next equation.
>>
>>> but I don't know what is going on here. Exactly, eq:2 and eq:3 has the
>>> same
>>> output but they can not be interchanged. Can someone explain this code?
>>>
>> This is how I would do this.
>>
>> \placeformula \startformula \startalign[n=3]
>> \NC x^2 + y^2 \NC = z^2 \NC
>> \NR[eq:1]
>> \NC \NC = w^2 + u^2 \NC \text{(by \in{Equation}[eq:2])} \NR
>> \NC \NC \quad + v^2 + r^2 \NC
>> \NR[eq:2]
>> \NC \NC \quad + v^2 + r^2 \NC
>> \NR[eq:3]
>> \NC \NC = v^2 + r^2 \NC
>> \NR[eq:4]
>> \stopalign \stopformula
>>
>> Aditya
>>
> Thanks, but your output is not the same as mine. The comment "by Equation 2"
> must be right aligned exactly where formula number is.
ConTeXt does not support that directly, but you can fake it.
\def\NRtag{&\global\let\doalignNC\dodoalignNC\doalignNRtag}%
\def\doalignNRtag[#1]%
{#1\crcr}
\starttext
\placeformula
\startformula
\startalign[n=3]
\NC x^2 + y^2 \NC = z^2 \NC \NR[eq:1]
\NC \NC = w^2 \NC + u^2 \NRtag[\text{(by \in{Equation}[eq:2])}]
\NC \NC \NC + v^2 + r^2 \NR[eq:2]
\NC \NC \NC + v^2 + r^2 \NR[eq:3]
\NC \NC = v^2 \NC + r^2 \NR[eq:4]
\stopalign
\stopformula
\stoptext
> Also I don't like
> manual alignment like \quad. AMS-TEX provide commands for automatic
> alignment. It would be nice if context supports that too.
ConTeXt does support that (see above); but aligning at the + sign makes
sense only for specific types of equations. In general, using \quad is
considered good typography. (Imagine what would happen if the first term
in one of the equations was very big).
Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________