Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

Mathematical formulas


    1  Special characters
    2  Examples
       2.1  Basic example
       2.2  A square root
       2.3  A fraction
       2.4  A multiplication sign
       2.5  A formula with parenthesis
       2.6  An integral
       2.7  A sum
       2.8  A matrix
       2.9  A complex formula
    3  See also

The "math" element allows to add math formulas. The syntax of the formula must conform to the MathML2 syntax, which is an XML-based way of describing mathematical formulas.

This article present an overview of the MathML2 syntax.

Special characters

Main Article: HTML entities list

Mathematical characters are not ASCII. Therefore you should escape these characters. For example:
  • "−": the mathematical minus character (−)
  • "×": the multiplication sign (×) character
  • "±" or "±": the plus or minus character (±)
  • "∈" or "∈": the element of character (∈)
  • "∏" or "∏": the ary product (∏) character
  • "√" or "√": the square root (√) character
  • "∞" or "∞": the infinity (∞) character
  • "∫" or "∫": the integral (∫) character
  • "∑" or "∑": the sum (∑) character

Examples

Basic example

  <math>
     <mi>a</mi>
     <msup>
        <mi>x</mi>
        <mn>2</mn>
     </msup>
  </math>
Result:

__math__0

A square root

  <math>
     <msqrt>
        <mi>x</mi>
        <mo>+</mo>
        <mi>y</mi>
     </msqrt>
  </math>
Result:

__math__1

A fraction

  <math>
     <mrow>
        <mfrac>
           <mrow>
              <mi>a</mi>
           </mrow>
           <mrow>
              <mi>b</mi>
           </mrow>
        </mfrac>
        <mo>=</mo>
        <mi>c</mi>
     </mrow>
  </math>
Result:

__math__2

A multiplication sign

  <math>
     <mi>a</mi>
     <mo>&times;</mo>
     <mi>b</mi>
  </math>
Result:

__math__3

A formula with parenthesis

  <math>
     <mi>a</mi>
     <mfenced>
        <mrow>
           <mi>b</mi>
           <mo>-</mo>
           <mi>c</mi>
        </mrow>
     </mfenced>
  </math>
Result:

__math__4

An integral

  <math>
     <mrow>
        <munderover>
           <mo>&int;</mo>
           <mn>-1</mn>
           <mn>+1</mn>
        </munderover>
        <mfrac>
           <mrow>
              <mi>d</mi>
              <mi>x</mi>
           </mrow>
           <mi>x</mi>
        </mfrac>
     </mrow>
  </math>
Result:

__math__5

A sum

  <math>
     <mrow>
        <munderover>
           <mo>&sum;</mo>
           <mrow>
              <mi>n</mi>
              <mo>=</mo>
              <mn>1</mn>
           </mrow>
           <mrow>
              <mn>5</mn>
           </mrow>
        </munderover>
        <mrow>
           <msup>
              <mrow>
                 <mi>n</mi>
              </mrow>
              <mrow>
                 <mn>2</mn>
              </mrow>
           </msup>
        </mrow>
     </mrow>
  </math>
Result:

__math__6

A matrix

  <math>
     <mrow>
        <mfenced open="[" close="]">
           <mrow>
              <mtable>
                 <mtr>
                    <mtd>
                       <mi>a</mi>
                    </mtd>
                    <mtd>
                       <mi>b</mi>
                    </mtd>
                 </mtr>
                 <mtr>
                    <mtd>
                       <mi>c</mi>
                    </mtd>
                    <mtd>
                       <mi>d</mi>
                    </mtd>
                 </mtr>
              </mtable>
           </mrow>
        </mfenced>
     </mrow>
  </math>
Result:

__math__7

A complex formula

  <math>
     <mi>x</mi>
     <mo>=</mo>
     <mrow>
        <mfrac>
           <mrow>
              <mo>&#x2212;</mo>
              <mi>b</mi>
              <mo>&#x00B1;</mo>
              <msqrt>
                 <msup>
                    <mi>b</mi>
                    <mn>2</mn>
                 </msup>
                 <mo>-</mo>
                 <mn>4</mn>
                 <mi>a</mi>
                 <mi>c</mi>
              </msqrt>
           </mrow>
           <mrow>
              <mn>2</mn>
              <mi>a</mi>
           </mrow>
        </mfrac>
     </mrow>
  </math>
Result:

__math__8

See also


Categories: syntax

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.