\version "2.19" \markup\italic "Ossia staff's too long at key change:" \new Staff = "main" \relative c'' { c4 b d c << { c4 b d c } \new Staff \with { \omit TimeSignature alignAboveContext = #"main" \magnifyStaff #2/3 firstClef = ##f } { e4 d f e } >> \key a\major c4 b c2 } \markup\italic "First workaround (using StaffSymbol.width):" \new Staff = "main" \relative c'' { c4 b d c << { c4 b d c } \new Staff \with { \omit TimeSignature alignAboveContext = #"main" \magnifyStaff #2/3 firstClef = ##f \override StaffSymbol.width = #41.75 } { e4 d f e } >> \key a\major c4 b c2 } \markup\italic "Second workaround (using KeySignature.stencil):" \new Staff = "main" \relative c'' { c4 b d c << { c4 b d c } \new Staff \with { \omit TimeSignature alignAboveContext = #"main" \magnifyStaff #2/3 firstClef = ##f \override KeySignature.X-extent = #'(0 . 0) \override KeySignature.stencil = #(lambda (grob) (grob-interpret-markup grob #{ \markup { \with-color #white \filled-box #'(-.75 . 3.3) #'(-1.5 . 1.5) #0 } #})) } { e4 d f e \key a\major } >> \key a\major c4 b c2 }