6

I'm trying to use Lilypond 2.18.2 to engrave a piece with two staff groups: a verse for piano (18 bars), and a chorus for choir (8 bars). I'm trying to follow the Lilypond example "Solo Verse and Two-Part Refrain", which takes advantage of \RemoveEmptyStaves. However, Lilypond doesn't seem to be inserting any line breaks within the verse, so the music runs off the edge of the page.

I have tried to reduce the following example as much as possible, but it needs to have a lot of notes to reproduce the problem, so it is still a bit long. Sorry about that.

#(set-default-paper-size "letter")

\version "2.18.2"
\language "english"

global = {
  \key c \major
  \time 6/8
}

verseTreble = \relative c' {
  \global
  \clef treble
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  r2.*8
}

verseBass = \relative c {
  \global
  \clef bass
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  c8 e g c g e |
  r2.*8
}

chorusSoprano = \relative c' {
  \global
  \clef treble
  \autoBeamOff
  r2.*18 |
  g2. |
  r2.*6 |
  g2. |
}

chorusAlto = \relative c' {
  \global
  \clef treble
  \autoBeamOff
  r2.*18 |
  g2. |
  r2.*6 |
  g2. |
}

\score {
  <<
    \new PianoStaff <<
      \new Staff = "upper" { \verseTreble }
      \new Staff = "lower" { \verseBass }
    >>
    \new ChoirStaff <<
      \new Staff <<
        \new Voice = "s" {
          \chorusSoprano
        }
      >>
      \new Staff <<
        \new Voice = "a" {
          \chorusAlto
        }
      >>
    >>
  >>

  \layout {
    % ragged-right = ##t
    \context {
      \Staff
      \RemoveEmptyStaves
      \override VerticalAxisGroup.remove-first = ##t
    }
  }
}

Here is the output, converted to PNG. Note that the last 8 measures of the piano verse are off the page. No warnings are issued when compiling.

enter image description here

1 Answer 1

8

Remember that full-measure rests in LilyPond are input with a capital R. Thus every instance where you have r2. (or r2.*8, etc.), you should instead have R2. (or R2.*8, etc.).

Making this change in all voices corrects the problem. In the example you gave, it's present in the final lines of both the treble and bass and it's present in two lines each for the soprano and alto.

enter image description here

I'll also take this moment to mention the \unfold command in LilyPond. Perhaps you're already aware of this and just didn't include it in your MWE, but instead of writing out c8 e g c g e 18 times, we can instead input \repeat unfold 18 { c8 e g c g e } which will do all of that work for us. And if we need to make edits, it's also much easier to just change the 18 instead of having to add/delete lines as necessary.

1
  • Thanks, I did not know about R. And thanks also for the note about unfold. I had just wanted to replace the notes of the actual song with something simple, to rule out the possibility of a problem with them, and it seemed best not to try anything new and risk introducing more bugs. But it could be useful in the future. Commented May 6, 2019 at 13:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.