> On 22/09/2025 23:58, Paul Hodges wrote:
>> I have been using a little function to provide non-standard tuplet numbers 
>> on following tuplets until a \revert:
>> 
>> tupletMinim = \override TupletNumber.text =
>>     #(tuplet-number::append-note-wrapper
>>       tuplet-number::calc-denominator-text
>>       (ly:make-duration 1 0))
>> 
>> This produces a number followed by a minim symbol (I also have a crotchet 
>> version).  
>> 
>> I have now been asked to include a colon between the number and the note 
>> (and no other change), but I can't work out how to add it to the function 
>> above.
>> 
>> Any suggestions?
>> 
>> Paul
> 
> Does this do what you need?
> \version "2.24.4"
> 
> #(define (with-colon grob)
>   (string-join (list (tuplet-number::calc-denominator-text grob) ":")))
> 
> tupletMinim = \override TupletNumber.text =
>     #(tuplet-number::append-note-wrapper
>       with-colon
>       (ly:make-duration 1 0))
> 
> {
>   \tupletMinim \tuplet 3/2 { c''4 4 4 }
> }
> 
> -- 
> Timothy Lanfear, Bristol, UK.

Hello,

In addition to the excellent suggestion made by Timothy, I have addressed the 
possible issue of having space before and after the colon. Since it seems that 
TupletNumber.text accepts a markup entry, I made a function out of it:

%%% BEGIN %%%

tupletColon = #(define-music-function (n1 n2 n3) (number? number? number?)
                #{
                 \override TupletNumber.text =
                 \markup {
                  \concat
                  { #(number->string n1) :}
                  \hspace #-0.45 \fontsize #-5
                  \note-by-number #n2 #n3 #UP
                 }
                #}
                )

{
 \tupletColon #3 #1 #0 \tuplet 3/2 { c''4 4 4 }
}

%%% END %%%

\tupletColon accepts three arguments: first is the number before the colon, 
then second and third numbers are for \note-by-number function within \markup, 
behavior of which is similar to ly:make-duration, the first one is the note 
itself, then the second one the amount of dots.

Of course, with both Timothy’s and my suggestions, because \once is not used, 
it’s important to cancel it necessary. Otherwise everything will show up as the 
same tuplet when you want to do a quintuplet, for example. 

Hope this helps!
Yoshi

Reply via email to