lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wrapping music


From: Urs Liska
Subject: Re: wrapping music
Date: Tue, 11 Mar 2014 15:02:37 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Am 11.03.2014 14:57, schrieb Xavier Noria:
I am writing a score that has a few notes with cross heads. It would be
helpful to define \cross such that

    \cross { c8 c8 c8 }

would expand to:

    \override NoteHead.style = #'cross
    c8 c8 c8
    \revert NoteHead.style

Is that possible?

Yes:

cross =
#(define-music-function (parser location music)(ly:music?)
   #{
     \temporary\override NoteHead.style = #'cross
     $music
     \revert NoteHead.style
   #}
   )

{
  \cross { c8 c8 c8 }
}

(I don't know when (recently) the \temporary was included (I think somewhere in 2.17). This ensures that NoteHead.style won't be reverted to its _default_ value but to the value that was active _immediately before_.

HTH
Urs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]