5.3 Traversing High-Level Document Structure

Our internal representation for document structure is an attributed tree. Tree structures are easy to traverse, and they provide a uniform way of browsing structure present in both plain text as well as mathematical formulae. This section outlines our approach to enabling such browsing actions.

All browsing actions are defined with respect to the current selection (a node in the internal tree representation of the document) that is recorded in variable *read-pointer*. Typically, the current selection is initially the top of the document. The current selection can be changed in two ways:

The following browser actions can be executed when no rendering is in progress. Our key-mapping for these commands is inspired principally by the key-map used by the UNIX VIeditor.

Below, these browser actions are augmented to enable the traversal of the attributed tree structure defined in Chapter 2. In our model, all nodes have content.

The following actions move the selection to the various attributes. The parent of an attribute is defined to be the object being attributed. The result of moving to attributes can therefore be undone by moving back up to the parent.

The above key-map3 for traversing the attributes was arrived at as follows: The choice for superscript and subscript is automatic, since the keystrokes match the symbols used by TEX to markup these attributes. Placing the fingers on the row of numerals on a standard keyboard, the actions necessary for typing ˆ and _ are mimicked with the left hand to arrive at the key-bindings for the left superscript and subscript. The middle finger of each hand is used to get to the accent/underbar.

Tables are the only objects in our internal representation that do not conform completely to the tree-traversal model. This is because each table element is linked to its parent as well as to its four neighbors. The left and right neighbors can be modeled as siblings, but we need extra links and hence extra actions to traverse the entries by columns.

Summarizing the Selection

When any of the above browsing actions are executed, the new selection is summarized. These summaries are designed to be concise but informative. A typical problem that results when traversing complex structure is the so-called “lost in space” problem, where a user gets disoriented with respect to the current selection. We avoid this problem by conveying the following bits of information after each move:

Thus, when moving down the right hand side of Faa de Bruno’s formula shown in equation 4.5 on page 134, the listener would hear:

Key-press Action Context Type

Right hand side is Summation

j First child Summand is Summation

j First child Summand is Juxtaposition

j First child First term is Derivative

l Next sibling Second term is Fraction

j First child Numerator is Product

l Next sibling Denominator is Product

Messages like the ones shown above have been found to be sufficient to avoid the lost-in-space problem mentioned earlier.

The nature of an object is conveyed by generic function summarize —methods on this function specify how individual object types are summarized. Below, we show some examples —the following list is not meant to be exhaustive. In cases where insufficient information is available to generate a complete summary of an object instance, the type of that object is spoken.

Object Type Summary

Article Title

Sectional unit Section title

Complex Math object Operator appearing at the root

Math object (leaf node) Render node

Contextual information (e.g., what the children of math objects are called) is available to AS TE R, —children of an inference are called “premise” and “conclusion”; children of a fraction are called numerator and denominator. Such information was used to advantage in generating meaningful names when applying variable substitution; it is now exploited in giving contextual information about the current selection.

Traversing the structure of mathematical expressions is particularly useful when used in conjunction with the variable-substitution rendering style. In fact, such traversal can be thought of as a dual to variable substitution. If an expression has been rendered once using variable substitution, then future traversals of that expression use the variable names generated in the substitution process when cueing the current selection. This proves to be a very useful memory aid when understanding complex equations like Faa de Bruno’s formula shown in equation 4.5 on page 134.

Traversing document structure is also very useful when handling large documents, e.g., entire textbooks. The browser actions described so far enable the listener to move quickly through the document without having to listen to a lot of text. In conjunction with the ability to switch rendering styles, this enables the quick location of portions of interest. For instance, a listener can activate a rule (see Figure 4.1 on page 101) that renders only the mathematics in a document. Once an equation of interest is encountered, the listener can interrupt the rendering, move the current selection from this point to the enclosing paragraph or sectional unit, and then listen to the relevant portion of the document.