Le 21/04/2022 à 05:59, Evan Driscoll a écrit :
http://lilybin.com/w08zwj/6 for example. In short, I want the effect of the second system without the extra syntax every single group.

The docs give examples of using countPercentRepeats to get a measure counter on measures generated by '\repeat percent', but those omit the "1" over the original, written-out measure. The docs also have examples of using the Measure_counter_engraver and \startMeasureCount (and \stopMeasureCount) to get measure counts of arbitrary segments.

If I would like a "1" over the first, written-out measure of all of my '\repeat percent's I could go through and add a \startMeasureCount and \stopMeasureCount around all of them, as in the second system in my example link, but that's obnoxious and risks missing some.

Is there a better way? Something I'm missing on the RepeatPercentCounter object? Maybe a music function I could define and use instead of '\repeat percent` as a backup?



The most straightforward way is probably with a substitution function.


\version "2.22.2"

\layout {
  \context {
    \Staff
    \consists #Measure_counter_engraver
  }
}

repeatPercentWithCount =
#(define-music-function (count music) (index? ly:music?)
   #{ \startMeasureCount \repeat percent #count { #music } \stopMeasureCount #})

{
  \repeatPercentWithCount 5 {
    c4 c c c
  }
}


See https://lilypond.org/doc/v2.22/Documentation/notation/substitution-function-examples

Best,
Jean


Reply via email to