| [ << Modifying properties ] | [Top][Contents][Index] | [ Useful concepts and properties >> ] |
[ < \temporary and \undo ] | [ Up: Modifying properties ] | [ \tweak and \single > ] |
35.6 \set versus \override ¶
Both \set and \override commands manipulate
properties associated with contexts. The properties exist in a
hierarchy of contexts where each context contains zero or more
others below it. A property that is not set in a specific context
shows the value from the nearest enclosing context where it is
set.
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 a context’s creation, properties are initialized from its corresponding definitions (along with any other modification). Any subsequent changes are achieved with ‘property-setting’ commands within the music itself.
While graphical object (or “grob”) properties also follow the
hierarchy of contexts, they are changed with \override
and \revert and have names starting with capital letters,
while plain context properties are changed with \set and
\unset and have names starting with lowercase letters.
Grobs are usually created by ‘engravers’ at the time of interpreting a music expression, receiving their initial properties from the current 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 definitions.
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.
| [Top][Contents][Index] |