mathml

MathML markup of a symbolic expression.

Category: Code Generation

Syntax

s = mathml(expr)

Returns MathML (presentation markup) that describes expr.

Description

MathML is the XML standard for math on web pages. mathml builds the tree of <mi>, <mn>, <mo>, <msup>, <mfrac> and related elements for the expression, with indentation so that it can be read. Use latex instead when the target is a document or a MathJax page.

Input arguments

expr
Symbolic expression.

Output arguments

s
Character vector with an XML <math> element.

Example

A square

syms x
mathml(x^2)
Output
ans = 
    '<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'>
       <msup>
         <mi>x</mi>
         <mn>2</mn>
       </msup>
     </math>
     '

See also

latex pretty