LilyPond Notation Reference: 5.3.5 \set vs. \override

### 5.3.5 `\set` vs. `\override`

The `\set` and `\override` commands manipulate properties associated with contexts. In both cases, the properties follow a hierarchy of contexts; properties that are not set themselves in a context will still show the values of their respective parent’s context.

The lifetime and value of a context property is dynamic and only available when music is being interpreted (i.e., ‘iterated’). At the time of the context’s creation, properties are initialized from its corresponding definitions (along with any other modifications) of that context. Any subsequent changes are achieved with any ‘property-setting’ commands that are within the music itself.

Graphical Object (or “grob”) definitions are a special category of context properties as their structure and use is different from that of normal context properties. Unlike normal context properties, grob definitions are subdivided into grob properties.

Also, in contrast to normal context properties, grob definitions have their own internal ‘bookkeeping’ used to keep track of their own individual grob properties and any subproperties. This means that it is possible to define those parts within different contexts and yet still have the overall grob definition at the time of grob creation from all the pieces provided amongst the current context and its parent(s).

A grob 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) can then change (or add to) the grob’s initial properties. However, this does not affect the context’s own grob definition.

What LilyPond calls grob properties in the context of ‘user-level’ tweaks are really the properties of a context’s own grob definition.

Grob definitions are accessed with a different set of commands and are manipulated using `\override` and `\revert` and have a name starting with a capital letter (e.g., ‘`NoteHead`’); whereas normal context properties are manipulated using `\set` and `\unset` and are named starting with a lowercase letter.

The commands `\tweak` and `\overrideProperty` change grob properties by bypassing all context properties completely and, instead, catch grobs as they are being created, setting properties on them for a music event (`\tweak`) or, in the case of `\overrideProperty` for a specific override.

#### LilyPond — Notation Reference v2.24.4 (stable-branch).