W3C

Fill In the Blank with MathML

W3C Working Group Draft Note 16 June 2012

This version:
http://www.w3.org/Math/Documents/Notes/blanks/fill_in_the_blank.html
Latest version:
http://www.w3.org/Math/Documents/Notes/blanks/fill_in_the_blank.html
Previous version:
This is the first version of this Note.
Editors:
Dennis Leas, DAISY Consortium,
Paul Libbrecht, German Research Center for Artificial Intelligence (DFKI) Gmbh,
Neil Soiffer, Design Science Inc.

Abstract

This Draft Note examines the treatment of fill-in-the-blank constructions in mathematical documents using MathML. The current edition of the MathML 3.0 Recommendation [MathML3] is the markup language of choice and through its inclusion in HTML5 [HTML5] this note addresses fill-in-the-blank constructions in more documents on the wider evolving web. It arises out of work considering the problem of wide accessibility for mathematical documents beyond just print and ordinary browser screens.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This Draft Note provides a discussion of fill-in-the-blank constructions expressed with MathML. It contains non-normative interpretations of the MathML 3.0 Recommendation [MathML3] and it provides guidelines for representing “fill in the blank”. Please direct comments and report errors in this document to www-math@w3.org.

This document has been produced by the W3C Math Working Group as part of the W3C Math Activity (Activity statement). The goals of the Working Group are discussed in the Working Group Charter. A list of participants in the W3C Math Working Group is available.

Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress. Patent disclosures relevant to this Note may be found on the Math Working Group's patent disclosure page.

Table of Contents

1 Fill in the Blank
    1.1 Background
    1.2 Defining a “blank”
        1.2.1 Example
    1.3 Examples
        1.3.1 Example 1
        1.3.2 Example 2
    1.4 Rendering and Editing
        1.4.1 Blanks on HTML Pages
        1.4.2 Aural Rendering
    1.5 Open Questions
Bibliography


1 Fill in the Blank

1.1 Background

MathML lacks a defined method to create a “blank” to be filled in. A typical use for this would be for a test where the test reader needs to answer a mathematical question. When printed, the blank should be large enough so that an answer can fit in the “blank”. If presented online, the blank should allow editing.

The Math WG has discussed adding such a feature. If MathML were only used in HTML(5), then defining a solution would be much easier. However, MathML is used in a wide variety of situations, from publishing work flows to computation systems, in addition to being used for web pages. Given these different environments, it is important to find a solution that does not impose a large burden on implementers.

As MathML gets used more frequently, it is useful to standardize a method for representing “blanks”. It is important to avoid the situation where various standards that incorporate MathML suggest different ways to represent a blank. One such standard that is specifying the “right” way to represent blanks is DAISY [DAISY]. DAISY, together with the NIMAS standard [NIMAS] , are producing guidelines for how to encode samples, and these samples include fill in the blank examples as found in textbooks.

The goal of this note is to define a flexible means of specifying what is a “blank” so that renderers (visual and aural) can do something intelligent with the blank. At the same time, the note does not impose a burden on those renderers and systems that do not or can not do something special with blanks.

1.2 Defining a “Blank”

To indicate a blank, set the class attribute of a MathML element that displays the blank to “MathML-Blank”. Typically, this element will be an menclose that draws a line under some space element or a box around the element. The space element could be an mspace, mphantom, mtext that contains non-breaking spaces ( ), or other element as is appropriate.

If the document is meant to allow interactive feedback, it is usually a good idea to also include an id attribute so it can be identified. This is discussed more fully in Blanks in HTML Pages.

1.2.1 Example

3plus9 example

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mrow>
    <mn>3</mn>
    <mo>+</mo>
    <mn>9</mn>
  </mrow>
  <mo>=</mo>
  <menclose class="MathML-Blank" notation="bottom">
    <mtext>&#xA0;&#xA0;</mtext>
  </menclose>
</math>

1.3 Examples

Blanks often are visually displayed as underlined spaces, although empty circles, squares, or other usages occur in practice. Most of these can be represented by an menclose element whose child is an mspace of the appropriate size. However, other representations should not be ruled out.

1.3.1 Example 1

File:FillInTheBlank-1.png

<ol>
  <li>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mrow>
        <mrow>
          <mn> 667 </mn>
          <mo> - </mo>
          <mn> 358 </mn>
        </mrow>
        <mo> = </mo>
        <menclose class="MathML-Blank" notation="bottom">
          <mspace width="6em" height="2ex"/>
        </menclose>
      </mrow>
    </math>
  </li>
  <li>
    <math>
      <mstack>
        <mn> 515 </mn>
        <msrow>
          <mo> - </mo>
          <mn> 472 </mn>
        </msrow>
        <msline/>
        <mn class="MathML-Blank"> &#xA0;&#xA0;&#xA0; <!--no-break space--> </mn>
      </mstack>
    </math>
  </li>
</ol> 

Note that in the second example, mn was used. This is important because we want the blank to be three digits wide, and in an mstack or msrow, all elements are considered one digit wide except for mn. See the MathML Recommendation [MathML3] for more information.

1.3.2 Example 2

File:FillInTheBlank-2.png

<h4>Do you know <strong>HOW</strong>?</h4>
<p><span>Compare. Write </span>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <mo> &gt; </mo>
    </mrow>
  </math>
  <span>, </span>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <mo>  &lt; </mo>
    </mrow>
  </math>
  <span> or </span>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <mo> = </mo>
    </mrow>
  </math>
  <span> for each </span>
  <math xmlns="http://www.w3.org/1998/Math/MathML">
    <mrow>
      <menclose notation="circle">
        <mspace width="1em" height="0.8em" depth="0.2em"/>
      </menclose>
    </mrow>
  </math>
  <span>.</span>
</p>
<ol>
  <li>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mrow>
        <mfrac>
          <mn> 3 </mn>
          <mn> 5 </mn>
        </mfrac>
        <menclose class="MathML-Blank" notation="circle">
          <mspace width="1em" height="0.8em" depth="0.2em"/>
        </menclose>
        <mfrac>
          <mn> 4 </mn>
          <mn> 5 </mn>
        </mfrac>
      </mrow>
    </math>
  </li>
  <li>
    <math xmlns="http://www.w3.org/1998/Math/MathML">
      <mrow>
        <mfrac>
          <mn> 1 </mn>
          <mn> 4 </mn>
        </mfrac>
        <menclose class="MathML-Blank" notation="circle">
          <mspace width="1em" height="0.8em" depth="0.2em"/>
        </menclose>
        <mfrac>
          <mn> 2 </mn>
          <mn> 3 </mn>
        </mfrac>
      </mrow>
    </math>
  </li>
</ol>

1.4 Rendering and Editing

Blanks on HTML Pages

NOTE: This section is in progress, it will discuss how this would work in an HTML page that would use an editor that allowed filling in the blank.

The markup proposed in this note is expected to be compatible with HTML5/JavaScript environments in use in many contemporary Web browsers. MathML is part of HTML5 and this note assumes that math editors that take advantage of MathML support in browsers will exist in the future (many prototypes already exist). Other environments may choose to take a different approach.

Web page designers should attempt to make a blank clearly identifiable to readers so they know what to do to start editing the formula. The primary idea is to make it possible to move the focus to the blank; this can be done by the addition of a JavaScript handler such as an onclick or onkeypress event to the blank. When triggered, the script can replace the blank by an entry form of some type. To facilitate dealing with the result, the blank should be tagged with an id attribute and result of the user editing should be part of a form that is readily identifiable.

In many cases, an answer will be a simple number, identifier, or linear expression and a text input box will suffice. In this case, a standard <form> and <input type="text"> could be used.

In other cases, support for mathematical text entry is required. The example below presupposes that there exists an object editor with a JavaScript function 'mathEdit' which causes a math editor to run which stores the answer as a MathML expression in the value field of the input element of the corresponding name. The math editor is assumed to be aware of the MathML-Blank conventions described in this note.

A common technique hides in input elements the MathML content so that it can be processed by a form submission and a server can be reached with the formulae that the user has entered. We recommend that the value of the id attribute be used as the value of the name attribute of the corresponding hidden input element. An example is shown below:

<form action="postAnswer" method="GET">
  <p>Please express 0.375 as fraction.</p>
  <p align="center">
  <math displaystyle="true">
    <mfrac>
      <menclose notation="box"
        id="numerator" class="MathML-Blank" title="click to edit"  
        onclick="return editor.mathEdit(this);">
         <mspace width="1em" height="1em"/>
      </menclose >
      <menclose notation="box"
        id="denominator" class="MathML-Blank" title="click to edit"  
        onclick="return editor.mathEdit(this);">
         <mspace width="1em" height="1emx"/>
      </menclose >
    </mfrac>
  </math>
  </p>
    <input type="hidden" name="numerator" value="..."/>
    <input type="hidden" name="denominator" value="..."/>
  <p align="right"><input type="submit" value="go"/></p>
  <script type="text/javascript" src="blankEditor.js"></script>
</form>

Because a user may want to come back and edit an answer, it is recommended that any entry should serve as the default value should the user activate the “blank” again.

Aural rendering

Although specific uses of blanks may have specific ways of being spoken, in general, the important thing to convey is that the notation represents a blank, not the notation itself. For example, if someone is suppose to fill one of ‘<’, ‘=’, or ‘>’, in a problem, it probably doesn't matter whether the blank is an underline, is circled, or is just some white space. With the use of the class attribute, it is easy for aural renderers to say “blank” and skip the details of how the blank is represented in an expression such as “5 _ 6”.

1.5 Open Questions

This draft note is incomplete, so we would appreciate comments on the ideas presented in the draft note. In particular, do the ideas presented work for:

  • web-site authors?
  • makers of authoring software?
  • makers of server software?

Also, we are looking for feedback on:

  • Is it reasonable to author?
  • Is it interoperable with various browsers and in non-browser contexts?
  • What improvements can be made?

Another open question is about the use of content of the blank element: should it be:

  • the default value, which is potentially returned once the question is answered?
  • a hidden value which is only used to measure the size of the blank so that the user has enough space to input a reasonable answer?
  • a default value (such as “...” or “?” that should be removed right away when the user starts editing?