Notes on implementing <menclose/>

Introduction

These notes collect various ideas to implement the MathML element <menclose/> that I use for Amaya and Firefox. The current rendering of <menclose/> in Amaya is only an approximation. It is made essentially with its "P langage" so the ideas should be applyable to renderers that use CSS to display MathML (such that Opera). The implementation for Firefox is supposed to be closer to the expected result and gives other ideas. I am very grateful to Karl Tomlinson for reviewing my patches for Firefox and for its comments & suggestions. I would also like to thank Azzeddine Lazrek for having provided information about the madruwb notation, although I have finaly not implemented this notation in Firefox. I hope someone else will be able to work on it.

General comments

The element was introduced in the MathML 2 recommendation to render its content inside an enclosing notation. The way to draw the different notations is not described exactly in this specification but some examples are given. More information will be available in the MathML 3 specification, especially about how to deal with several notations in the same <menclose/>.

First, the <menclose/> follows the rule of the inferred mrow so we can imagine it has only one child. Hence we suppose that we have the bounding box of this child i.e. a rectangle that represents its extent. Bounding boxes are commonly used in layout engines. However, the layout algorithm described below could be modified to deal with other shapes.

The <menclose/> element has a notation attributes that may contain any number of notation names separated by whitespace. The first step is to parse this attribute to determine the list of notation to draw. Duplicated values are counted once and unknown values are ignored. The MathML REC contains a list of suggested values. A new notation is proposed in the current MathML 3 working draft: madruwb.

The next steps is to render this list of notations. Some test pages:

Drawing a notation as a combination of others

Some notations can be drawn as a combination (exact or approximative) of others. It can be useful to start with approximations because some of the notations are more difficult to implement.

Overlapping or nesting notations?

TODO

The "circle" notation

TODO

The smallest enclosing ellipse

w h 2a 2b M

We increase the dimension of the bounding box by a factor k = 2 b h = 2 a w .

If we consider the point M, we have ( w 2 a ) 2 + ( h 2 b ) 2 = 1

Hence 2 k 2 = 1 i.e k = 2 .

The "madruwb" notation

TODO

A layout algorithm

This page is W3C-compliant - Author: Frédéric WANG
Valid XHTML 1.1 Valid MathML 2.0 Valid SVG Valid CSS Amaya, the W3C browser/editor Firefox