[whatwg] Mathematics in HTML5

Michel Fortin michel.fortin at michelf.com
Fri Jun 2 08:16:48 PDT 2006

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  

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

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

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

More information about the whatwg mailing list