On Thu, 6 Apr 2006, WN wrote:
> [EMAIL PROTECTED] wrote:
>> On Wed, 5 Apr 2006, WN wrote:
>>> One thing I want to do with a set of subformula's is
>>> to reference the main formula but still subnumbering the equations
>>> like
>>
>> Try this. Warning: I do not know everything that is happening here. There
>> may be some unexpected side effects.
>>
>> \unprotect
>> \def\placesubformulawithnumber{%
>> \dodoubleempty\doplacesubformulawithnumber}
>>
>> \def\doplacesubformulawithnumber[#1][#2]%#2 gobbles spaces
>> {\iffirstargument
>> \incrementnumber[\v!formula]
>> \makesectionnumber[\v!formula]
>> \rawreference{\s!for}{#1}{\composedsectionnumber}
>> \else
>> \incrementnumber[\v!formula]
>> \fi\placesubformula}
>> \protect
>>
>>
>>> \starttext
>> %% > \incrementnumber[formula]
>> %% > \placesubformula
>> \placesubformulawithnumber[eqn1] %I need to think of a smaller name
>>> \startformula
>>> \startalign
>>> \NC div \vec{E} \NC = \epsilon_{0}^{-1} \rho \NR[eqn1:A][a]
>>> \NC rot \vec{E} \NC = 0 \NR
>>> \NC div \vec{B} \NC = 0 \NR[eqn1:B][b]
>>> \NC rot \vec{B} \NC = \mu_{0} \vec{j} \NR
>>> \stopalign
>>> \stopformula
>>> See *\in[eqn1] *for the static Maxwell equations, where we are going to
>>> examine \in[eqn1:A] a bit further ....
>>> \stoptext
>>>
>>
>> Also, note that div and rot should be in text font. You should probably do
>> \startmathcollection[default]
>> \definemathcommand [div] [nolop] {\mfunction{div}}
>> \definemathcommand [rot] [nolop] {\mfunction{rot}}
>> \stopmathcollection
>>
>> and use \div \rot etc.
>>
> Hi Aditya,
> I tested your solution and it works great. I cannot see any problems
> in my output. I wish I had your Tex programming skills, I am trying
> to learn the language myself from the TexBook (D.Knuth) but I still
> have a long way to go.
Well, I do not understand Tex. What I usually do is look at the
context source, which is much easier to read than latex internals, and
then copy from there, play around a bit, and sometimes things
work.
> Another test to check that the formula numbers work as expected
> \placeformula[kem-chapter-eqn11]
> \startformula
> \cases{
> \eqalign{
> \widehat{\vec{x}} &= - \vec{x} \cr
> \widehat{t} & = t \cr
> }}
> \quad \text{resp.} \quad
> \cases{\eqalign{
> \widehat{\vec{x}} &= \vec{x} \cr
> \widehat{t} & = -t \cr
> }}
> \stopformula
How about
\definemathmatrix
[group]
[left={\left\{\,},right={\right.}]
\startformula
\startgroup
\NC \widehat{\vec{x}} \NC= - \vec x \NR
\NC \widehat t \NC= t \NR
\stopgroup
\quad \text{resp} \quad
\startgroup
\NC \widehat{\vec{x}} \NC= \vec x \NR
\NC \widehat t \NC= -t \NR
\stopgroup
\stopformula
There is also startstop cases, but that does not give the correct
spacing in this case. May be useful otherwise.
\startformula
\startcases
\NC \widehat{\vec{x}} \MC= - \vec x \NR
\NC \widehat t \MC= t \NR
\stopcases
% Read MC as Math Column, there is also the usual NC
% which gives a text column
\quad \text{resp} \quad
\startcases
\NC \widehat{\vec{x}} \MC= \vec x \NR
\NC \widehat t \MC= -t \NR
\stopcases
\stopformula
HTH,
Aditya
_______________________________________________
ntg-context mailing list
[email protected]
http://www.ntg.nl/mailman/listinfo/ntg-context