FDL
IF YOU CAN SEE THIS you're not accepting the default colors from this site.

Formula Display with Nested Indentation

It is quite important for readability of large formulas (and program sources) to employ suitable line breaking within formulas and nested indentation of subformulas. A utility for doing this without formula-by-formula human intervention is necessary because of the large number of automatically generated pages containing large formulas (example). We have begun to do this for our libraries posted on the Web, and have also begun italicizing mathematical variables within formulas. Here are some parts that have been recently (as of October 2003) been displayed using this new layout method:

Event Systems
Towers of Hanoi
Square Root of 2 Irrational
Standard Nuprl Resources including Elementary Number Theory
Discrete Math (large index) including Intro to Counting and
Russell's Paradox
Nuprl Basic Explanations

The general procedure is to take an abstract formula from the library and apply a Dynamic Math Formatter to it, which is parameterized by (i) the approximate width in into which the formula should be displayed, and (ii) a set of "display forms" that specify how to present the abstract structure as a sequence of character strings including precedence for parenthesization, where to break lines, and where to vertically align after breaking.

The "Dynamic" aspect of the formatter, however, is not apparent in our web projections because we target standard HTML and have not yet exposed the formatter at browse time (say through Java). Consequently resizing the window will not affect layout, and the browser cannot select alternative forms for display. Rather, the dynamic formatter is invoked by a program that generates plain HTML code given a specific length and a selection of display forms to employ. The same method has been used to generate Latex code.

We have temporarily adopted an odd method for controlling nested indentation in formulas on our web pages. Its principal deficiency is that the user must accept the default background color as specified on the HTML pages. The reason is that indentation is performed by filling the leading blank space on a line by simply displaying the corresponding characters from the line above in the background color (laughter, though not ridicule, would be appropriate at this point).

We have tried a number of more direct (less hacky) methods and considered others as well. The "Hickey Hack" (after Jason Hickey who had the idea) turned out to be the most robust. It is generally interpretable by browsers with no additional setup (other than the acceptance of default colors), it preserves vertical alignment in formulas for purposes of indentation even when fonts and sizes vary, and it allows the mixture of images and characters of varying width.

When a reasonable robust alternative becomes available, it will be gladly adopted. It is unfortunate that the commonly known and elegant "tabbing" environment of the Latex typesetting package was not emulated in the HTML standards.

November 2003

IF YOU CAN SEE THIS you're not accepting the default colors from this site.