Using lilypond 2.18.2.

I'm trying to define flexible tags, to get around the fact that keepWithTag only lets you keep one tag at a time.

I understand how to do this manually:

\tag #'ConcertScoreTabloid
\tag #'ConcertScoreBFour
{ *music expression* }

What I want to be able to do is to use one definition for multiple tags:

\ConcertScore {
{ *music expression* } }

which I can define elsewhere -- so that I can add to it later without having to tweak every appearance.

The idea is to let me logically separate things that will be different in the concert score depending on the page size and aspect ratio (for example, page turns and system breaks) and things that will be the same in every concert score but different in orchestral parts or other output files.


As of version 2.19.14, there is the \tagGroup command for creating independent sets of tags. This helps with the inherent problems of \keepWithTag in connection with independent tags.

But for your application, it might be sufficient to use 2.18.2 and something like

concert = #'(ConcertScoreTabloid ConcertScoreBFour)

\tag \concert { c' a' g' }

and get your abstraction in that manner. While you can also write

ConcertScore =
#(define-music-function (parser location music) (ly:music?)
    #{ \tag #'ConcertScoreTabloid
       \tag #'ConcertScoreBFour

in order to use \ConcertScore in the manner you propose, it seems a bit more cumbersome.

  • Yes, it looks like \tagGroup is exactly what I need, and your first solution will work in the short term. – chapka Mar 21 '15 at 1:36

Coming back to the original question: as of version 2.19.25, there is a nice shorthand \etc that will allow you to enter the equivalent of the solution using define-music-function as

ConcertScore = \tag ConcertScoreTabloid \tag ConcertScoreBFour \etc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.