I am trying to add an ossia staff above the upper staff of a grand staff. Working from this mailing list post, I have constructed a minimal example that almost does what I want. The problem is that the entire score contains a blank space for the ossia staff, even in systems that have no ossia.
Here is the example (truly, a melodious composition):
\version "2.18.2"
ossia = \new Staff = "ossia" \with {
\remove "Time_signature_engraver"
fontSize = #-2
\override StaffSymbol #'staff-space = #(magstep -2)
\override Clef #'transparent = ##t
\override KeySignature #'stencil = ##f
} {
\key b \major
\override Staff.BarLine #'allow-span-bar = ##f
\stopStaff
s2.*100 % ???
}
treble = \new Staff = "treble" {
\clef treble
\key b \major
\relative c' {
\repeat unfold 10 { b8 cis dis fis dis cis }
b4 dis fis |
b4
<<
{ dis, fis }
\context Staff = "ossia" {
\startStaff \tuplet 3/2 { dis8 b dis } fis4 \stopStaff
}
>> |
b2. |
}
}
bass = \new Staff = "bass" {
\clef bass
\key b \major
\relative c {
\repeat unfold 12 { fis,4 fis4 fis4 | }
b2.
}
}
pianoStaff = \new PianoStaff {
\compressFullBarRests
\time 3/4
<<
\ossia
\treble
\bass
>>
}
\paper {
#(set-paper-size "letter")
indent = 25\mm
short-indent = 5\mm
}
\score {
<< \pianoStaff >>
% This changes nothing:
% \layout { \context { \Staff \RemoveEmptyStaves } }
}
Here is the output (PNG image, 85 KB).
Some interesting things to note:
If I remove the
s2.*100
at line 13 (marked% ???
), or change the value to anything smaller than 12, the ossia staff renders completely incorrectly. It appears below the bass clef, includes the clef and time signature, and is in the key of C (i.e., the rendered notes include accidentals). Basically, it looks like it's failed to notice that theossia
staff exists and has constructed a brand new one. I suspect that this is because the ossia staff is supposed to extend past each point where it is used—i.e., when switching staff contexts, one can go "back in time" but not forward. I don't really understand this, but I can live with it, as it doesn't seem to have an intrinsic effect as long as\compressFullBarRests
is enabled.I have included the paper size in the MWE to force consistent dimensions on different systems.
As I noted in the score, adding
\RemoveEmptyStaves
does not remove the empty staves.
My question is: how can I keep the ossia staff rendered as it does in this example (small and above the treble clef) without adding the empty space on all previous systems?
\RemoveEmptyStaves is not working because the staves are within a PianoStaff, so you must add
\remove "Keep_alive_together_engraver"
to the \layout block. Here's a minimal example of a documentation snippet slightly modified:Your example is quite big, not a real MWE.
s2.*100
doesn't make any sense to me. I suggest that you submit a smaller example.