<< Chapter < Page | Chapter >> Page > |
Mathematical notation requires scripting around a base entity. The MathML provides scripting capability through scripting elements : msub, msup and msubsup. Scripting in MathML is not limited only to putting a subscript or superscript around an expression, but vertically integrated upper and lower scripts, which are handy to display limits on integrals and to meet such other requirements of rendering structured display.
Rendering of script is done by manipulating certain attributes that elements acquire from the environment such as “xml” or “html” document.
$\begin{array}{l}{\text{Specific attributes : \hspace{1em}}}\left(\mathrm{superscriptshift,\; superscriptshift}\right)\end{array}$
Each of these scripting elements takes two arguments base and subscript, which may be valid MathML expressions. Syntax of the two elements are as given here :
<msub> base subscript </msub>
<msup> base superscript </msup>
Each of these scripting elements takes two arguments base and subscript, which may be valid MathML expressions. Implementation of “msub” element shifts the baseline of the script, while retaining that of the base. In the case of “msup” element, the baseline shifts the script up. In both cases, display style of the scripts are also changed
The amount of shifting can be specified by giving numerical values to “subscriptshift” and “superscriptshift” attributes preferably in "ex" unit. The example here demonstrates implementation of both “msup” and “msub” elements.
<m:math display="block">
<m:table>
<m:mtr>
<m:mtd>
<m:msup>
<m:mi> m </m:mi>
<m:mrow>
<m:mn> 1 </m:mn>
<m:mo> ⁣ </m:mo>
<m:mn> 2 </m:mn>
</m:mrow>
</m:msup>
</m:mtd>
</m:mtr>
<m:mtr>
<m:mtd>
<m:msub subscriptshift="1.5ex">
<m:mi> m </m:mi>
<m:mrow>
<m:mn> 1 </m:mn>
<m:mo> ⁣ </m:mo>
<m:mn> 2 </m:mn>
</m:mrow>
</m:msub>
</m:mtd>
</m:mtr>
</m:table>
</m:math>
Save the file after editing as “test.xml”. The display looks like :
$$\begin{array}{c}{m}^{12}\\ {m}_{12}\end{array}$$
Observe that
“⁣”
entity reference impart the meaning that scripts is read one two and not as one multiplied by 2.
$\begin{array}{l}{\text{Specific attributes : \hspace{1em}}}\left(\mathrm{subscriptshift},\mathrm{superscriptshift}\right)\end{array}$
The element takes three arguments. First argument of the element is base; second argument is subscript; and third argument is superscript. The syntax of the element is :
<msubsup> base subscript superscript </msubsup>
Scripting “msubsup” element affects simultaneous implementation of a subscript and superscript, which are vertically aligned. This is an extremely useful scripting element as this element can be used to display limit values on variety of expression, including an integral sign.
Notification Switch
Would you like to follow the 'A primer in mathml' conversation and receive update notifications?