* Override MathML formula label
@ 2019-07-27 6:23 Duncan Hothersall
2019-07-28 20:04 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Duncan Hothersall @ 2019-07-27 6:23 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 748 bytes --]
Hi all.
In processing MathML if I want a formula to be numbered I add a label="X"
attribute to the <formula> tag as per:
\usemodule[mathml]
\starttext
\xmlprocessdata{}{<formula label='X'>
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>p</mi><mo>=</mo><mi>c</mi><mo>-</mo><mi>t</mi>
</math>
</formula>}{}
\stoptext
This will label the formula as (1). I know I can adjust how the automatic
numbering is generated using \setupformulae, but how can I override the
label used for a specific formula, say to set it to (36A)?
Basically I have a setup where formulae are mostly numbered sequentially
but occasionally individual formulae need to have an out-of-sequence or
differently formatted number.
Thanks as ever for any help.
Duncan
[-- Attachment #1.2: Type: text/html, Size: 1364 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Override MathML formula label
2019-07-27 6:23 Override MathML formula label Duncan Hothersall
@ 2019-07-28 20:04 ` Hans Hagen
2019-07-29 6:40 ` Duncan Hothersall
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2019-07-28 20:04 UTC (permalink / raw)
To: mailing list for ConTeXt users, Duncan Hothersall
On 7/27/2019 8:23 AM, Duncan Hothersall wrote:
> Hi all.
>
> In processing MathML if I want a formula to be numbered I add a
> label="X" attribute to the <formula> tag as per:
>
> \usemodule[mathml]
> \starttext
> \xmlprocessdata{}{<formula label='X'>
> <math xmlns='http://www.w3.org/1998/Math/MathML'>
> <mi>p</mi><mo>=</mo><mi>c</mi><mo>-</mo><mi>t</mi>
> </math>
> </formula>}{}
> \stoptext
>
> This will label the formula as (1). I know I can adjust how the
> automatic numbering is generated using \setupformulae, but how can I
> override the label used for a specific formula, say to set it to (36A)?
> **
>
> Basically I have a setup where formulae are mostly numbered sequentially
> but occasionally individual formulae need to have an out-of-sequence or
> differently formatted number.
>
> Thanks as ever for any help.
\usemodule[mathml]
\startxmlsetups mml:formula
\edef\mmlformulalabel{\xmlatt{#1}{label}}
\edef\mmlformulatitle{\xmlatt{#1}{title}}
\doifsomethingelse {\mmlformulalabel\mmlformulatitle} {
\startplaceformula[reference=\mmlformulalabel,title=\mmlformulatitle]
\startformula
\xmlfirst{#1}{/mml:math}
\stopformula
\stopplaceformula
} {
\startformula
\xmlfirst{#1}{/mml:math}
\stopformula
}
\stopxmlsetups
\starttext
\xmlprocessdata {} {
<document>
<formula label='X'>
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>p</mi><mo>=</mo><mi>c</mi><mo>-</mo><mi>t</mi>
</math>
</formula>
<formula label='Y' title="whatever">
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>p</mi><mo>=</mo><mi>c</mi><mo>-</mo><mi>t</mi>
</math>
</formula>
<formula label='Z'>
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mi>p</mi><mo>=</mo><mi>c</mi><mo>-</mo><mi>t</mi>
</math>
</formula>
</document>
}{}
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Override MathML formula label
2019-07-28 20:04 ` Hans Hagen
@ 2019-07-29 6:40 ` Duncan Hothersall
0 siblings, 0 replies; 3+ messages in thread
From: Duncan Hothersall @ 2019-07-29 6:40 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 737 bytes --]
Brilliant, thanks Hans. Looks like I need to start delving properly into
the power of the XML setups.
Duncan
On Sun, 28 Jul 2019 at 21:04, Hans Hagen <j.hagen@xs4all.nl> wrote:
>
> \usemodule[mathml]
>
> \startxmlsetups mml:formula
> \edef\mmlformulalabel{\xmlatt{#1}{label}}
> \edef\mmlformulatitle{\xmlatt{#1}{title}}
> \doifsomethingelse {\mmlformulalabel\mmlformulatitle} {
>
> \startplaceformula[reference=\mmlformulalabel,title=\mmlformulatitle]
> \startformula
> \xmlfirst{#1}{/mml:math}
> \stopformula
> \stopplaceformula
> } {
> \startformula
> \xmlfirst{#1}{/mml:math}
> \stopformula
> }
> \stopxmlsetups
>
> Duncan
[-- Attachment #1.2: Type: text/html, Size: 1178 bytes --]
[-- Attachment #2: Type: text/plain, Size: 493 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-29 6:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-27 6:23 Override MathML formula label Duncan Hothersall
2019-07-28 20:04 ` Hans Hagen
2019-07-29 6:40 ` Duncan Hothersall
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).