Math markup example

P

Peter Flynn

I am, god wot, no mathematician, but I need to be able to quote a simple
example of MathML markup for an obvious candidate expression, E=mc²

The following was constructed by a colleague who is no longer
contactable, and I would be grateful if someone could let me know if it
is a reasonable way to do it, bearing in mind this is for the purposes
of an example:

<m:apply>
<m:eq/>
<m:ci>E</m:ci>
<m:apply>
<m:times/>
<m:ci>m</m:ci>
<m:apply>
<m:power/>
<m:ci>c</m:ci>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>

///Peter
 
J

Joe Kesselman

From an example found fairly quickly on the web:

A MathML formula can be typeset inline, as here
<math xmlns="&mathmlns;">
<mi>E</mi><mo>=</mo><mi>m</mi>
<msup>
<mi>c</mi>
<mn>2</mn>
</msup>
</math>

Here they used a default namespace declaration rather than an explicit
prefix, but it comes out to the same thing. Note that I don't vouch for
correctness.

Here <mo> is an operator, <mi> is an identifier, <msup> takes an
expression and a superscript and applies the latter to the former.

See also the examples in the Recommendation, at
http://www.w3.org/TR/MathML/chapter2.html#fund.examples
though those appear to be more rigorous, explicitly using the "invisible
times" operator.

I'm sure there are tutorials on the web too, though I haven't gone
looking for them. My usual starting point when looking for beginner
documents is http://www.ibm.com/xml, but I admit to being biased.

--
Joe Kesselman,
http://www.love-song-productions.com/people/keshlam/index.html

{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
 
P

Peter Flynn

William said:
However, I would suggest not using namespace prefixes, which are not,
as I understand it, compatible with html5. The safest way, I think,
is to introduce the namespace -- fully elaborated for each instance --
with the xmlns attribute on the "math" element.
> Note that you are using "content" MathML markup. For content MathML
> to render in Mozilla family browsers, you'll need a link to local
> copies of David Carlisle's "universal mathml stylesheets" found at
> http:/www.w3.org/Math/XSL

Fortunately there will only be this one example :) and it will be
transformed by Cocoon into whatever flavour of HTML is current from time
to time.

Joe said:
> From an example found fairly quickly on the web:
>
> A MathML formula can be typeset inline, as here
> <math xmlns="&mathmlns;">
> <mi>E</mi><mo>=</mo><mi>m</mi>
> <msup>
> <mi>c</mi>
> <mn>2</mn>
> </msup>
> </math>

Thank you both for the explanations. I think I need to use both the
presentation format and the content format, so I'm grateful to have them
in a mathematically correct form.
> I'm sure there are tutorials on the web too, though I haven't gone
> looking for them. My usual starting point when looking for beginner
> documents is http://www.ibm.com/xml, but I admit to being biased.

I have been trying to avoid having to learn the fine detail of MathML
and thereby reveal my own mathematical incompetence (this from someone
who gained a grade U in the Add.Maths O-Level, which is "Unclassified";
OLEB's polite phrase for "under 5%" :)

///Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top