From: WN <wneimeijer01@cs.com>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Myway on using mathalign
Date: Thu, 06 Apr 2006 02:17:41 +0200 [thread overview]
Message-ID: <44345E25.5000908@cs.com> (raw)
In-Reply-To: <Pine.WNT.4.63.0604050243040.460@nqvgln>
[-- Attachment #1: Type: text/plain, Size: 2027 bytes --]
adityam@umich.edu 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.
>
> HTH,
> Aditya
>
>
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.
BTW
Thanks for your comment on the div, rot.
I indeed defined the div and rot in text font, it is defined in one of
my environment settings.
Attached my small Context script to confirm your solution
Again thanks for your help,
Kind regards
Wim
[-- Attachment #2: testformula.tex --]
[-- Type: text/plain, Size: 1675 bytes --]
\unprotect
% ========= Aditya code ============
\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}
\startmathcollection[default]
\definemathcommand [div] [nolop] {\mfunction{div}}
\definemathcommand [rot] [nolop] {\mfunction{rot}}
\stopmathcollection
% =================================
\definereferenceformat [informula]
[left=(, right=), text=]
\protect
\starttext
Some math tests, use of formula/subformula numbering.
\placesubformulawithnumber[kem-chapter1-eqn1]
\startformula
\startalign
\NC \div \vec{E} \NC = \frac{\rho}{\epsilon_{0}}\NR[kem-chapter1-eqn1:A][a]
\NC \rot \vec{B} \NC = \mu_{0} \:\vec{j} \NR[kem-chapter1-eqn1:B][b]
\NC \div \vec{B} \NC = 0 \NR[kem-chapter1-eqn1:C][c]
\NC \rot \vec{E} + \frac{\partial \vec{B} }{\partial t} \NC = 0 \NR[kem-chapter1-eqn1:D][d]
\stopalign
\stopformula
See \informula[kem-chapter1-eqn1] or alternatively
\informula[kem-chapter1-eqn1:A], \informula[kem-chapter1-eqn1:B],\informula[kem-chapter1-eqn1:C] or
\informula[kem-chapter1-eqn1:D].
\blank
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
\stoptext
[-- Attachment #3: Type: text/plain, Size: 139 bytes --]
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
next prev parent reply other threads:[~2006-04-06 0:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-05 1:15 WN
2006-04-05 6:51 ` Aditya Mahajan
2006-04-06 0:17 ` WN [this message]
2006-04-06 5:17 ` Aditya Mahajan
-- strict thread matches above, loose matches on Subject: below --
2006-04-02 17:21 Aditya Mahajan
2006-04-03 7:42 ` Taco Hoekwater
2006-04-03 8:28 ` Hans Hagen
2006-04-04 2:42 ` Aditya Mahajan
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=44345E25.5000908@cs.com \
--to=wneimeijer01@cs.com \
--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).