Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Math markup example

Reply
Thread Tools

Math markup example

 
 
Peter Flynn
Guest
Posts: n/a
 
      05-21-2010
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>
<mower/>
<m:ci>c</m:ci>
<m:cn>2</m:cn>
</m:apply>
</m:apply>
</m:apply>

///Peter
 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      05-21-2010
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...lam/index.html

{} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
/\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
 
Reply With Quote
 
 
 
 
Peter Flynn
Guest
Posts: n/a
 
      05-21-2010
William F Hammond wrote:
> 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 Kesselman wrote:
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
math.h trig functions questions (and some forgotten high school math) Mark Healey C Programming 7 05-22-2006 10:42 AM
Math markup in code documentation? schwehr@gmail.com Python 3 10-25-2005 03:38 PM
Re: Is still math.h the C++ math library ? AciD_X C++ 4 04-01-2004 07:29 PM
Why can I not use: Math a=new Math(); chirs Java 18 03-02-2004 06:00 PM



Advertisments