Notations and Rendering

The purpose of notations is to make it possible to easily change the way expressions are displayed. Notations are assigned to Document Modules, Unit Test Modules and Object Modules. The notation assigned determines which renderings are selected for each expression in the module.

In Sym, a notation is an object. Like all other objects, notations are defined in Object Modules and have a type definition.

In order for an object to be a valid notation, its object definition must:

  • Be created in the Notations namespace
  • Have a type definition of Type: Notation

Object definitions for notations also typically have two properties. The first is a list rendering names that are used in the notation and the second specifies the style sheet that will by used by the notation.

When an expression is rendered, the rendering process will first look to see which notation should be applied. From the notation we can determine which rendering names and styles should be applied. From the rendering names we can find a particular rendering to use for the expression. This is done just by going through the list of rendering names attached to the object definition for the current notation. For each rendering name, we look at the object definition of the expression being rendered to see if there is a rendering with the same rendering name. The first rendering that is found is the rendering that is used for the expression. If no rendering is found in this process, then the default rendering is used.

There are three notations that are predefined, Automatic, Default, and Standard. The Automatic notation plays a special role. A module that is assigned the Automatic notation will use the notation assigned in the Document Options dialog.

In the Default notation, all objects are rendered in the form ObjectName(a, b). So x + y is rendered as Add(x, y) for example.

To assign a notation to a module just select the desired notation from the notations combo box at the top of the module. All of the expressions in the module will be rendered again using the selected notation.

You can also create new notations or change the way expressions are rendered in an existing notation. See Creating a New Notation for more details about creating a new notation and The Rendering Editor for information about creating renderings.