Skip to content Skip to navigation

Connexions

You are here: Home » Content » Presentation token elements (others)

Navigation

Content Actions

  • Download module PDF
  • Add to ...
    Add the module to:
    • My Favorites
    • A lens
    • An external social bookmarking service
    • My Favorites (What is 'My Favorites'?)
      'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.
    • A lens (What is a lens?)

      Definition of a lens

      Lenses

      A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

      What is in a lens?

      Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

      Who can create a lens?

      Any individual Connexions member, a community, or a respected organization.

    • External bookmarks
  • E-mail the author

Recently Viewed

This feature requires Javascript to be enabled.

Presentation token elements (others)

Module by: Sunil Kumar Singh

"mtext" token element

The “mtext” element plays similar role of rendering characters like “mo” amd “mn” elements, but with a difference. It does not convey the notional or symbolic aspect of mathematical identities and numbers, which require specific presentation and manipulation to convey mathematical meaning. The “mtext” element is used to present plain text, which may be used for comments and clarification.

This element is also useful to deliver white space and mixing verbose mathematical rendering consisting of word string. For example, we would need to say “The presentation of alpha character in MathML looks like : α”.

Example 1: Display with "mtext" element


	    
    <m:math display="block">
        <m:mtext>The presentation of alpha character in
        MathML is : </m:mtext>
        <m:mi>&alpha;</m:mi>
     </m:math> 

	    
	  

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

The presentation of alpha character in MathML is : α The presentation of alpha character in MathML is : α

Though “mtext” element manages the empty space within the string of words, but not around it. In order to enhance, readability, style and presentation, we may add empty space, using "&ThinSpace" entity character.

Example 2: Display with "mtext" element


	    
    <m:math display="block">
     <m:mtext>The presentation of alpha character in MathML
     is : &ThinSpace; </m:mtext>
     <m:mi>&alpha;</m:mi>
     </m:math> 

	    
	  

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

The presentation of alpha character in MathML is :   α The presentation of alpha character in MathML is :   α

Color and size management of the content of “mtext” element is implemented with the common attributes of the token element i.e. mathvariant, mathsize, mathcolor and mathbackground directly on "mtext" element.

Example 3: Display with "mtext" element


	    
    <m:math display="block">
        <m:mtext mathvariant='bold' mathcolor='#fff' mathsize='12pt' 
        mathbackground='#f55'>
        Example : </m:mtext>
        <m:mtext mathsize='10pt'> The above example illustrates 
        application of “mfrac” element. </m:mtext> 
     </m:math> 

	    
	  

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

Example : This example illustrates application of theorem. Example : This example illustrates application of theorem.

In general, mixing of text with mathematics may be implemented, using any of the three possibilities discussed here. First, we can rely on the rendering facility of the document in which “MathML” is embedded. This document could be any valid “xml” document, including HTML. Second, we may use the text rendering by “mtext” element as explained above. This is appropriate for text, which is neither the part of the general text flow in the document nor the part of the notional display of mathematical expression. It suits the requirement of text rendering, used for qualifying mathematical expression or comments. Third, displaying text with “mi” element, which is inline with the mathematical expression or a part of it.

"mspace" token element

Attribute value types

  • width (default : "0em"): number h-unit | namedspace
  • height (default : "0ex"): number v-unit
  • depth (default : "0ex"): number v-unit
  • linebreak (default : "auto"): auto | newline | indentingnewline | nobreak | goodbreak | badbreak

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,

Example 4: 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 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".

Example 5: 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 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 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.

Example 6: 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. + + 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.

Comments, questions, feedback, criticisms?

Send feedback