Breaking horizontal alignment of dynamics and textscripts

LilyPond uses DynamicLineSpanner grobs to horizontally align successive dynamic objects like hairpins and dynamic text, even if they are positioned on different sides of a staff. This connection cannot be broken, contrary to the vertical alignment (see snippet „Breaking vertical alignment of dynamics and textscripts“).

There are two solutions to circumvent the problem.

Both solutions are demonstrated in this snippet.

{
  <>^"default"
  f'_\pp ^\> f' f' f'\!
}

{
  <>^\markup { setting \typewriter shorten-pair }
  f'_\pp \tweak shorten-pair #'(-3 . 0) ^\> f' f' f'\!
}

{
  <>^\markup { using another \typewriter Voice context }
  << { f'^\> f' f' f'\! }
     \new Voice { s4_\pp } >>
}

\layout {
  line-width = 8\cm
  ragged-right = ##f

  \context {
    \Voice
    \override TextScript.staff-padding = #3.5
  }
}
[image of music]

LilyPond snippets v2.25.33 (development-branch).