<< Chapter < Page Chapter >> Page >

(iii) Table forming elements : They provide schemata for the formation of a table. They are six (6) in numbers :

    Table elements

  1. mtable : creats table
  2. mlabeledtr : creats a labelled row
  3. mtr : creates a row
  4. mtd : creats a column
  5. maligngroup : Grouping element
  6. malignmark : creats alignment markings

Child elements and arguments

Most of the elements (other than empty elements in content MathML) enclose child elements. Some of the elements, however, require that certain numbers of child elements or blocks of child elements be present. In such cases, these conditional child elements or blocks of child elements are called arguments.

Consider the example. Here “msub” element requires a minimum of two child elements. The child elements “mo” and “mi” in this example are, therefore, called arguments.

Arguments

<m:math display="block"><m:msub><m:mi>A</m:mi><m:mn>1</m:mn></m:msub></m:math>

Save the file after editing as “test1.xml” and see the display. The display looks like :

A 1

Consider another example given below. Here, “mfrac” element requires exactly two arguments. In case, there are more than two child elements, then “mrow” is to place child elements in two blocks as “mfrac” would take only two arguments –first block representing numerator and second block representing denominator of a ratio. The group of child elements enclosed within each pair of "mrow" tags consitutes one argument of the "mfrac" element.

Child elements

<m:math display="block"><m:mrow><m:mi>v</m:mi><m:mo>=</m:mo><m:mfrac><m:mrow><m:mi>a</m:mi><m:mo>+</m:mo><m:mi>b</m:mi></m:mrow><m:mi>c</m:mi></m:mfrac></m:mrow></m:math>

Save the file after editing as “test.xml”. The display looks like :

v = a + b c

Creating table

We have chosen this advance topic right in the beginning with a purpose. Matter of fact, it is important to introduce this topic from the point of view of presenting display of example output in a well structured form. The basic purpose here is to acquire capability to distribute display of math content in different parts of the browser window – without taking recourse to “xml” elements. Hence, our purpose is not to know the details of creating various types of tables in mathML (we shall learn this topic in details later), but to know only elementary idea about creating table so that we get the capability to format the mathematical content display as per the requirement in hand.

For the reason cited as above, the creation of table, is limited to creating invisible table (without border) with rows and columns so that mathematical expressions are suitably placed on the matrix of the browser and is not rendered simply as a continuous line of display.

The top most table element "mtable" contains "mtr" (row) and "mtd" (column) elements. A general construct for 2 rows 2 columns is given here. It is not very difficult to infer from the code lay out that "mtr" element, following "mtable" element defines a single row, which in turn, are split in columns as defined by "mtd" elements.

Codes for creating table

<m:math display="block"><m:mtable><m:mtr><m:mtd>....</m:mtd><m:mtd>....</m:mtd></m:mtr><m:mtr><m:mtd>....</m:mtd><m:mtd>....</m:mtd></m:mtr></m:mtable></m:math>

We can now use the table matrix to fill in with the mathematical content. A simple example is given below :

Structured display

<m:math display="block"><m:mtable><m:mtr><m:mtd><m:mtext>The value of x is :</m:mtext></m:mtd><m:mtd><m:mn>10</m:mn></m:mtd></m:mtr><m:mtr><m:mtd><m:mtext>The value of y is :</m:mtext></m:mtd><m:mtd><m:mn>20</m:mn></m:mtd></m:mtr></m:mtable></m:math>

Save the file after editing as “test.xml”. The display looks like :

The value of x is : 10 The value of y is : 20

Grouping with mrow element

This topic is also a preparatory in the sense that we encounter this element now and then in any of coding effort we undertake. Its primary function within a parent element is to combine child elements enclosed between its tags as one unit for the parent element and align them horizontally. This grouping is important in order to meet the requirement of elements, which takes certain number of arguments.

The MathML coding frame work, however, is aware of the cluttering of codes due to repetitive use of this element. For this reason, "mrow" element is inferred even if not applied with certain elements. It is not necessary to remember the list of these elements capable to infer "mrow" as the same is implied logically. The elements, which require zero or one or exactly one argument, enforce child elements inside it to be clubbed together as one argument. For this reason, elements, requiring zero or one or exactly one argument, infer “mrow” even without explicit "mrow" tags. A square root element, for example, takes zero or one argument and as such implements “mrow” impicitly. Similar is the case with “mtd” element and other elements, requiring one argument. It must be understood that if there is only one child element, then there is no need to implement "mrow" for grouping either inexplicitly or explicitly.

Inferred “mrow” is a great help. Imagine if you were to write a pair of “mrow” tags for each of the “mtd” column tags for creating a simple table.

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