Show All Hide All Printer Friendly Version Web Friendly Version

DAISY Consortium Logo - Link to Home PagePart II(g): Mathematics

DAISY 3 Structure Guidelines
Last Revised: June 4, 2008

This section of the guidelines explains how to use elements to mark up mathematical expressions in DAISY books. The elements described here come from the W3C MathML Standard. MathML forms the basis of DAISY's Modular Extension for Mathematics, which is the normative reference upon which these guidelines are based.

Information Object: Math

Definition

A mathematical expression is a collection of symbols representing a mathematical idea. A mathematical expression may be as simple as a single variable or it may be a complex expression that spans many lines. It may occur either inline or in a block context.

Markup

All content that represents mathematical expressions should be marked up using MathML; images (pictures) alone should not be used because these can not be rendered with synthetic speech or converted to braille.

Mathematical content must be enclosed in the <math> element. The children of the <math> element must be valid MathML presentation elements. While MathML does not require the altimg and alttext attributes to be present on the <math> element, the MathML in DAISY Specification does require these attributes to be specified. These attributes provide a fallback mechanism for basic DAISY players that are not capable of rendering MathML. The resolution of the image referenced by the altimg attribute should be such that it is readable when scaled for large print. The alttext value should unambiguously describe the mathematical expression.

Syntax

<math>...</math>

Examples

Example 1

This example shows markup for math that involves units. Units require special markup so that they are displayed properly and so that they can be spoken properly. For example, "km" should be spoken as "kilometer" or "kilometers". A unit is indicated by adding to the mi tag the class attribute value "MathML-Unit". See Units in MathML for more details.

In addition to using the class attribute value "MathML-Unit", two additional points should be noted:

In the example below, &#x2062; is the Unicode character representing invisible times. It separates the expression from the unit ("ft").


<m:math display="inline" xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
         alttext="56 b squared feet squared" altimg="images/p281-022.png"> 
  <m:mrow>
    <m:mn>56</m:mn>
    <m:mo>&#x2062;</m:mo>
    <m:msup>
      <m:mi>b</m:mi>
      <m:mn>2</m:mn>
    </m:msup>
    <m:mo rspace="thickmathspace">&#x2062;</m:mo>
    <m:msup>
       <m:mi mathvariant="normal" class="MathML-Unit">ft</m:mi>
       <m:mn>2</m:mn>
    </m:msup> 
  </m:mrow> 
</m:math>

Example 2

This example shows markup for math that has textual annotations next to it. Math such as this should be marked up using table with the math being in one column of the table and text in the other column. It should not be marked up with mtable and mtext in the second column. This does not apply to text used for equation numbering. For that, an mtable is appropriate; the equation number should be part of an mlabeledtr element.


<table border="0" cellspacing="4">
  <tr>
    <td> 
      <m:math display="inline" xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
	     alttext="Left parenthesis 4 x squared right parenthesis cubed
                       equals 4 cubed times left parenthesis x squared right parenthesis cubed."
	     altimg="images/p278-015.png">
        <m:mrow>
          <m:msup>
            <m:mrow>
              <m:mrow>
                <m:mo>(</m:mo>
                <m:mrow>
                  <m:mn>4</m:mn>
                  <m:mo>&#x2062;</m:mo>
                  <m:msup>
                    <m:mi>x</m:mi>
                    <m:mn>2</m:mn>
                  </m:msup>
                </m:mrow>
                <m:mo>)</m:mo>
              </m:mrow>
            </m:mrow>
            <m:mn mathcolor="red">3</m:mn>
          </m:msup>
          <m:mo>=</m:mo>
          <m:msup>
            <m:mn>4</m:mn>
            <m:mn mathcolor="red">3</m:mn>
          </m:msup>
          <m:mo></m:mo>
          <m:msup>
            <m:mrow>
              <m:mrow>
                <m:mo>(</m:mo>
                <m:mrow>
                  <m:msup>
                    <m:mi>x</m:mi>
                    <m:mn>2</m:mn>
                  </m:msup>
                </m:mrow>
                <m:mo>)</m:mo>
              </m:mrow>
            </m:mrow>
            <m:mn mathcolor="red">3</m:mn>
          </m:msup>
        </m:mrow>
      </m:math>
    </td>
    <td>
      <sent>Raise each factor to the third power.</sent>
    </td> 
  </tr>
  <tr>
    <td> 
      <m:math display="inline" xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
	     alttext="Equals 4 cubed times x superscript 2 times 3 baseline."
	     altimg="images/p278-016.png">
        <m:mrow>
          <m:mphantom>
            <m:msup>
              <m:mrow>
                <m:mrow>
                  <m:mo>(</m:mo>
                  <m:mrow>
                    <m:mn>4</m:mn>
                    <m:mo>&#x2062;</m:mo>
                    <m:msup>
                      <m:mi>x</m:mi>
                      <m:mn>2</m:mn>
                    </m:msup>
                  </m:mrow>
                  <m:mo>)</m:mo>
                </m:mrow>
              </m:mrow>
              <m:mn mathcolor="red">3</m:mn>
            </m:msup>
          </m:mphantom>
          <m:mo>=</m:mo>
          <m:msup>
            <m:mn>4</m:mn>
            <m:mn>3</m:mn>
          </m:msup>
          <m:mo></m:mo>
          <m:msup>
            <m:mi>x</m:mi>
            <m:mrow>
              <m:mn>2</m:mn>
              <m:mo></m:mo>
              <m:mn>3</m:mn>
            </m:mrow>
          </m:msup>
        </m:mrow>
      </m:math>
    </td>
    <td>
      <sent>Use the Rule for Raising a Power to a Power. </sent>
    </td> 
  </tr>
  <tr>
    <td> 
      <m:math display="inline" xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
	     alttext="Equals 4 cubed times x superscript 6."
	     altimg="images/p278-017.png">
        <m:mrow>
          <m:mphantom>
            <m:msup>
              <m:mrow>
                <m:mrow>
                  <m:mo>(</m:mo>
                  <m:mrow>
                    <m:mn>4</m:mn>
                    <m:mo>&#x2062;</m:mo>
                    <m:msup>
                      <m:mi>x</m:mi>
                      <m:mn>2</m:mn>
                    </m:msup>
                  </m:mrow>
                  <m:mo>)</m:mo>
                </m:mrow>
              </m:mrow>
              <m:mn mathcolor="red">3</m:mn>
            </m:msup>
          </m:mphantom>
          <m:mo>=</m:mo>
          <m:msup>
            <m:mn>4</m:mn>
            <m:mn>3</m:mn>
          </m:msup>
          <m:mo></m:mo>
          <m:msup>
            <m:mi>x</m:mi>
            <m:mn>6</m:mn>
          </m:msup>
        </m:mrow>
      </m:math>
    </td> <td><sent>Multiply exponents. </sent></td> 
  </tr>
  <tr>
    <td> 
      <m:math display="inline" xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
              alttext="Equals 64 x superscript 6."
              altimg="images/p278-018.png">
        <m:mrow>
          <m:mphantom>
            <m:msup>
              <m:mrow>
                <m:mrow>
                  <m:mo>(</m:mo>
                  <m:mrow>
                    <m:mn>4</m:mn>
                    <m:mo>&#x2062;</m:mo>
                    <m:msup>
                      <m:mi>x</m:mi>
                      <m:mn>2</m:mn>
                    </m:msup>
                  </m:mrow>
                  <m:mo>)</m:mo>
                </m:mrow>
              </m:mrow>
              <m:mn mathcolor="red">3</m:mn>
            </m:msup>
          </m:mphantom>
          <m:mo>=</m:mo>
          <m:mn>64</m:mn>
          <m:msup>
            <m:mi>x</m:mi>
            <m:mn>6</m:mn>
          </m:msup>
        </m:mrow>
      </m:math>
    </td>
    <td><sent>Simplify.</sent></td> 
  </tr>
</table>

Example 3

This example shows markup for simple inline math and illustrates two points:

  1. Single letter variables should be marked up using MathML.
  2. There should be navigation points surrounding the math.

Even though this example just consists of a single letter variable, it is important to mark this up as math so that both braille and speech translations handle it appropriately. Some braille math codes will mark variables and symbols differently than the corresponding character codes. For speech, some variables need to have a specific pronunciation. For example, the letter "a" in English should always have the long "a" sound when used as a math variable.

In order to allow navigation to before or after the math (e.g., to skip reading the math after hearing the first part of it), there should be elements immediately before and after the math element that have their id attribute set. For inline math, this requires introducing span elements as shown below if there are no other elements with ids adjacent to the math element.


<span>, where </span>
  <m:math display="inline" xmlns:dtbook="http://www.daisy.org/z3986/2005/dtbook/"
          alttext="s" altimg="images/p281-028.png"> 
    <m:mi>s</m:mi>                                                                       
  </m:math>
<span> is the length of a side, to find the volume of each cube.</span>

Illustrated Example 1

Page Sample:

Sample Code:

Comments and Alternative NIMAS Examples:

Illustrated Example 2

Page Sample:

Sample Code:

Comments and Alternative NIMAS Examples:

Illustrated Example 3

Page Sample:

Sample Code:

Comments and Alternative NIMAS Examples: