<< Chapter < Page Chapter >> Page >

This element is provided to render a blank space of any size, which can be controlled with the help of attribute values. It is a more flexible mechanism in comparison to the space rendering characters like "&nbsp", "&emsp", "&emsp14".

The “mspace” element has three attributes to control the size of the blank space (width, height and depth). Significantly, its default values are set such that its rendering does not affect normal presentation. It means that if we want to affect the layout, we would have to assign attribute values for the size. Size attribute accept numbers in variety of ways, using different units.

The “linebreak” attribute, on the other hand, suggests different line breaking options for the renderer to implement.

Consider the example given here,

Using mspace element to manage space

<m:math display="block"> <m:mfrac> <m:mrow> <m:mi>a</m:mi> <m:mspace width="0.5in"/> <m:mi>b</m:mi> </m:mrow> <m:mrow> <m:mi>c</m:mi> <m:mspace height="1.27cm"/> <m:mi>d</m:mi> </m:mrow> </m:mfrac> </m:math>

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

a b c d

Besides, there is an important issue with regard to uses of “mspace” and also other elements, which introduce space on rendering. Space rendering has no visual lymphs or character display, but despite this, space rendering elements are counted as far as counting of arguments are concerned. The element “mfrac”, which is used to display ratio, takes only two arguments – one of which forms the numerator and other forms the denominator of the ratio. In the example below, we simply introduce “mspace” between the “mfrac” tags. The MathML parser (renderer) counts “mspace” and as such fails to implement code as there are three arguments as against the requirement of exactly two arguments for “mfrac” element. As expected, the browser notifies that the code is "invalid-markup".

Counting of "mspace" as an argument

<m:math display="block"> <m:mfrac> <m:mi>a</m:mi> <m:mspace height="0.5in"/> <m:mi>b</m:mi> </m:mfrac> </m:math>

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

a b

Thus, in order to meet the requirement of elements with fixed arguments, we would have to group child elements with the help of “mrow” element.

<m:mfrac> <m:mi>a</m:mi> <m:mrow> <m:mspace height="0.5in"/> <m:mi>b</m:mi> </m:mrow> </m:mfrac>

"ms" token element

Specific attributes :   lquote rquote

    Attribute value types

  • lquote (default : “"”) : string
  • rquote (default : “"”) : string
  • rspace : number h-unit | namedspace

This is also a character rendering element, but with a double quote around. This is provided for interpretation of MathML data by other programs and may not be very useful for the authors or for the requirements limited to diplay.

By default, both the left and right quote characters are standard double quote character ,". We can change the surrounding characters with the lquote and rquote attributes respectively.

Let us now work with the example given here to view the output for few cases.

Display with "ms" element

<m:math display="block"> <m:mrow> <m:ms>A</m:ms> <m:mo>+</m:mo> <m:ms lquote='|' rquote='|'>A</m:ms> <m:mo>+</m:mo> <m:ms>&amp;</m:ms> <m:mo>+</m:mo> <m:ms>Hello, I have come to meet you.</m:ms> <m:mo>+</m:mo> <m:ms>&DifferentialD;</m:ms> <m:mo>+</m:mo> <m:ms lquote='a' rquote='b'>&int;</m:ms> </m:mrow> </m:math>

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

A + A + & + Hello, I have come to meet you. + +

"mglyph" token element

The "mglyph" element is intended for creating new character in addition to what is available with Unicode character set. With the expanding horizon of mathematics, it is possible that a character with new "glyph" is required to represent new mathematical idea or concept. On the working level, the "mglmph" element draws on the existing Unicode character or some "font style", which must be supported by the renderer. For our course, though, we feel that this topic may not be very useful. As such, this element is not discussed in any more detail here.

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