Re: Inserting text with MathML

Hi Derek,

There are basically two ways to integrate math and text.  The first
way is to mix the MathML with some other document oriented markup
language like HTML.  Thus,
your example would get encoded as

<html>
...
<body>
...
<p>What does <math>....</math> calculate to?</p>
...
</body>
</html>

The up side is that this is really how MathML is intended to be used.
The down side is that it is a pain to get a browser to display this
properly.  As you presumably know, to display this with WebEQ you
would need to pass the MathML as a parameter in an applet tag, and
getting the dimension of the applet to match the equation is a pain.

The alternative is to abuse the MathML <mtext> element, and force the
surrounding text to be part of the equation.


<math>
  <mtext>What does </mtext>
  <msqrt>
    <mrow>
      <mn>1</mn>
      <mo>-</mo>
      <mn>2</mn>
      <mi>x</mi>
      <mo>+</mo>
      <msup>
        <mi>x</mi>
        <mn>2</mn>
      </msup>
    </mrow>
  </msqrt>
  <mtext> calculate to ?</mtext>
</math>


The up side of this method is that then your question is self
contained, and can be displayed in a single applet or plug-in.  The
down side is that you will probably end up tweaking the spacing
between the text and the equation (using named spaces like &thinsp;
since plain whitespace in MathML gets telescoped), and it doesn't
scale very well.

Hope this helps.

--Robert

------------------------------------------------------------------
Robert Miner                                    RobertM@dessci.com
MathML 2.0 Specification Co-editor                    651-223-2883
Design Science, Inc.   "How Science Communicates"   www.dessci.com
------------------------------------------------------------------

Received on Wednesday, 11 April 2001 14:40:50 UTC