W3C home > Mailing lists > Public > whatwg@whatwg.org > June 2006

[whatwg] Mathematics in HTML5

From: Michel Fortin <michel.fortin@michelf.com>
Date: Fri, 2 Jun 2006 11:16:48 -0400
Message-ID: <F0C5EDD4-88E7-4F24-87F6-AD44E0218671@michelf.com>
Le 2 juin 2006 ? 5:08, White Lynx a ?crit :

> 1) Which markup do you think fits better in the scope of HTML5?
> 	a)
> 		<div>
> 		(X)HTML document may contain math formulae, like
> 		<formula>
> 		ax<sup>2</sup> + bx + c = 0
> 		</formula>
> 		</div>

While this may be better than the MathML counterpart, I'd prefer this  
markup:

     <p>
     (X)HTML document may contain math formulae, like
     <formula>
     <var>a</var><var>x</var><sup>2</sup> +
     <var>b</var><var>x</var> + <var>c</var> = 0
     </formula>
     </p>

It's more verbose than what you suggested, but still way simpler than  
MathML.

The advantage of this notation is that a software tool could deduce  
the semantics using the following rules:

*   Each <var> element represents a variable (permitting words to be
     used as variable when appropriate).
*   <sup> contains the exponent of the preceding element or number.

By understanding "+" and "=" as operators, "0" as a number and by  
applying the usual operator precedence, a tool could convert that to  
something understandable by other math software.

Of course, people could still write equations in a non-verbose/non- 
semantical way, without <var>, but nothing is going to prevent that  
anyway. What's interesting is that if you forget some <var> tags, you  
notice it immediately from the browser rendering as the variables  
aren't italic. There is tag with "invisible" effect.

The other point I'd like to make is that a formula element shouldn't  
be required for all mathematical expressions. If I want talk about  
variable x in the middle a paragraph, I shouldn't need to surround it  
like this: <formula><var>x</var></formula>. Using <var>x</var> ought  
to be suffisent. The same applies if I want to include x^2 in the  
text, <var>x</var><sup>2</sup> should be enough.

<formula> could be used however for more important formulas, those  
which are alone and centered on their line in the typical math or  
science book. Indeed, it would provide a CSS hook to do just that,  
which means that, again, there is tag with "invisible" effect.


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/
Received on Friday, 2 June 2006 08:16:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:27 UTC