In [[MathML-Core]] all MathML length attributes are defined to have the CSS <length-percentage>
syntax. Although in MathML Core level 1 with restrictions on the
interpretation of %
.
MathML full extends the syntax in several ways:
-
Unitless values. A value such as
mathsize="2"
should be interpreted as200%
. This form is for compatability with early versions of MathML and was already deprecated in MathML 3. It should be avoided in new documents. -
Named spaces. MathML has 7 named length values ranging from
veryverythinmathspace
toveryverythickmathspace
and their negative space equivalents. Originally these were implemenation defind but [[MathML4]] specifies them as multiples of 1/18 em. (Multiples 1/18 … 7/18 and −1/18 … −7/18.)so
lspace="thickmathspace
rspace="thickmathspace
are equivalent tolspace="0.278em
rspace=".278em
and this form is preferred, for compatibility with MathML Core. -
pseudo-units
<mpadded>
allows additional unitsheight
,depth
,width
In the usual case wherewidth
is used when setting the new width, this is equivalent to using a percentage value. Possible uses such as forcing a square by setting the height towidth
are not easily supported using the CSS length syntax but can usually be avoided. -
Length Increments In MathML 3,
<mpadded>
attributes had a special inerpretation for leading+
or-
signs in lengths, a length of+3em
was not interpreted as3em
but as an increase in3em
over the default value. This interpretation is problematic in any context (including CSS) where lengths may be calculated, as it assumes control over the exact form used to write out the value. need to decide what to say here
There is often a requirement to have hyperlinks in MathML, just as in
HTML documents. [[MathML2]] proposed using the [[xlink]] system to add
linking attributes. XLink is heavily based on XML Namespace markup and
so is not supported in HTML based systems. [[MathML3]] specified that
href
attributes could be used on any MathML element to specify a URL
be used as a link. Hopefully some version of this syntax will be
supported in level 2 of [[Mathml-Core]] but for technical reasons it
wasn't possible to include any linking in level 1 of MathML Core.
As for most features of MathML not directly supported in MathML Core,
Polyfills will
be provided, to allow authors to use the MathML href
attribute,
howevr some authors may prefer to generate MathML Core documens not
requiring polyfills, in which case they need to use HTML or JavaScript
to implement linking.
Perhaps the most common case is a token element acting as a link.
<mi href="https://example.com/sin">sin</mi>
which should render as
In MathML Core this can be encoded with a nested HTML element:
<mi><a href="https://example.com/sin">sin</a></mi>
Or, if using an XML parser, also making the HTML namespace explicit:
<mi><a xmlns="http://www.w3.org/1999/xhtml"
href="https://example.com/sin">sin</a></mi>
If the link text is not a single token elment, supporting the link using MathML Core level 1 is a bit more complicated and perhaps most simply implemented using JavaScript.
<mfrac href="https://example.com/half">
<mn>1</mn>
<mn>2</mn>
</mfrac>
Should render something like
This could be marked up in MathML Core as
<mfrac
style="text-decoration:underline;cursor:pointer"
onclick="location.href='https://example.com/half'">
<mn>1</mn>
<mn>2</mn>
</mfrac>
Naturally the CSS could be specified in a separate CSS file, but shown
inline using a style
attribute here to make a self contained example.