A Functional Description of TeX's Formula Layout

A Functional Description of TeX's Formula Layout, Reinhold Heckmann and Reinhard Wilhelm, Journal of Functional Programming 1997.

While the quality of the results of TeX's mathematical formula layout algorithm is convincing, its original description is hard to understand since it is presented as an imperative program with complex control flow and destructive manipulations of the data structures representing formulae. In this paper, we present a re-implementation of TeX's formula layout algorithm in the functional language SML, thereby providing a more readable description of the algorithm, extracted from the monolithical TeX system.

I've wanted a simple description of what TeX is doing for a long time, and it's nice to see that laid out in a clear and readable way.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Nice find

The paper's real import is exposing flaws in TeX design. Mathematics needs model/view separation (semantics/presentation) but TeX mixes them. Although to be fair, TeX is meant for presentation. That is why Mathematica's interactive typesetting is so much better, it covers both very cleanly, and in fact the company put much research into that problem. Someday open source will get there.

There's promise in jsMath as used in SAGE, watch the talk.