HTML5 Examples For Beginners : Inserting Mathml
3. Examples
a. Inserting MATHML
MHTML, short for MIME HTML, is a web page archive format used to combine resources that are typically represented by external links (such as images, Flash animations, Java applets, and audio files) with HTML code into a single file. It is used for describing mathematical notations and capturing both its structure and content.
Firefox fully support MathML. Chrome has partial support and Internet explorer has support for MathML using plug-in MathType.
An example is given below to include MathML in HTML 5 page. It inserts a formula in the web page.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>MathML Example</title> </head> <body> <h1>MathML in HTML 5</h1> <br/> If <math xmlns="https://www.w3.org/1998/Math/MathML"> <mstyle scriptlevel="0" displaystyle="true"> <mrow> <mi>y</mi> <mo>=</mo><mo stretchy="false">(</mo><mi>x</mi><mo>+</mo> <msqrt><mstyle scriptlevel="0" displaystyle="true"> <mrow> <mn>1</mn> <mo>+</mo><msup> <mstyle scriptlevel="0" displaystyle="true"> <mrow><mi>x</mi></mrow> </mstyle><mstyle scriptlevel="0" displaystyle="true"> <mrow><mn>2</mn></mrow> </mstyle> </msup> </mrow> </mstyle> </msqrt> <msup><mstyle scriptlevel="0" displaystyle="true"> <mrow><mo stretchy="false">)</mo> </mrow></mstyle> <mstyle scriptlevel="0" displaystyle="true"> <mrow><mi>n</mi></mrow> </mstyle> </msup> </mrow> </mstyle> </math> , then <math xmlns="https://www.w3.org/1998/Math/MathML"> <mstyle scriptlevel="0" displaystyle="true"> <mrow><mo stretchy="false">(</mo> <mn>1</mn><mo>+</mo> <msup><mstyle scriptlevel="0" displaystyle="true"> <mrow><mi>x</mi></mrow></mstyle> <mstyle scriptlevel="0" displaystyle="true"> <mrow><mn>2</mn></mrow></mstyle> </msup> <mo stretchy="false">)</mo> <mfrac><mstyle scriptlevel="0" displaystyle="true"><mrow> <msup><mstyle scriptlevel="0" displaystyle="true"> <mrow><mi>d</mi> </mrow> </mstyle><mstyle scriptlevel="0" displaystyle="true"> <mrow><mn>2</mn> </mrow></mstyle> </msup> <mi>y</mi></mrow></mstyle> <mstyle scriptlevel="0" displaystyle="true"><mrow> <msup><mstyle scriptlevel="0" displaystyle="true"> <mrow><mi>dx</mi></mrow></mstyle> <mstyle scriptlevel="0" displaystyle="true"> <mrow><mn>2</mn></mrow></mstyle> </msup> </mrow></mstyle> </mfrac> <mo>+</mo><mi>x</mi> <mfrac><mstyle scriptlevel="0" displaystyle="true"><mrow><mi>dy</mi></mrow></mstyle> <mstyle scriptlevel="0" displaystyle="true"><mrow><mi>dx</mi></mrow></mstyle> </mfrac> </mrow></mstyle> </math> is? </body> </html> |