Vertically aligned dynamics and textscripts

Revision as of 15:46, 30 December 2025 by Lemzwerg (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For all DynamicLineSpanner objects (i.e., hairpins and dynamic texts), the vertical minimum distance between their reference line and the staff is given by the value in the staff-padding property, unless other notation elements forces them to be farther away. Setting this property to a sufficiently large value aligns the dynamics.

The same idea, together with \textLengthOn, is used to align text scripts along their baseline.

\version "2.24"

music = \relative c' {
  a'2\p b\f
  e4\p f\f\> g, b\p
  c2^\markup { \huge gorgeous } c^\markup { \huge fantastic }
}

{
  \music
  \break
  \override DynamicLineSpanner.staff-padding = 3
  \textLengthOn
  \override TextScript.staff-padding = 1
  \music
}