Next Up Previous Contents
Next: 4.11 Output depending on media type
Up: 4 The structure of the document
Previous: 4.9 Text markup
[ID index][Keyword index]

4.10 Maths

Includes m, mequation, meqnarray, mlabel, mline, mdefs.

All the maths in Starlink documents uses LaTeX notation.[Note 6] The `m' element is equivalent to $...$, `mequation' is equivalent to \begin{equation} ... \end{equation} and `meqnarray' is equivalent to \begin{eqnarray} ... \end{eqnarray}, with the exception that the `meqnarray' elements contains a sequence of `mline' elements, rather than having the equation lines separated by \\ commands.

Within the `mequation' and `mline' elements, you may have a single `mlabel' element. If this is present, the equation is numbered, and if you give it an ID, you can refer to that equation number from elsewhere.

Note that, although the parser `knows' that the content of these elements is in LaTeX notation there is no suppression of markup-recognition within them - entity references and element start-tags are still recognised as such by the parser.

When you are typing maths, switch your brain completely into LaTeX-mode, and do not use SGML entity references for things like ampersands, backslashes and the like. If you do use these, they will generally appear to work, in the sense that your document will process without errors, but the results will be different from what you expect[Note 7]. When you are typing maths, therefore, you have to make sure you do not type anything the SGML parser thinks it ought to pay attention to. That means that occurrences of & and < should not look like entity references or tags. SGML recognises these bits of markup only in context: only if an ampersand or less-than symbol is immediately followed by a name-start character (an upper- or lowercase letter) is it recognised as an entity reference or element start-tag (so that none of `& x;', `< x>' and `</ x>' are recognised as entity references or tags). Thus the following element is correctly formed:

<meqnarray><mline>x&\sim& a<mline>\delta&=&4< x</meqnarray>
Rather than worrying about the details of this rule, however, the best practice when typing meqnarray elements is to reflexively put a space after all occurrences of & and <: this will keep the SGML parser from interfering, and make no difference to LaTeX, which ignores all spaces in maths mode anyway.

Alternatively, you can surround the maths element with a CDATA marked section (see Section 3.5.1). That's more typing, but switches off SGML recognition completely:

<meqnarray>
<mline><![CDATA[    a<b<c&\sim&x    ]]>
<mline>x & = & y
</meqnarray>
Hmm - typing a few extra spaces won't hurt you.

If you need or wish to make some definitions which are to be effective in all sucessive maths elements - for example you want to write the abbreviation \def\degs{^\circ} - you can put them in an mdefs element. This sits between or before paragraphs.

The contents of the mdefs element are processed as arbitrary LaTeX. However, you should not include anything other than definition commands and possibly other parameters to do with the layout of maths, and specifically you should write nothing which creates any output. Although this element is processed fairly straightforwardly when generating LaTeX output, the content is moved around quite a lot when producing HTML output, and hacky fiddling here has the potential to mess up your document in the present and, what is much worse, become wrong when processed by a later version of the down-converter. In other words: Do Not Hack This!


Next Up Previous Contents
Next: 4.11 Output depending on media type
Up: 4 The structure of the document
Previous: 4.9 Text markup
[ID index][Keyword index]
The Starlink SGML Set
Starlink System Note 70
Norman Gray, Mark Taylor
21 April 1999. Release DR-0.7-13. Last updated 24 August 2001