Changing just one specific context

The context properties of just one specific context instance can be changed in a \with block. All other context instances of the same type retain the default settings built into LilyPond and modified by any \layout block within scope. The \with block must be placed immediately after the \new context-type command:

\new Staff \with {
  [context settings for this context instance only]
} {
  …
}

Alternatively, if the music is being entered using the short form of the input mode-specifying commands, e.g. \chords rather than \chordmode, the \with command must be placed immediately after the mode-specifying command:

\chords \with {
  [context settings for this (implicit) context instance only]
} {
  …
}

as it is the implicit context created by these short forms which should be modified. The same consideration applies to the other input mode-specifying short forms (\drums, \figures), see Input modes.

Since context modifications specified in \with blocks are inside music, they will affect all outputs (typesetting and Midi) as opposed to changes within an output definition.

The following types of settings may be specified:

See also

Notation Reference: Input modes.


LilyPond Notation Reference v2.25.15 (development-branch).