<< Chapter < Page Chapter >> Page >

3: Visit www.w3.org/Math/testsuite . It gives you vast array of MathML examples to work with. The website provides codes of hundreds of examples. At certain stage of this course, you may like to copy and paste the codes to your desktop to confirm results. Besides, it is a repository of about 900 entity references used to display symbols and implement mathematical ideas. On the testsuite web page, click the link named "testsuite.zip" to download the same in the desktop folder created for the course. Store the zip file for use in future.

The official documentation of mathML is available at W3C web site www.w3.org/TR/MathML2 .

Creating a mathml enabled document

Here, we present the steps to generate MathML codes in MS Word desktop editor. The idea right now is not to explain MathML codes, but to show the way to create a proper document with MathML codes and implement the same in the MathML enabled browser on your desktop.

As the codes need to be free from formatting details and other encoding, the file created is saved as plain text with Unicode(UTF-8) specification. As such, the file should be saved as plain text file with extension “xml” in order to view the implementation in the browser.

Once the document has been created, the same can be tested in MathML supported browser like Mozilla’s Firefox. When MathML codes display the output to the satisfaction, then block of codes starting with<m:math>tag and ending with</m:math>tag can be copied and pasted in the XML document for publication purposes or be saved for future use. Now, proceed with the steps given here to create a mathML enabled “xml” document.

1: Open MS Word. Open a new document. Write exactly or copy/paste the following markup lines in the new document :

<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd" > <document xmlns:m="http://www.w3.org/1998/Math/MathML"> </document>

2: Write the next top most “xml” element of the document between “document” tags.

<content> </content>

Note that “document” and “content” are the only XML elements i.e. the pair of tags, used for practicing MathML code. All other code lines, as detailed below, shall be MathML codes.

3: Write “math” MathML element between “content tags” with an example coding to display mathematical construct : v = AB t .

4: For the time being, write exactly or copy / paste the code lines as given below and place them between “content” tags :

Displaying mathematical content

<content> <m:math display="block"> <m:mrow> <m:mi mathvariant="bold">v</m:mi> <m:mo>=</m:mo> <m:mfrac> <m:mi mathvariant="bold">AB</m:mi> <m:mi>t</m:mi> </m:mfrac> </m:mrow> </m:math> </content>

5: Click File from Word’s top menu and select “save as”. A dialog box appears. Look at the "Save as type" option. Select “Plain Text” option from the drop down menu. Give a name to the file such as “test.xml”. Ensure that you have provided “xml” extension. Click “Save” button available at the right hand corner (also visible in the figure below).

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, A primer in mathml. OpenStax CNX. Apr 19, 2006 Download for free at http://cnx.org/content/col10345/1.16
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'A primer in mathml' conversation and receive update notifications?

Ask