2015-08-23 14:04 GMT+02:00 Klaus Blum <[email protected]>:
> Peter Selinger wrote
>> your code snippet does not work correctly if some of the rests are
>> dotted (see attached for the output). It's a bit of a mystery to me
>> why this happens.
>
> Hi Peter,
>
> hmmm... I didn't think of this. It's no mystery, it's the
> Dot_column_engraver who makes sure that both dots are visible:
>
> %----------------------------------------
> \version "2.19.25"
>
> centerRests = {
> \override Rest.staff-position = #0
> }
>
> \new Staff <<
> \new Voice
> \relative c'' {
> \voiceOne
> \centerRests
> r c r d | r2. e4
> d2. e4
> }
> \new Voice
> \relative c'' {
> \voiceTwo
> \centerRests
> r4 a8 a8 r4 b8 b8 | r2. c4
> c2. a4
> }
>>>
> %----------------------------------------
>
> Turning it off completely would result in a mess.
>
> Unfortunately, I don't know a quick way to prevent this. In one of the
> voices, you could set dot-count to zero, but this would affect notes and
> rests in the same way.
> A quick and dirty approach would be to remove the Rest_engraver from the
> second voice:
>
> %----------------------------------------
> \version "2.19.25"
>
> centerRests = {
> \override Rest.staff-position = #0
> }
>
> \new Staff <<
> \new Voice
> \relative c'' {
> \voiceOne
> \centerRests
> r c r d | r2. e4
> d2. e4
> }
> \new Voice \with {\remove "Rest_engraver"}
> \relative c'' {
> \voiceTwo
> %\centerRests
> r4 a8 a8 r4 b8 b8 | r2. c4
> c2. a4
> }
>>>
> %----------------------------------------
>
> If you look for an automatic solution that detects if both voices have the
> same rests, go for the merge-rests-engraver already mentioned by Harm.
> AFAIK the most recent version is here:
> https://github.com/openlilylib/openlilylib/tree/master/editorial-tools/merge-rests-engraver
>
> Cheers,
> Klaus
I'd recommend to use the engraver!
Anyway, if you want to have the dots for rests affected as well, you
need to adress them through the Rest:
\version "2.19.25"
omit-rest-and-dots =
\override Rest.after-line-breaking =
#(lambda (grob)
(ly:grob-set-property! grob 'stencil #f)
(if (not (null? (ly:grob-object grob 'dot)))
(ly:grob-set-property! (ly:grob-object grob 'dot) 'stencil #f)))
centerRests = {
\override Rest.staff-position = #0
}
\new Staff <<
\new Voice
\relative c'' {
\voiceOne
\omit-rest-and-dots
r4 c r d | r2. e4
d2. e4
}
\new Voice
\relative c'' {
\voiceTwo
\centerRests
r4 a8 a8 r4 b8 b8 | r2. c4
c2. a4
}
>>
HTH,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user