Details | Installation

# Add Math to Web pages with HP EzMath v1.1

Dave Raggett <dsr@w3.org>,
Davy Batsalle <batsalle@email.enst.fr>
25th Ocober 1998 The Web lacks an effective means for embedding mathematical expressions in Web pages. Hitherto, authors have been forced to use bitmapped images, which are slow to load, complex to produce, and look bad when printed.

EzMath provides an easy to learn notation for embedding mathematical expressions in Web pages. The notation is inspired by how expressions are spoken aloud together with a few abbreviations for conciseness (e.g. x^y denotes x raised to the power y).

EzMath covers a widely used subset of mathematics. EzMath focusses on the meaning of mathematical notation rather than just how it looks on paper (or screen). The EzMath editor makes it very easy to create the markup for pasting into your web pages, either in the EzMath notation or as MathML.

The full length paper on EzMath compares it with previous approaches and gives a definitive list of EzMath features. EzMath was developed by Dave Raggett and Davy Batsalle with the generous support of Hewlett Packard Laboratories. Suggestions for further work, and offers of help for porting to other platforms including ActiveX, and ideas for extensions to other areas of mathematics are welcomed.

A freeware implementation of EzMath is available now for Windows 95/NT, and support for other platforms is underway. You can download the editor, plugin and documentation as a zip file (137k) from:

http://www.w3.org/People/Raggett/ezmath1_1.zip

The Ezmath for the expression in the figure above is:

```        a^m over a^n = either a^{m-n} when m > n
or 1 when m = n or 1 over a^{n-m} when m < n
```

Some other examples:

```        ax^2+bx+c=0
integral from 0 to pi of sin ax wrt x
limit as x tends to infinity of function f(x)
matrix M = matrix (1,2;2,1)
```

The EzMath editor does all the work needed to markup this up in a form that will be recognized by your browser, you can then simply paste the markup into your HTML:

```        <embed type="text/ezmath"
pluginspage="http://www.w3.org/People/Raggett/EzMath"
align=absmiddle
width= 181 height=106
fontsize=small
color="#FFFF00"
bgcolor="#000080"
alt="a^m over a^n = either a^{m-n} when m > n
or 1 when m = n or 1 over a^{n-m} when m < n">
```

You can use the OBJECT element instead of EMBED, but this won't work with Netscape 3.0. The OBJECT element does, however, allow you to provide a fallback, e.g.

```          <object type="text/ezmath"
codebase="http://www.w3.org/People/Raggett/EzMath"
align=absmiddle
width= 181 height=106>
<param name="fontsize" value="small">
<param name="color" value="#FFFF00">
<param name="bgcolor" value="#000080">
<param name="alt" value="a^m over a^n = either
a^{m-n} when m > n or 1 when m = n or
1 over a^{n-m} when m < n">
<img src=expr13.gif align=absmiddle
width= 181 height=106
alt="a^m over a^n = either a^{m-n} when m > n
or 1 when m = n or 1 over a^{n-m} when m < n">
</object>
```

Work underway at Hewlett Packard on next generation style sheets will simplify this to just:

```        <f>a^{m-n} when m > n or 1 when m = n
or 1 over a^{n-m} when m < n</f>
```

W3C's MathML provides two sets of tags, one concerned primarily with presentation, and the other with the meaning of mathematical expressions. MathML aims to provide a low level format for machine to machine communication. It is much more verbose than EzMath, and is not intended for direct editing.

The EzMath editor also provides support for marking up expressions in MathML's content tags. To do this, you simply change the clipboard format to MathML. For the above expression you now get the following:

```        <e>
<eq/>
<apply>
<over/>
<apply>
<power/>
<ci>a</ci>
<ci>m</ci>
</apply>
<apply>
<power/>
<ci>a</ci>
<ci>n</ci>
</apply>
</apply>
<ea>
<apply>
<apply>
<power/>
<ci>a</ci>
<apply>
<minus/>
<ci>m</ci>
<ci>n</ci>
</apply>
</apply>
<st/>
<e>
<gt/>
<ci>m</ci>
<ci>n</ci>
</e>
</apply>
<apply>
<cn>1</cn>
<st/>
<e>
<eq/>
<ci>m</ci>
<ci>n</ci>
</e>
</apply>
<apply>
<apply>
<over/>
<cn>1</cn>
<apply>
<power/>
<ci>a</ci>
<apply>
<minus/>
<ci>n</ci>
<ci>m</ci>
</apply>
</apply>
</apply>
<st/>
<e>
<lt/>
<ci>m</ci>
<ci>n</ci>
</e>
</apply>
</ea>
</e>
```

## Known Problems

Printing doesn't work yet! I am having technical problems owing to the lack of source code for working example of a plugin that prints, but hope to have a fix for this soon.

This version fixes some bugs with the generation of MathML.

The for any statement is temporarily out of order. I am looking at how this and the declare statement can be adapted to specify meanings, such as E is the electric field strength, while c is the speed of light. My goal is to allow these meanings to pop-up as tooltips as the mouse hovers over identifiers.

The following idioms are not (yet) recognized:

• sin2 x for (sin x)2
• sin-1 x for arcsin x

Similarly for other trignometric functions.

I have added tentative support for vector calculus. As an example, you can view Maxwells equations (in cgs-Gaussian units) from the Math!Calculus menu. This illustrates the use of the declare statement and ";" for separating successive equations.

div, grad and curl are now rendered using the nabla symbol, thanks to feedback from users. The "there exists" symbol is now recognized and displayed correctly. This fixes a bug in previous versions.

You can now specify complex numbers, e.g.

```    complex r
complex (3, 4)
declare p as complex
```

I wondered about allowing "complex 3+4i" but think that is too likely to cause ambiguities, as well as being a mismatch with other prefixes for vector, matrix etc.

In the run up to the publication of the W3C MathML Proposed Recommendation, there were quite a few changes to the content tags in MathML. I have done my best to catch up, but will do a better job in the next release of EzMath.

### Future Work

I would like to extend EzMath to support additional areas of mathematics including tensors. Your feedback on which areas you would like to see supported is welcomed! I also plan to extend the plugin to work with MathML as input.

Dave Raggett <dsr@w3.org> 25th October 1998

 EzMath is fully described at http://www.w3.org/People/Raggett/EzMath/.

 HP is developing a free browser supporting extensions to HTML via style sheets written in blend of CSS and JavaScript. For further details see the HP Spice submission to W3C at http://www.w3.org/TR/1998/NOTE-spice-19980123.html and attend the presentation on Developers' Day.