5.3.5 \set vs. \override

Both \set and \override manipulate properties associated with contexts. In either case, properties heed the hierarchy of contexts: properties not set in a context itself show the values of the respective parent context.

Values and lifetime of context properties are dynamic and only available when music is being interpreted, ‘iterated’. At the time of context creation, properties are initialized from the corresponding context definition and possible context modifications. Afterwards, changes are achieved with property-setting commands in the music itself.

Now grob definitions are a special category of context properties. Since their structure, bookkeeping and use is different from ordinary context properties, they are accessed with a different set of commands, and treated separately in the documentation.

As opposed to plain context properties, grob definitions are subdivided into grob properties. A “grob” (graphical object) is usually created by an engraver at the time of interpreting a music expression and receives its initial properties from the current grob definition of the engraver’s context. The engraver (or other ‘backend’ parts of LilyPond) may subsequently add or change properties to the grob, but that does not affect the context’s grob definition.

What we call ‘grob properties’ in the context of user-level tweaking are actually the properties of a context’s grob definition. In contrast to ordinary context properties, grob definitions have the bookkeeping required to keep track of its parts, the individual grob properties (and even subproperties of them) separately so that it is possible to define those parts in different contexts and have the overall grob definition at the time of grob creation be assembled from pieces provided in different contexts among the current context and its parents.

Grob definitions are manipulated using \override and \revert and have a name starting with a capital letter (like ‘NoteHead’) whereas ordinary context properties are manipulated using \set and \unset and are named starting with a lowercase letter.

The special commands \tweak and \overrideProperty change grob properties bypassing context properties completely. Instead they catch grobs as they are being created and then directly set properties on them when they originate from a tweaked music event or are of a particular kind, respectively.

Altre lingue: English, deutsch, español, français, 日本語.
About automatic language selection.

LilyPond — Guida alla Notazione v2.17.97 (ramo di sviluppo).