Styles

Each notation refers to a stylesheet. Stylesheets define Styles. Styles are used in two places. First, they can be used to style text. Second, they can be used to style parts of an expression in a rendering. You can create new style and new stylesheets.

The process of styling an expression or text is similar to the way that cascading style sheets that are commonly used in HTML. The current stylesheet defines the styles that are available, the objects in the document refer to these styles.

The main differences between the stylesheets in Sym and the cascading style sheets used in HTML are:

  • Stylesheets in Sym don't cascade
  • Stylesheets in Sym are functions. The parameter passed to the function is a ClassName, the expression returned by a stylesheet function is a Style. It contains the styles that should be applied for that class. The styles include things like the font, font style, and so on.

The current stylesheet is determined by the notation. The Stylesheet property can be attached to the object definition of a notation to set the stylesheet that is used in that notation.

You can create new stylesheets (see Creating Stylesheets) which can define both new and existing styles or you can add styles to an existing stylesheet (see Creating Styles) by extending a stylesheet function.