Text-based math standards
Math On Webpages CG

Text-based math standards

Note: this effort is currently on due to lack of community interest. If you are interested in helping, let us know on GitHub, the mailing list or directly to the CG Chairs.

Context

There is a split in the world of maths. On the one side you have math applications which do calculations. These applications typically use a text based standard which is easy for humans to type and easy for machines to parse and evaluate. On the other side you have applications which are about rendering maths for representation on the web or in printed form. This requires a much more rich and flexible standard to allow for all sorts of specific layouts of formulas, think of LaTeX or MathML.

It would be awesome if we had a single standard that could bridge these two sides: mathematical representation and calculation. This could give interoperability a boost since it would make it easy to have all sorts of cross-referencing between applications doing either calculation or representation of maths. It could make printed maths interactive, and add visual representations to math applications.

Requirements for such a standard would include:

Let’s shortly see how some standards do against these criteria:

Overview

This section shows the text based syntax of a number of well known math applications. They all show how the quadratic formula looks like in a text format:

Quadratic formula

Image source: Wikipedia

LaTeX

LaTeX website

LaTeX, a document preparation system, is used a lot in the academic world to write scientific documents. LaTeX is very strong in describing math for displaying/publication purposes.

The quadratic formula is represented as:

    x = \frac{ { - b \pm \sqrt {b^2 - 4ac} } } { {2a} }

LibreOffice formula editor

Book on the formula editor (2013)

A formula editor which allows to enter formulas both in text and visually.

The quadratic formula would be represented like:

    x = {-b +- sqrt(b^2 – 4ac)} over {2a}

AsciiMath

AsciiMath

A math standard

The quadratic formula is represented as:

    x=(-b +- sqrt(b^2 – 4ac))/(2a)

MathSON

MathSON draft

A draft for a JSON based math standard

The quadratic formula is represented as:

    ["x=", { "numer": ["-b±", { "sqrt": ["b", { "sup": ["2"] }, "-4ac"] }], "denom": ["2a"] }]

Mathematica, Matlab, Octave, mathjs

Mathematica website
Matlab website
Octave website
mathjs website

Matlab, Mathematica, and Octave are well known math applications. Mathjs is a math library for browsers and node.js.

The quadratic formula would be represented like:

    x1 = (-b + sqrt(b^2 - 4*a*c) / (2 * a)
    x2 = (-b - sqrt(b^2 - 4*a*c) / (2 * a)

Maple

Maple

Maple is a math application too, but is capable of visually rendering the entered input or results.

Maple code example

Image source: StackExchange

Microsoft Excel

Spreadsheet application

Quadratic formula:

    = (-b + SQRT(b^2 - 4*a*c) / (2 * a)
    = (-b - SQRT(b^2 - 4*a*c) / (2 * a)

MathJSON

A JSON-based format to represent math formulas.

MathJSON

The quadratic formula in MathJSON:

["Equal", "x", [
   "Divide", 
   ["PlusMinus", ["Negate", "b"], ["Sqrt", ["Minus", ["Power", "b", 2], ["Multiply", 4, "a", "c"]]]],
   ["Multiplpy", 2, "a"]
]]