A.4 Rendering Information Structure

This section documents the commands associated with defining rendering rules, changing rendering styles, and the post-processing required to generate context sensitive renderings.

A.4.1 Processing the Quasi-Prefix Form

weight object [GENERIC FUNCTION]

Compute the weight of object object. weight is a complexity measure used to compare mathematical objects. Weight is a memoized function: it remembers its results between calls.

balanced-tree-p (math-object math-object) [METHOD]

Return t if tree rooted here is balanced, i.e., all the children have the same weight.

special-pattern object [GENERIC FUNCTION]

Define the special patterns that should be looked for when processing object. Methods on this function for specific object types specify such patterns in the form of a case statement, with one case for each pattern to be identified. Rendering rules that should be applied when special patterns are seen, can be defined. Example: If we specify ’half as the special pattern for 12, then we can define a rendering rule named ’half for object math-object. Activating style use-special-patterns and executing turn-on-special-pattern with argument math-object results in the newly defined rule being used when rendering expressions containing 12. This function is memoized: it remembers its results between computations.

A.4.2 Rendering Rules and Styles

read-aloud object [GENERIC FUNCTION]

Render object object in audio. An around method on this function for the principal object type, document, calls the currently active rule for object. Primary methods on read-aloud for object serve as default rendering rules. Rendering rules should use read-aloud, rather than a specific rule, to render sub-objects —unless a specific rendering is to be hard-wired into the rule.

current-reading-style   [FUNCTION]

Return names of currently active rendering styles.

activate-style style [FUNCTION]

Activate style style.

deactivate-style style [FUNCTION]

Deactivate style style.

activate-rule object-name rule-name [FUNCTION]

Activate rule rule-name for object object-name.

deactivate-rule object-name [FUNCTION]

Deactivate currently active rule for object object-name.

reading-rule object-name rule-name [GENERIC FUNCTION]

Methods on this generic function define named rendering rules. object-name is the name of a document object type. rule-name is a symbol that names the rule. Rendering rules are methods on this generic function that specialize on both object type and rule name. Users of AS TE R should use the interface provided by Lisp macro def-reading-rule when defining new rules.

def-reading-rule (object-name rule-name) &body body [MACRO]

This macro provides a transparent interface to the underlying implementation of rendering rules. object-name names the object type, rule-name is the name of the rendering rule, and body is the body of the rendering rule. This macro expands to the appropriate method on generic function reading-rule.

rem-reading-rule object-name rule-name [MACRO]

Remove rendering rule rule-name for object object-name. This macro provides an easy-to-use interface to the CLOS function remove-method.

trace-reading-rule object-name rule-name [MACRO]

Trace rendering rule rule-name for object object-name. This macro provides an easy-to-use interface to the CLOS function remove-method.

doc-reading-rule object-name rule-name [MACRO]

Return documentation for rendering rule named rule-name for object type object-name.

turn-on-special-pattern object-name [FUNCTION]

Turn on special patterns for object type object-name. If special patterns are turned on, a known special pattern is seen and rendering style use-special-patterns is active then AS TE R uses a rule that is appropriate for this context.

turn-off-special-pattern object-name [FUNCTION]

Turn off special patterns for object object-name.