UserJS processor for MathML

UserJS processor for MathML may be used to simulate support for presentational MathML in Opera 9. To make it work, all you need is to set up UserJS directory and place mathml.js there.

Download

*) alpha only, latest builds of Opera 9.50 already have MathML support

Examples

After you enable UserJS you can try the following examples.

How to enable UserJS

In Opera 9 UserJS directary can be specified in "User Javascript files" box located in "JavaScript Options" (view>preferences>advanced>content).

How to disable mathml.js

If you need to disable UserJS for MathML, either rename it to mathml.txt or just delete it.

List of suported elements

UserJS supports essential part of presentational MathML and a few content elements (matrix and piecewise constructions). It modifies document tree before applying style sheets. Formatting of radical signs, stretchy fences and accents is not properly implemented yet, but they should be readable.

Support for MathML 2.0 Presentational Markup1
ElementsAttributes
ElementSupportedAttributeValuesDefault
maction2Yesactiontype(highlight | statusline | toggle | tooltip)#REQUIRED
maligngroupNo   
malignmarkNo   
mathYesdisplay(block | inline)inline
xmlnshttp://www.w3.org/1998/Math/MathML#REQUIRED
mencloseNo   
merrorYes   
mfencedYesopenCDATA(
closeCDATA)
separatorsCDATA,
mfracYeslinethickness(0 | 1 | 2 | 3| thin | medium | thick)1
mglyph3NoaltCDATA#REQUIRED
miYesmathvariant(normal|bold|italic|bold-italic|sans-serif|bold-sans-serif|sans-serif-italic|sans-serif-bold-italic|monospace)italic4
mlabeledtrNo   
mmultiscripts5Yes   
mnYesmathvariant(normal|bold|italic|bold-italic|sans-serif|bold-sans-serif|sans-serif-italic|sans-serif-bold-italic|monospace)normal
mo6Yesmathvariant(normal|bold|italic|bold-italic|sans-serif|bold-sans-serif|sans-serif-italic|sans-serif-bold-italic|monospace)normal
moverYes   
mpaddedNo   
mphantomYes   
mrootYes   
mrowYes   
msYesmathvariant(normal|bold|italic|bold-italic|sans-serif|bold-sans-serif|sans-serif-italic|sans-serif-bold-italic|monospace)normal
lquoteCDATA"
rquoteCDATA"
mspace7Nolinebreak(auto | newline | indentingnewline | goodbreak)auto
msqrtYes   
mstyleNo   
msubYes   
msubsupYes   
msupYes   
mtableYes   
mtdYes   
mtextYesmathvariant(normal|bold|italic|bold-italic|sans-serif|bold-sans-serif|sans-serif-italic|sans-serif-bold-italic|monospace)normal
mtrYes   
munderYes   
munderoverYes   
ElementSupportedAttributeValuesDefault
ElementsAttributes
  1. This table applies to the latest version of mathml.js for Opera 9.50 alpha
  2. The 'selection' attribute is not supported, action types 'statusline' and 'tooltip' are handled identically, action type 'toggle' intertwines first two children.
  3. Element is not supported, content of 'alt' attribute is displayed instead.
  4. Default style is italic if content is single character and normal otherwise.
  5. Multiscripts are always stacked.
  6. Size of N-ary operators is increased. Limited number of accents is recognized and roughly rendered using CSS.
  7. Value 'indentingnewline' is handled as 'newline'.

Document conformance

In case if UserJS does not recognize MathML formulae on your page, make sure that the following requirements are satisfied

  1. Any entity reference (excluding predefined ones & < > " ') should be declared in internal DTD subset before any external entity (never rely on entities defined in external DTDs).
  2. XHTML documents with MathML content should be served as application/xhtml+xml, application/xml or text/xml and not text/html.
  3. MathML elements should be placed in namespace http://www.w3.org/1998/Math/MathML that can be declared either explicitly in markup or supplied via default attribute value declared in internal DTD subset (never rely on default attribute declarations in external DTDs)

Feedback

Any remarks, suggestions, bug reports and feature requests relevant to present UserJS can be posted on UserJS forum.