MathML: The markup Language for Maths

MathML is markup language for describing mathematical notation and capturing both its structure and content. It is XML base language processed on World Wide Web. We are writing just XML like tags to describe the equation. Let’s make case study how we can write that. Just for your information let me tell you that Current version of MathML is 3.0 as on 20th Oct, 2014[1], and before deploying your script on a web server ensure that your client use HTML5 supported browser.

Example 1

For example I want to display equation like this

Screenshot - 20-10-2014 , 13_29_30Image 1

 
 

 
<body>
<math>
            <mrow>
                        <msup>
                                    <mi> x </mi>
                                    <mn>2</mn>
                        </msup>
                                    <mo> + </mo>
                        <msub>
                                    <mi>3</mi>
                                    <mn>x</mn>
                        </msub>
                                    <mo> – </mo>
                                    <mi> Z</mi>
                       <mo> = </mo>
                        <mi> P</mi>              
            </mrow>
</math>
</body>
 

Here I want to display an equation shown image 1. I will start my markup language given in example. A very super tag will be <math>, which describe that here they are going to display any equation of mathematics.

<mrow>: describe new mathematical row.

<msup>: this describe the mathematical superscript.

<msub>: they describe mathematical subscript. In both the tag <msup> and <msub> , we are nestadly writing three kind of tag listed below,

<mi>: describe mathematical identifier

<mn>: describes the mathematical numbers.

<mo>: this describe mathematical operators like +,-,=;

Example 2:

Let’s take another example, where I’m going to use a bracket as a say I want to display 2 x 2 metrics as given in Example.


Image 2

<body>
<math>
<mrow>
<mi> A </mi> <mo>=</mo>
            <mfenced open=”[” close=”]”>
                <mtable>
                    <mtr>
                        <mtd> <mi> X</mi> </mtd>
                        <mtd> <mi> Y</mi></mtd>
                    </mtr>
                    <mtr>
                        <mtd> <mi> A</mi> </mtd>
                        <mtd> <mi> B</mi></mtd>
                    </mtr>
                </mtable>
     </mfenced>
</mrow>
</math>
<body>
 

<mfenced> : is tag, allow us to provide custom opening and closing parebtheses (such as bracket), and also it support separators like: “,” “|”,”;” and many more.

It has attribute like open, close, separators, Mathcolor, class,id, style, and mathbackground. In our example I’m using a big bracket as opening and closing. Inside this tag I have used, <mtable> is the mathematical Teble representation. As we have in the HTML,<table> tag.

<mtable> : mathematical table

<mtr>: mathematical table Row

<mtd>: mathematical Table data

Example 3:

Screenshot - 20-10-2014 , 14_14_55Image 3

<math>
<mroot>
                <mi> 8 </mi>
                <mn> 3 </mn>
</mroot>
 
<mo>X</mo>
 
<msqrt>
                <mi> 9 </mi>
</msqrt>
</math>
 
 

<msqrt>: used to make the square root

<mroot>: customized root.>

Example 4:

Screenshot - 20-10-2014 , 14_21_03Image 4

<math>
<mfrac>
<mi>x</mi>
<mn>y</mn>
</mfrac>
</math>

<mfrac>: to display fractional value like x/y.

Citations

[1] http://www.w3.org/TR/MathML

Share Post