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 Chat (such as one of these permanent autoconfirmed members).

Equations in HTML: Difference between revisions

From WHATWG Wiki
Jump to navigation Jump to search
(New page: Here are some ideas for how to include equations in HTML documents. == Candidates == <pre> <math xmlns="http://www.w3.org/1998/Math/MathML"> <mi>x</mi> <mo>=</mo> <mfrac> <mrow> <...)
 
(+spec)
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{obsolete|spec=[http://www.whatwg.org/specs/web-apps/current-work/multipage/the-map-element.html#mathml HTML Standard: MathML]}}
Here are some ideas for how to include equations in HTML documents.
Here are some ideas for how to include equations in HTML documents.


== Candidates ==
== Candidates ==
Full MathML:
<pre>
<pre>
<math xmlns="http://www.w3.org/1998/Math/MathML">
<math xmlns="http://www.w3.org/1998/Math/MathML">
Line 8: Line 11:
  <mfrac>
  <mfrac>
   <mrow>
   <mrow>
   <mrow>
   <mo>-</mo>
    <mo>-</mo>
  <mi>b</mi>
    <mi>b</mi>
  </mrow>
   <mo>&PlusMinus;</mo>
   <mo>&PlusMinus;</mo>
   <msqrt>
   <msqrt>
Line 19: Line 20:
     </msup>
     </msup>
     <mo>-</mo>
     <mo>-</mo>
     <mrow>
     <mn>4</mn>
    <mn>4</mn>
    <mo>&InvisibleTimes;</mo>
    <mo>&InvisibleTimes;</mo>
    <mi>a</mi>
    <mi>a</mi>
    <mo>&InvisibleTimes;</mo>
    <mo>&InvisibleTimes;</mo>
    <mi>c</mi>
    <mi>c</mi>
    </mrow>
   </msqrt>
   </msqrt>
   </mrow>
   </mrow>
Line 34: Line 33:
   </mrow>
   </mrow>
  </mfrac>
  </mfrac>
</math>
</pre>
<pre>
<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>
</pre>
MathML with optional end tags:
<pre>
<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>
</math>
</pre>
</pre>
Line 39: Line 75:
== Rejected ==
== Rejected ==


MathML, but with <mo>, <mi>, and <mn> implied:
<pre>
<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>
</pre>
LaTeX:
<pre>
<pre>
<math>x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}</math>
<math>x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}</math>
</pre>
</pre>
== Research ==
Only presentational MathML:
* http://mathcast.sourceforge.net/fields.xml
* http://www-math.mit.edu/18.013A/MathML/chapter06/section01.xhtml
* http://golem.ph.utexas.edu/category/
* http://pear.math.pitt.edu/mathzilla/Examples/markupOftheWeek.mhtml
* http://dlmf.nist.gov/Contents/GA/13/
Content MathML, converted to Presentational MathML using XSLT and/or script:
* http://www.math.uah.edu/stat/point/Sufficient.xhtml

Latest revision as of 16:06, 10 November 2012

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>±</mo>
   <msqrt>
    <msup>
     <mi>b</mi>
     <mn>2</mn>
    </msup>
    <mo>-</mo>
    <mn>4</mn>
    <mo>⁢</mo>
    <mi>a</mi>
    <mo>⁢</mo>
    <mi>c</mi>
   </msqrt>
  </mrow>
  <mrow>
   <mn>2</mn>
   <mo>⁢</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>±</mo>
   <msqrt>
    <msup>
     <mi>b</mi> <mn>2</mn>
    </msup>
    <mo>-</mo> <mn>4</mn> <mo>⁢</mo> <mi>a</mi> <mo>⁢</mo> <mi>c</mi>
   </msqrt>
  </mrow>
  <mrow>
   <mn>2</mn> <mo>⁢</mo> <mi>a</mi>
  </mrow>
 </mfrac>
</math>

MathML with optional end tags:

<math>
 <mi>x <mo>=
 <mfrac>
  <mrow>
   <mo>- <mi>b <mo>±
   <msqrt>
    <msup> <mi>b <mn>2
    <mo>- <mn>4 <mo>⁢ <mi>a <mo>⁢ <mi>c
   </msqrt>
  </mrow>
  <mrow>
   <mn>2 <mo>⁢ <mi>a
</math>

Rejected

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

<math>
 x =
 <mfrac>
  <mrow>
   - b ±
   <msqrt>
    <msup> b 2 </msup>
    - 4 ⁢ a ⁢ c
   </msqrt>
  </mrow>
  <mrow>
   2 ⁢ 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: