Skip to content

Latest commit

 

History

History
114 lines (83 loc) · 4.01 KB

notes-fund.md

File metadata and controls

114 lines (83 loc) · 4.01 KB

Notes on MathML fundamentals

Length Valued Attributes in MathML.

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 as 200%. 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 to veryverythickmathspace 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 to lspace="0.278em rspace=".278em and this form is preferred, for compatibility with MathML Core.

  • pseudo-units <mpadded> allows additional units height, depth, width In the usual case where width 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 to width 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 as 3em but as an increase in 3em 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

Web links in MathML.

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

sin

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

1/2

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.