A Beginner's Guide to MathML
Brackets
Brackets are an essential part of maths which while serving a functional purpose also significantly improve readability. In MathML they are included with the <mfenced> tag:
<mfenced>
<mfrac>
<mrow>
<mi>x</mi>
<mo>+</mo>
<mn>2</mn>
</mrow>
<mn>3</mn>
</mfrac>
</mfenced>
It is important (and somewhat irritating) to note that <mfenced> must contain exactly one child tag if it is simply to enclose the contents in brackets. If it contains more than one child tag, separators are inserted between them:
<mfenced>
<mn>3</mn>
<mn>5</mn>
<mn>4</mn>
</mfenced>
Using the 'open', 'close' and 'separator' attributes we can specify the paretheses and separators used:
<mfenced open="[" close="}" separators=":">
<mi>a</mi>
<mi>b</mi>
<mi>c</mi>
<mi>d</mi>
</mfenced>
The separator attribute can also accept a list if more than one type is required (eg: separators=":~*").
As an aside targeted at my other main interest: the physicists among you will notice that this is ideally suited to the 'bra-ket' notation of quantum mechanics:
<mfenced open="〈" close="〉" separators="|">
<mi>p</mi>
<mo>a</mo>
<mi>p`</mi>
</mfenced>