Solved with \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible

\version "2.24.3"

\layout {
  ragged-right = ##t
}

mainKey = {
  \key es \major
}

\new StaffGroup {
  \new Staff = main \relative {
    \mainKey
    g'1 |
    \break
    <<
      { g1 }
      \new Staff \with {
        alignAboveContext = main
      }
      {
        \set Staff.explicitKeySignatureVisibility = #end-of-line-invisible %% 
<-- The solution
        \mainKey
        g4 f g2 |
      }
    >>
  }
}

Sent with Proton Mail secure email.

On Tuesday, November 28th, 2023 at 09:20, Ole V. Villumsen 
<ole.villum...@protonmail.ch> wrote:


> It seems to me that when an ossia staff (or similar supplementary staff) 
> happens to begin at a line break, Lilypond meaninglessly sets space apart for 
> a key signature before the line break even though there is no key signature 
> printed there. Is this a bug? Is there a workaround?
> 
> The output from the snippet below is in the attachment. At the right end of 
> the first staff there is extra space between the bar line and the end of the 
> staff.
> 
> In C major (no key signature) all is fine, there is no extra space.
> 
> \version "2.24.3"
> 
> \layout {
> ragged-right = ##t
> }
> 
> mainKey = {
> \key es \major
> }
> 
> \new StaffGroup {
> \new Staff = main \relative {
> \mainKey
> g'1 |
> \break
> <<
> { g1 }
> \new Staff \with {
> alignAboveContext = main
> }
> {
> \mainKey
> g4 f g2 |
> }
> >>
> 
> }
> }
> 
> Sent with Proton Mail secure email.

Attachment: start-ossia-at-line-break.pdf
Description: Adobe PDF document

Reply via email to