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



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/vertical-spacing-of-rests-tp179947p179971.html
Sent from the User mailing list archive at Nabble.com.

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to