5.3.1 Overview of modifying properties

Each context is responsible for creating certain types of graphical objects. The settings used for printing these objects are also stored by context. By changing these settings, the appearance of objects can be altered.

The syntax for this is

\override context.name #'property = #value

Here name is the name of a graphical object, like Stem or NoteHead, and property is an internal variable of the formatting system (‘grob property’ or ‘layout property’). The latter is a symbol, so it must be quoted. The subsection Modifying properties, explains what to fill in for name, property, and value. Here we only discuss the functionality of this command.

The command

\override Staff.Stem #'thickness = #4.0

makes stems thicker (the default is 1.3, with staff line thickness as a unit). Since the command specifies Staff as context, it only applies to the current staff. Other staves will keep their normal appearance. Here we see the command in action:

c4
\override Staff.Stem #'thickness = #4.0
c4
c4
c4

[image of music]

The \override command changes the definition of the Stem within the current Staff. After the command is interpreted all stems are thickened.

Analogous to \set, the context argument may be left out, causing the default context Voice to be used. Adding \once applies the change during one timestep only.

c4
\once \override Stem #'thickness = #4.0
c4
c4

[image of music]

The \override must be done before the object is started. Therefore, when altering Spanner objects such as slurs or beams, the \override command must be executed at the moment when the object is created. In this example,

\override Slur #'thickness = #3.0
c8[( c
\override Beam #'thickness = #0.6
c8 c])

[image of music]

the slur is fatter but the beam is not. This is because the command for Beam comes after the Beam is started, so it has no effect.

Analogous to \unset, the \revert command for a context undoes an \override command; like with \unset, it only affects settings that were made in the same context. In other words, the \revert in the next example does not do anything.

\override Voice.Stem #'thickness = #4.0
\revert Staff.Stem #'thickness

Some tweakable options are called ‘subproperties’ and reside inside properties. To tweak those, use commands of the form

\override context.name #'property #'subproperty = #value

such as

\override Stem #'(details beamed-lengths) = #'(4 4 3)

See also

Internals: OverrideProperty, RevertProperty, PropertySet, Backend, and All layout objects.

Known issues and warnings

The back-end is not very strict in type-checking object properties. Cyclic references in Scheme values for properties can cause hangs or crashes, or both.


Other languages: espaƱol.

Notation Reference