Skip to content

Rhaptos Software Development

Personal tools
You are here: Home » Documentation » Architecture » Component Design » MathML » AllisonsNotes
Views

History for AllisonsNotes

changed:
-
Old content from Allison.  May be out of date.

Rules for Content !MathML

There are a few simple rules that you should follow when using Content !MathML. They will make your life easier (I promise):

   1. The spec is your friend. The Content !MathML spec is a great resource. There are many examples on there that demonstrate good !MathML. Since it is large, a great way to look through it is to use the browser's find in page function. Also, section 4.4 of the spec has a list of ALL of the content !MathML tags.
   2. Test your code. Don't just assume that !MathML will print if it displays correctly online. Maybe after you've done a few modules go back and check and make sure that they print correctly. If they don't it's most likely some incorrect !MathML.
   3. ASK! If you are unsure about how to markup some math, go ahead and ask. It's better to get it correct the first time then just put something together that will cause problems later. The online display is much more lenient in the !MathML it will take. The printing will take ONLY absolutely 100% correct !MathML. 

Best Practices for Content !MathML
There are many common errors made when using Content !MathML. Read this so that you don't make them!
Subscripts
- Write a subscripted symbol as:

  <m:ci>
    <m:msub>
      <m:mi>X</m:mi>
      <m:mn>0</m:mn> <!-- use m:mi if the subscript is a symbol -->
    </m:msub>
  </m:ci>
      

- This will display as: X 0

    * Common errors for subscriptsforgetting to wrap the entire thing in a <m:ci>
    * incorrectly using <m:apply>
    * using content elements inside the <m:msub>, only use mi for symbols and mn for numbers inside of a <m:msub>

Constants
Content !MathML has several tags for mathematical constants such as:

    * <m:imaginaryi/> for (or j)
    * <m:pi/> for
    * <m:exponentiale/> for 

Use them.
Entities
Use the entity descriptive names rather than the Unicode numbers. Such as &Sigma; rather than &#x3C3; Here is a list of the descriptive names.
Don't use !MathML to get a single Greek letter, unless you really want it to be displayed as a mathematical value. Just use Unicode instead.
Operators that don't exist in Content !MathML
There are several inline operators that do not have a !MathML content tag. Much greater than and plus-minus are two examples. To use these in Content !MathML use the following:

    <m:apply>
      <m:mo>&gg;</m:mo>  <!-- put entity for the operator here -->
      <m:ci>x</m:ci>         
      <m:cn>0</m:cn>
    </m:apply>
  

Note that the presentation tag <m:mo> is used to indicate that this is an operatore. This will display as: ยป x 0
Functions
Don't use <m:fn>. Instead put the attribute type="fn" on your ci. For the function f x 3 x :

    <m:math>
      <m:apply> <!-- apply equals to two expressions -->
        <m:eq/>
        <m:apply> < !-- expression one -->
    <m:ci type="fn">f</m:ci> <!-- a ci of type fn -->
    <m:ci>x</m:ci>           <!-- the argument of the function -->
        </m:apply>
        <m:apply> < -- expression two -->
    <m:times/>
    <m:cn>3</m:cn>
    <m:ci>x</m:ci>
        </m:apply>
      </m:apply>
    </m:math>
  

Miscellaneous

    * Everything in Content !MathML, except individual digits in a number, should have a tag around it. Do NOT just wrap some expression in a <m:ci>. For example if you have xyz, this is x times y times z, where x, y and z are <m:ci>. NOT <m:ci>xyz<m:ci>
    * Don't use <m:apply> around a single content item