Stéphane SOPPERA <stephane.sopp...@wanadoo.fr> writes: > I observed a strange behavior with a /repeat unfold/ inside a /repeat > volta/ with /alternatives/. See the attached /bug_repeat__ok.ly/ for > full source. > > Using Lilypond 2.24.1: > > \repeat volta 2 { > %% Here we repeat three times the same music. > * \relative { c'4 e g r } |** > ** \relative { c'4 e g r } |** > ** \relative { c'4 e g r } |* > \alternative { > \volta 1 \relative { b4 d f g | } > \volta 2 \relative { b4 d g <c, e g> | } > } > } > > works as intended, but: > > \repeat volta 2 { > %% Here we replaced the repetition with an `unfold` repeat. > * \repeat unfold 3 { \relative { c'4 e g r } | }* > \alternative { > \volta 1 \relative { b4 d f g | } > \volta 2 \relative { b4 d g <c, e g> | } > } > } > > fails. The measure 5 appears before measure 4, the volta is misplaced > and alternatives are lost (see /bug_repeats__ok.pdf/). > > To fix the issue I can put the /repeat unfold/ inside curly brackets: > > \repeat volta 2 { > %% Here we put the `unfold` repeat inside curly braces. > * { \repeat unfold 3 { \relative { c'4 e g r } | } }* > \alternative { > \volta 1 \relative { b4 d f g | } > \volta 2 \relative { b4 d g <c, e g> | } > } > } > > Any idea why Lilypond behaves this way? Am I missing something?
It is a consequence of syntax compatibility to previously when \alternative could follow a \repeat rather than be inside of its body. So the last music before an in-\repeat \alternative must not be a \repeat without \alternative or it will sweep up the \alternative for itself. As you noticed, braces are the proper workaround. -- David Kastrup