Next: Changing context default settings, Previous: Modifying context plug-ins, Up: Interpretation contexts
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 Constructing a tweak explains what to fill in for name, property, and
value. Here we only discuss 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
The \override
command is executed during the interpreting phase,
and changes the definition of the Stem
within
Staff
. After the command all stems are thickened.
Analogous to \set
, the context argument may be left out,
causing it to default to Voice
, and adding \once
applies
the change during one timestep only
c4 \once \override Stem #'thickness = #4.0 c4 c4
The \override
must be done before the object is
started. Therefore, when altering Spanner objects, like 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])
the slur is fatter and the beam is not. This is because the command for
Beam
comes after the Beam is started. Therefore it has no effect.
Analogous to \unset
, the \revert
command for a context
undoes a \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
Internals: OverrideProperty, RevertProperty, PropertySet, All-backend-properties, and All-layout-objects.
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.
Read comments on this page, or
add one.
This page is for LilyPond-2.2.6 (stable-branch). |