4.4 Scripts and Limits

 < Day Day Up > 



4.4 Scripts and Limits

Presentation markup includes several elements to represent expressions involving scripts and limits. This section provides a detailed description of all such elements.

Subscripts and Superscripts

Subscripts and superscripts are indicated using the msub and msup elements, respectively. The syntax of msub is:

    <msub> base subscript </msub> 

Here is an example of a subscript:

ai

    <msub>      <mi>a</mi>      <mi>i</mi>     </msub> 

The msub element has one attribute called subscriptshift. This specifies the minimum amount by which the subscript should be shifted down relative to the baseline of the base expression.

The syntax of msup is:

    <msup> base superscript </msup> 

Here is an example of a superscript:

x2

    <msup>      <mi>x</mi>      <mn>2</mn>     </msup> 

The msup element has one attribute called superscriptshift. This specifies the minimum amount by which the superscript should be shifted up relative to the baseline of the base expression.

MathML also provides an additional element called msubsup. This is used to attach both a subscript and a superscript to a base expression. It has the following syntax:

    <msubsup> base subscript superscript </msubsup> 

The msubsup element accepts both subscriptshift and superscriptshift as attributes. Here is an example of msubsup's use:

Aji

    <msubsup>      <mi>A</mi>      <mi>i</mi>      <mi>j</mi>     </msubsup> 

Underscripts and Overscripts

Underscripts and overscripts are represented using the munder and mover elements, respectively. The syntax of munder is as follows:

    <munder> base underscript </munder> 

The munder element has one attribute called accentunder. If this is set to true, the underscript is treated like an accent and if false like a limit. Accents are rendered in normal size and closer to the base; on the other hand, limits are rendered in a smaller size and farther away from the base. The following example shows an underscript rendered as an accent:

    <mrow>      <munder accentunder="true">        <mrow>          <mn>1</mn>          <mo>+</mo>          <mn>2</mn>          <mo>+</mo>          <mo>&ctdot;</mo>          <mi>n</mi>        </mrow>        <mo>&UnderBrace;</mo>      </munder>     </mrow> 

If the base is an mo element with movablelimits="true" and displaystyle="false", then the underscript is rendered as a subscript and the accentunder attribute is ignored.

The syntax of mover is:

    <mover> base overscript </mover> 

The mover element has one attribute: accent. If this is set to true, the overscript is treated like an accent and if false like a limit. Accents are rendered in normal size and closer to the base, whereas limits are rendered in a smaller size and farther away from the base. The following example shows an overscript rendered as an accent:

    <mover accent="true">      <mi>x</mi>      <mo>&Hat;</mo>     </mover> 

The following example shows an overscript rendered as a limit:

    <mover accent="false">      <mi>x</mi>      <mo>&Hat;</mo>    </mover> 

If base is an operator with movablelimits="true" and displaystyle="false", then the overscript is rendered as a superscript and the accent attribute is ignored.

In addition, MathML provides the munderover element for attaching both an underscript and overscript to a base expression. This produces a better visual appearance than if you use separate munder and mover elements. This is because the vertical spacing of the underscript and overscript is more symmetrical relative to the base and both the scripts follow the slant of the base. This element has the following syntax:

    <munderover> base underscript overscript </munderover> 

Here is an example of its use:

    <mrow>      <munderover>        <mo>&int;</mo>        <mi>a</mi>        <mi>b</mi>      </munderover>      <mi>f</mi>      <mo>&ApplyFunction;</mo>      <mrow>        <mo>(</mo><mi>x</mi><mo>)</mo>      </mrow>      <mo>&DifferentialD;</mo><mi>x</mi>     </mrow> 

The munderover element accepts both accent and accentunder as attributes. If the base is an operator with movablelimits="true" and displaystyle="false", then the underscript is rendered as a subscript, the overscript is rendered as a superscript, and the accent attribute is ignored.

Multiscripts

Another common type of notation involves objects that have multiple subscripts and superscripts attached to the base expression. This type of notation is used, for example, to represent tensors such as Tbca. MathML provides the mmultiscripts element specially for this type of notation. This element can be used to attach any number of vertically aligned pairs of subscripts and superscripts to a base expression. It allows you to attach both prescripts and postscripts-notation to the left and right of the base expression, respectively.

The syntax for this element is:

     <mmultiscripts> base     (subscript superscript)*     [<mprescripts/> (presubscript presuperscript)*]      </mmultiscripts> 

The important points to note about the mmultiscripts element are as follows:

  • Subscripts are always listed before the corresponding superscript in each subscript-superscript pair.

  • If one of the members of a subscript-superscript pair is missing, its position must be explicitly indicated using the empty element none

  • The empty element mprescripts must be inserted before you specify any subscript-superscript pairs that occur in the prescript position.

  • Prescripts are specified after postscripts since prescripts are relatively uncommon.

  • Both prescript and postscript pairs are listed in left-to-right order.

Here is an example:

    <mmultiscripts>      <mi>T</mi>      <mi>b</mi><mi>a</mi>      <mi>c</mi><none/>      <mprescripts/>      <mi>1</mi><none/>      <mi>2</mi><mi>3</mi>     </mmultiscripts> 

The mmultiscripts element has two attributes: subscriptshift and superscriptshift. These specify the minimum amount by which a superscript or subscript should be shifted up or down relative to the baseline of the base expression, respectively.

Changes to displaystyle and scriptlevel

It is conventional for characters placed in a script position to appear in a smaller font than the base expression. To satisfy this convention, the presentation elements that represent scripts automatically change the value of two attributes of the mstyle element, displaystyle and scriptlevel. Normally, these are inherited from the environment. These changes are summarized here:

  • The msub element sets displaystyle to false and increments scriptlevel by 1 in subscript but leaves both attributes unchanged within base.

  • The msup element sets displaystyle to false and increments scriptlevel by 1 in superscript but leaves both attributes unchanged within base.

  • The msubsup element sets displaystyle to false and increments scriptlevel by 1 in both subscript and superscript but leaves both attributes unchanged within base.

  • The munder element sets displaystyle to false in underscript and increments scriptlevel by 1 only when accentunder="false". It leaves both attributes unchanged within base.

  • The mover element sets displaystyle to false in overscript and increments scriptlevel by 1 only when accent="false". It leaves both attributes unchanged within base.

  • The munderover element sets displaystyle to false in overscript and increments scriptlevel by 1 only when accent="false". It sets displaystyle to false in underscript and increments scriptlevel by 1 only when accentunder="false". It leaves both attributes unchanged within base.

  • The mmultiscripts element increments scriptlevel by 1 and sets displaystyle to false in all its arguments except the base.

For more details about the displaystyle and scriptlevel attributes, see the discussion of the mstyle element in Section 4.3.



 < Day Day Up > 



The MathML Handbook
The MathML Handbook (Charles River Media Internet & Web Design)
ISBN: 1584502495
EAN: 2147483647
Year: 2003
Pages: 127
Authors: Pavi Sandhu

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net