Home

Daniel I. Scully

A Beginner's Guide to MathML

Tensors and Pre-scripts

Tensor notation

In the previous section we applied single sub-scripts and super-scripts to elements, but tensors require multiple indices. The element used to achieve this is <mmultiscripts>:

  1. <mmultiscripts>
  2. <mn>G</mn> <!-- the base -->
  3. <mi>i</mi> <!-- sub-script 1 -->
  4. <mi>j</mi> <!-- super-script 1 -->
  5. <mi>k</mi> <!-- sub-script 2 -->
  6. <mi>l</mi> <!-- super-script 2 -->
  7. <mi>m</mi> <!-- sub-script 3 -->
  8. <mi>n</mi> <!-- super-script 3 -->
  9. </mmultiscript>
G i j k l m n

The first tag inside the <mmultiscripts> is the base element, ie: the element to which the inices are being applied.

After the base comes sub-script super-script pairs, with the first pair appearing closest to the base element, and successive pairs getting further away.

When an element is not required in one of the sub-script or super-script pairs, the <none /> tag is used to take its place so that a pair is always provided:

  1. <mmultiscripts>
  2. <mn>G<.mn> <!-- the base -->
  3. <mi>i</mi> <!-- sub-script 1 -->
  4. <none />
  5. <mi>k</mi> <!-- sub-script 2 -->
  6. <mi>l</mi> <!-- super-script 2 -->
  7. <none />
  8. <mi>n</mi> <!-- super-script 3 -->
  9. </mmultiscript>
G i k l n

Pre-scripts

The <mmultiscripts> can be extended even further by adding pre-scripts.

When all the required sub-script super-script pairs have been added, insert the empty <mprescripts /> tag. Then follow it by more sub-script super-script pairs which will be rendered as pre-scripts from left to right. So the first pair will appear furthest from the base element and the last pair closest.

  1. <mmultiscripts>
  2. <mn>G<mn> <!-- the base -->
  3. <mi>i</mi> <!-- sub-script 1 -->
  4. <none />
  5. <mi>k</mi> <!-- sub-script 2 -->
  6. <mi>l</mi> <!-- super-script 2 -->
  7. <mprescripts />
  8. <none />
  9. <mi>a</mi> <!-- pre-super-script 1 -->
  10. <mi>b</mi> <!-- pre-sub-script 2 -->
  11. <mi>c</mi> <!-- pre-super-script 2 -->
  12. </mmultiscript>
G i k l a b c