Changes

Jump to navigation Jump to search
1,068 bytes added ,  17:58, 17 November 2009
no edit summary
< [[Math]] | [[MathML]] | [[XML]] >
 
__TOC__
 
== MKII ==
 
Here is a complete and simple example of a ConTeXt file including MathML for MKII:
 
<xmlcode>
\usemodule[mathml]
\starttext
\startXMLdata
<math>
<mrow>
<msup> <mi>x</mi><mn>2</mn> </msup>
<mo>+</mo>
<mrow>
<mn>4</mn><mo>&InvisibleTimes;</mo><mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
</math>
\stopXMLdata
\stoptext
</xmlcode>
 
That gives:
 
<context>
\usemodule[mathml]
\starttext
\startXMLdata
<math>
<mrow>
<msup> <mi>x</mi><mn>2</mn> </msup>
<mo>+</mo>
<mrow>
<mn>4</mn><mo>&InvisibleTimes;</mo><mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
</math>
\stopXMLdata
\stoptext
</context>
MathML support in ConTeXt is very extensive, but some features are rather hidden for now.
<cmd>setupMMLappearance</cmd> allows you to adjust various things. For example, the layout of presentational markup which uses mtables for alignment can be changed via <cmd>setupMMLappearance[mtable][alternative=a|b|c]</cmd>. Experiment with the different alternatives to see the effects.
When embedding XML inside normal ConTeXt code, remember that <cmd>stopXMLdata</cmd> gobbles up any following white-space. You'll need to explicitly put it back in if you want it (with <cmd>space</cmd>).
=== Current bugs and workarounds ===
To use UTF inside MathML currently requires this workaround:
The * (comment token) prevents the spurious space.
 
== MKIV ==
Support with MKIV is not as complete as MKII and under construction. The example above for MKIV:
<xmlcode>
\usemodule[mathml]
\starttext
test
\xmlprocessdata{}{
<math xmlns='http://www.w3.org/1998/Math/MathML'>
<mrow>
<msup> <mi>x</mi><mn>2</mn> </msup>
<mo>+</mo>
<mrow>
<mn>4</mn><mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
</math>
}{}
\stoptext
</xmlcode>
 
[[Category:Math]]
68

edits

Navigation menu