\kronecker
is not present in La)TeX. An author can extend
La)TeX by defining
[LVerbatim613]
and then write
[LVerbatim618]
The definition for \kronecker
has extended the markup
language. LaTeX [Lam86] itself is a good example of how
TeX macros can be used to implement a language for encoding
document structure.
The presence of user-defined macros in documents presents an interesting challenge for a system like AsTeR . Our goal is to handle books and technical documents written in La)TeX, so recognizing the extended logical structure introduced by the definition of new macros is therefore essential. In general, macro expansion can perform any arbitrary computation permitted by the TeX language. Hence, it is impossible to directly translate the macro expansion into an audio rendering. The TeX primitives are visual layout operators, and translating a TeX macro directly into an audio rendering rule would imply a one-to-one mapping between the visual and audio rendering.
As explained in s:aster-motivation, visual renderings are attuned to a two-dimensional display, and audio renderings need to be attuned to the features of an auditory display. Further, expanding a TeX macro loses structural information; when all macros in a document have been expanded, only the visual layout remains.
The first step in solving this problem is to represent user-defined macros in our high-level document model. Producing audio renderings of such instances will then be equivalent to rendering any other object present in the model.
Macro definitions introduce new object types. Thus,
defining \kronecker
is equivalent to adding object kronecker 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 rendering
rule for instances of this object.
We first describe how the recognizer is extended to handle instances of the new object introduced by a macro definition. We specify the following information about the new macro and the associated object type:
\kronecker
will be used as a binary operator, we can declare
it as such.
\inference
is defined as a macro with
two arguments, then we can supply these contextual names to
define-text-object. Such information is used to generate
sophisticated audio renderings.
This information is supplied by calling Lisp macro
define-text-object. We illustrate this in the case of
\kronecker
in fig:define-kronecker. The
Lisp macro itself will be described
in s:define-text-object.
: Extending the recognizer to handle user-defined macros.
Note that our recognizer has more information about the new macro than TeX. This is consistent with the fact that our internal representation is richer than the TeX representation, as described in s:quasi-prefix.
To summarize, we model a macro as:
To continue with the example of kronecker
, given
[LVerbatim652]
LISPIFY converts it to
[LVerbatim655]
LISPIFY marks the La)TeX macro instance as a
a control sequence (cs).
The recursive descent recognizer performs the following steps on
encountering calls to macro \kronecker
:
\kronecker
takes no arguments.
[displaymath5480]
In the above list, only the types of the objects are shown. This list is now processed by function inf-to-pre to produce the quasi-prefix form. Since class kronecker is a subclass of binary-operator with the same precedence as multiplication, the result is a tree with kronecker as the root and with two children, one each corresponding to [tex2html_wrap5492] and [tex2html_wrap5494].
In the above, [tex2html_wrap5496] and [tex2html_wrap5498] may be arbitrarily complex pieces of La)TeX markup; the recursive nature of the recognition algorithm will set the children of object kronecker to the operands in their processed form. For example, we can now build an internal representation for the following equation:
[displaymath5481]
which would be written in La)TeX as
[LVerbatim683]