A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members) or send an e-mail to admin@wiki.whatwg.org with your desired username and an explanation of the first edit you'd like to make. (Do not use this e-mail address for any other inquiries, as they will be ignored or politely declined.)

Note: This wiki is used to supplement, not replace, specification discussions. If you would like to request changes to existing specifications, please use IRC or a mailing list first.

Equations in HTML

From WHATWG Wiki
Jump to: navigation, search

This document is obsolete.

For the current specification, see: HTML Standard: MathML


Here are some ideas for how to include equations in HTML documents.

Candidates

Full MathML:

<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi>
 <mo>=</mo>
 <mfrac>
  <mrow>
   <mo>-</mo>
   <mi>b</mi>
   <mo>&PlusMinus;</mo>
   <msqrt>
    <msup>
     <mi>b</mi>
     <mn>2</mn>
    </msup>
    <mo>-</mo>
    <mn>4</mn>
    <mo>&InvisibleTimes;</mo>
    <mi>a</mi>
    <mo>&InvisibleTimes;</mo>
    <mi>c</mi>
   </msqrt>
  </mrow>
  <mrow>
   <mn>2</mn>
   <mo>&InvisibleTimes;</mo>
   <mi>a</mi>
  </mrow>
 </mfrac>
</math>
<math xmlns="http://www.w3.org/1998/Math/MathML">
 <mi>x</mi> <mo>=</mo>
 <mfrac>
  <mrow>
   <mo>-</mo> <mi>b</mi> <mo>&PlusMinus;</mo>
   <msqrt>
    <msup>
     <mi>b</mi> <mn>2</mn>
    </msup>
    <mo>-</mo> <mn>4</mn> <mo>&InvisibleTimes;</mo> <mi>a</mi> <mo>&InvisibleTimes;</mo> <mi>c</mi>
   </msqrt>
  </mrow>
  <mrow>
   <mn>2</mn> <mo>&InvisibleTimes;</mo> <mi>a</mi>
  </mrow>
 </mfrac>
</math>

MathML with optional end tags:

<math>
 <mi>x <mo>=
 <mfrac>
  <mrow>
   <mo>- <mi>b <mo>&PlusMinus;
   <msqrt>
    <msup> <mi>b <mn>2
    <mo>- <mn>4 <mo>&InvisibleTimes; <mi>a <mo>&InvisibleTimes; <mi>c
   </msqrt>
  </mrow>
  <mrow>
   <mn>2 <mo>&InvisibleTimes; <mi>a
</math>

Rejected

MathML, but with <mo>, <mi>, and <mn> implied:

<math>
 x =
 <mfrac>
  <mrow>
   - b &PlusMinus;
   <msqrt>
    <msup> b 2 </msup>
    - 4 &InvisibleTimes; a &InvisibleTimes; c
   </msqrt>
  </mrow>
  <mrow>
   2 &InvisibleTimes; a
  </mrow>
 </mfrac>
</math>


LaTeX:

<math>x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}</math>


Research

Only presentational MathML:

Content MathML, converted to Presentational MathML using XSLT and/or script: