Oh David's right, if the music ends with no alterations it is printing the key cancellation, even when it has been explicitely set to false.[image: image.png] What can I do in this case? I would like to keep the number+alteration but remove the 7 natural signs before that.
Thank you, Robert El lun, 2 oct 2023 a las 15:41, David Kastrup (<d...@gnu.org>) escribió: > Valentin Petzel <valen...@petzel.at> writes: > > > Hi Robert, > > > > you could do it like this: > > > > \version "2.23.6" > > > > \layout { > > \context { > > \Staff > > \override KeySignature.text = > > #(lambda (grob) > > (let* ((alt (ly:grob-property grob 'alteration-alist)) > > (alts (map cdr alt)) > > (tot (* 2 (apply + alts))) > > (acc (cond ((= tot 0) (markup #:musicglyph > > "accidentals.natural")) > > ((> tot 0) (markup #:musicglyph > "accidentals.sharp")) > > (else (markup #:vcenter #:musicglyph > > "accidentals.flat"))))) > > (markup #:vcenter #:number (number->string (abs tot)) acc))) > > \override KeySignature.stencil = #ly:text-interface::print > > printKeyCancellation = ##f > > } > > } > > > > expt = { \key c \major c d e f } > > > > { > > \clef bass > > \expt > > \transpose c cis \expt > > \transpose c des \expt > > \transpose c d \expt > > \transpose c dis \expt > > \transpose c es \expt > > \transpose c e \expt > > \transpose c f \expt > > \transpose c fis \expt > > \transpose c ges \expt > > \transpose c g \expt > > \transpose c gis \expt > > \transpose c as \expt > > \transpose c a \expt > > \transpose c ais \expt > > \transpose c bes \expt > > \transpose c b \expt > > } > > > > Cheers, > > Valentin > > To pour some rain on your parade, end the music with a final \expt ... > My revenge for you beating me to the punch line. > > -- > David Kastrup >