The first step in solving this problem is to represent instances of user-defined macros in our high-level document model. Producing audio renderings (or renderings in other modalities) of such instances is then equivalent to rendering any other object present in the model.
We model macro definitions as introducing new object types. Thus, defining
\legendre is equivalent to adding object legendre/ to the set
of objects present in the document model. A macro definition in La)TeX has
two parts; the first part declares the macro and its number of arguments; the
second part specifies how instances of this macro call are to be displayed.
Translating this to the object-oriented model, the first part of the macro introduces a new object type; the second part is a visual rendering rule for instances of this object. We extend AsTeR to handle user-defined macros according to this framework. Hence, for every user-defined macro, the document model is extended by adjoining a new object type, and calls to that user-defined macro are represented by instances of this new object type.