5.3.5 \set vs. \override

We have seen two methods of changing properties: \set and \override. There are actually two different kinds of properties.

Contexts can have properties, which are usually named in studlyCaps. They mostly control the translation from music to notation, eg. localKeySignature (for determining whether to print accidentals), measurePosition (for determining when to print a bar line). Context properties can change value over time while interpreting a piece of music; measurePosition is an obvious example of this. Context properties are modified with \set.

There is a special type of context property: the element description. These properties are named in StudlyCaps (starting with capital letters). They contain the ‘default settings’ for said graphical object as an association list. See ‘scm/define-grobs.scm’ to see what kind of settings there are. Element descriptions may be modified with \override.

\override is actually a shorthand;

\override context.name #'property = #value

is more or less equivalent to

\set context.name #'property = #(cons (cons 'property value) <previous value of context)

The value of context (the alist) is used to initialize the properties of individual grobs. Grobs also have properties, named in Scheme style, with dashed-words. The values of grob properties change during the formatting process: formatting basically amounts to computing properties using callback functions.

fontSize is a special property: it is equivalent to entering \override ... #'font-size for all pertinent objects. Since this is a common change, the special property (modified with \set) was created.


Other languages: français, español.

Notation Reference