<< Chapter < Page Chapter >> Page >

There are seven (7) token elements designed to serve the purpose of rendering characters to (i) display (“mi”,”mn”,”mo” and ”mtext”) mathematical content (ii) render characters for interfacing with other programs (“ms”) (iii) manage space around characters (mspace) and (iv) create new characters (mlymph).

The presentation token elements are the only elements to take and display characters in MathML. Mathematical symbols or identifiers are either single character (Example : x) or multiple characters (Example : sin). In mathematics, simple rendering of text is not sufficient. Mathematical content uses large numbers of symbols with varieties of visual forms and styles. In normal text rendering, font style does not matter, but different font styles convey different mathematical ideas and concepts and as such are treated as different characters. Besides, there are convention in mathematics about spacing around operators and relative size that needs to be negotiated with unequal size of other characters. To capture the complete spectrum of mathematical details, MathML employs about 900 characters and a specialized system of constructors that render mathematical content in consistent and coherent manner to match the precise nature of mathematical symbols and expressions.

It is interesting to know that rendering of mathematical content by token elements - even if typed directly as string of characters and looking similar on browser display - is inherently different to simple text rendering in a horizontal sequence. The difference is visible when seen in the context of uses that require scripting like sub or super scripts, stretching of operators (like a parenthesis is required to grow to cover the height of expression enclosed etc) etc.

In MathML, the differentiation operator “&DifferentialD;” , for example, could have been represented by letter “d” and hence it may be argued why to include a separate character to represent the symbol of differentiation, which could be easily rendered using letter “d” from keyboard. The reason lies in the style convention of mathematics that requires this operator to have a specific style and form different to a normal character “d”.

Furthermore, these token constructors provide many automatic behavior to character representation consistent with the convention in mathematics. An operator like “+” sign can be rendered with or without space depending upon the context in which the sign appears in the expression.

See the output of the MathML codes in the example given below. Inspect the space before and after the sign “+” in the output, the first "+" sign is very close to the identifier "a", while the second "+" is surrounded with greater amount of space in horizontal direction. These detailed display design consideration is extremely important to reflect the preciseness required in displaying mathematics.

Context based spacing in mathml

<m:math display="block"> <m:mrow> <m:mo> + </m:mo> <m:mi> x </m:mi> <m:mo> + </m:mo> <m:mi> y </m:mi> </m:mrow> </m:math>

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

+ x + y

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