5.3.3 The \override command

There is a special type of context property: the grob description. Grob descriptions are named in StudlyCaps (starting with capital letters). They contain the ‘default settings’ for a particular kind of grob as an association list. See ‘scm/define-grobs.scm’ to see the settings for each grob description. Grob descriptions are modified with \override.

\override is actually a shorthand;

\override context.GrobName #'property = #value

is more or less equivalent to

\set context.GrobName  =
  #(cons (cons 'property value)
         <previous value of context.GrobName>)

The value of context.GrobName (the alist) is used to initialize the properties of individual grobs. Grobs have properties, named in Scheme style, with dashed-words. The values of grob properties change during the formatting process: formatting basically amounts to computing properties using callback functions.

For example, we can increase the thickness of a note stem by overriding the thickness property of the Stem object:

c4 c
\override Voice.Stem #'thickness = #3.0
c4 c

[image of music]

If no context is specified in an \override, the bottom context is used:

{ \override Staff.Stem #'thickness = #3.0
  <<
    {
      e4 e
      \override Stem #'thickness = #0.5
      e4 e
    } \\ {
      c4 c c c
    }
  >>
}

[image of music]

The effects of \override can be undone by \revert:

c4
\override Voice.Stem #'thickness = #3.0
c4 c
\revert Voice.Stem #'thickness
c4

[image of music]

The effects of \override and \revert apply to all grobs in the affected context from the current time forward:

{
  <<
    {
      e4
      \override Staff.Stem #'thickness = #3.0
      e4 e e
    } \\ {
      c4 c c
      \revert Staff.Stem #'thickness
      c4
    }
  >>
}

[image of music]

\once can be used with \override to affect only the current time step:

{
  <<
    {
      \override Stem #'thickness = #3.0
      e4 e e e
    } \\ {
      c4
      \once \override Stem #'thickness = #3.0
      c4 c c
    }
  >>
}

[image of music]

See also

Internals Reference: Backend


Other languages: deutsch, español, français, italiano, 日本語.
About automatic language selection.

LilyPond — Notation Reference