# LilyPond - Repeat with Partial Measure at the End

This demonstrates the problem:

``````\relative c' {
c4 d e f
d e
\repeat volta 2 {
f g
a, b c d
}
\alternative {
{
e2
}
{
e2~ e2
}
}
}
``````

And here's a picture:

I need the first ending to be half a measure, and the second ending to be a whole measure to work out musically. For a published example, see Idumea from the Sacred Harp. Though this is in 3/2, the idea is the same:

Apparently, LilyPond is treating the second ending as the second half the measure beginning in the first ending. I guess I don't expect LilyPond to have more sense than that; it would be a very subtle thing to get right, but how can I convince Lilypond to do the right thing here?

• Starting the repetition in the middle of a bar not being the up-beat of the piece IS somewhat strange for lilypond as well as human readers. Are you sure, that you dont want to shift the repeat mark to the following bar end and repeat them at the end of repetition 1 section? Also I strongly recommend to use bar symbols in lilypond source for verification. May 25, 2018 at 9:37
• I'm positive that shifting the repeat sign is unacceptable. See the example linked in the question, and many, many more examples from that book. Thank you for the bar symbol suggestion; I will try to remember to adopt it! May 26, 2018 at 11:00

Well, this works:

``````\relative c' {
c4 d e f
d e
\repeat volta 2 {
f g
a, b c d
}
\alternative {
{
e2
}
{
\set Timing.measureLength = #(ly:make-moment 6/4)
e2~ e2
}
}
}
``````

(And of course, you can put that `e2~ e2` back to `e1`.)

• Well yeah, that works, but is it the only way? Is there any way for lilypond to see that the first ending bar is ended by the second half of bar 2 rather than the second ending? May 24, 2018 at 22:23
• Note that in \version "2.19.81" the code from the original question gives directly the result of this answer. So, no need of tweaking measureLength if you are using the development version. May 25, 2018 at 15:17