On Mon, 21 Jan 2019 at 22:33, David Kastrup <[email protected]> wrote:
> Gianmaria Lari <[email protected]> writes:
>
> > On Mon, 21 Jan 2019 at 14:57, Gianmaria Lari <[email protected]>
> > wrote:
> >
> >>
> >>
> >> On Mon, 21 Jan 2019 at 13:02, Valentin Villenave <
> [email protected]>
> >> wrote:
> >>
> >>> On 1/21/19, Andrew Bernard <[email protected]> wrote:
> >>> > Not sure how to do it with PianoStaff.
> >>>
> >>> That’s because of the Keep_alive_together engraver. Your layout block
> >>> should look like:
> >>>
> >>> \layout {
> >>> \context {
> >>> \PianoStaff
> >>> \RemoveEmptyStaves
> >>> \remove "Keep_alive_together_engraver"
> >>> \override VerticalAxisGroup.remove-first = ##t
> >>> }
> >>> }
> >>>
> >>> That being said, I have never seen a piano part where only one of the
> >>> hands is printed when the other doesn’t play. (Vibraphone and marimba
> >>> parts, maybe.) That’s why we added this feature in the first place.
> >>>
> >> [...]
> >
> > Valentin, your solution works well if the staff is made of rests (r) or
> > skips (s). Is it possible to print the staff if it contains rests but
> avoid
> > to print it if it contains skip?
>
> [NR:]
>
> A.20 Context modification identifiers
> =====================================
>
> The following commands are defined for use as context modifications
> within a ‘\layout’ or ‘\with’ block.
>
> ‘RemoveAllEmptyStaves’
> Remove staves which are considered to be empty according to the
> list of interfaces set by ‘keepAliveInterfaces’, including those in
> the first system.
> • Sets grob property ‘remove-empty’ in ‘*note
> (lilypond-internals)VerticalAxisGroup::’ to ‘#t’.
> • Sets grob property ‘remove-first’ in ‘*note
> (lilypond-internals)VerticalAxisGroup::’ to ‘#t’.
>
> ‘RemoveEmptyStaves’
> Remove staves which are considered to be empty according to the
> list of interfaces set by ‘keepAliveInterfaces’.
> • Sets grob property ‘remove-empty’ in ‘*note
> (lilypond-internals)VerticalAxisGroup::’ to ‘#t’.
>
> [IR:]
>
> 2.2.5 Axis_group_engraver
> -------------------------
>
> Group all objects created in this context in a ‘VerticalAxisGroup’
> spanner.
>
> Properties (read)
>
> ‘currentCommandColumn’ (graphical (layout) object)
> Grob that is X-parent to all current breakable (clef, key
> signature, etc.) items.
>
> ‘hasAxisGroup’ (boolean)
> True if the current context is contained in an axis group.
>
> ‘keepAliveInterfaces’ (list)
> A list of symbols, signifying grob interfaces that are worth
> keeping a staff with ‘remove-empty’ set around for.
>
> Properties (write)
>
> ‘hasAxisGroup’ (boolean)
> True if the current context is contained in an axis group.
>
> This engraver creates the following layout object(s):
>
> *note VerticalAxisGroup::.
>
> ‘Axis_group_engraver’ is part of the following context(s): *note
> ChordNames::, *note DrumStaff::, *note Dynamics::, *note FiguredBass::,
> *note FretBoards::, *note GregorianTranscriptionStaff::, *note
> KievanStaff::, *note Lyrics::, *note MensuralStaff::, *note NoteNames::,
> *note OneStaff::, *note PetrucciStaff::, *note RhythmicStaff::, *note
> Staff::, *note TabStaff:: and *note VaticanaStaff::.
>
> [ly/engraver-init.ly in definition of Score]
>
> keepAliveInterfaces = #'(
> bass-figure-interface
> chord-name-interface
> cluster-beacon-interface
> fret-diagram-interface
> lyric-syllable-interface
> note-head-interface
> tab-note-head-interface
> lyric-interface
> percent-repeat-item-interface
> percent-repeat-interface
>
> ;; need this, as stanza numbers are items, and appear only once.
> stanza-number-interface
> )
>
> So probably you likely want to add the rest-interface to that list of
> interfaces, probably in Staff context.
>
> --
> David Kastrup
>
I post here another solution that's not clean as David solution. It's a
simple escamotage.
To make lilypond print anyway a staff only containing rests I put in the
staff a zero length note and hide it like this:
\hideNotes g4*0 R1*4 \unHideNotes \break
I saw only two drawbacks (?):
1 You have to put this hide note in each line that is made of rests
2 There is some small rest alignment issue in the bar where you put the
hide note
In my case these two drawbacks were not a problem.
Here a complete (and simple) example that compiles.
\version "2.19.82"
stone = {
\clef treble
a1 b c' d' \break
a1 b c' d' \break
a1 b c' d' \break
}
sttwo = {
\clef bass
\hideNotes g4*0 R1*4 \unHideNotes
f1 g a b \break
f1 g a b \break
}
sttre = {
\clef bass
s1*4
a1 b c' d'
s1*4
}
\score {
\new PianoStaff { <<
\new Staff \with {instrumentName = #"S1" shortInstrumentName = #"S1"}
\stone
\new Staff \with {instrumentName = #"S2" shortInstrumentName = #"S2"}
\sttwo
\new Staff \with {instrumentName = #"S3" shortInstrumentName = #"S3"}
\sttre
>> }
\layout {
\context {
\PianoStaff
\RemoveEmptyStaves
\remove "Keep_alive_together_engraver"
\override VerticalAxisGroup.remove-first = ##t
}
}
}
Thank you for everybody help.
g.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user