Previous: Ottava brackets, Up: Preparing parts


8.2.8 Different editions from one source

The \tag command marks music expressions with a name. These tagged expressions can be filtered out later. With this mechanism it is possible to make different versions of the same music source.

In the following example, we see two versions of a piece of music, one for the full score, and one with cue notes for the instrumental part

c1
<<
  \tag #'part <<
    R1 \\
    {
      \set fontSize = #-1
      c4_"cue" f2 g4 }
  >>
  \tag #'score R1
>>
c1

The same can be applied to articulations, texts, etc.: they are made by prepending

-\tag #your-tag

to an articulation, for example,

c1-\tag #'part ^4

This defines a note with a conditional fingering indication.

By applying the \keepWithTag and \removeWithTag commands, tagged expressions can be filtered. For example,

<<
  the music
  \keepWithTag #'score the music
  \keepWithTag #'part the music
>>

would yield

[image of music]

The arguments of the \tag command should be a symbol (such as #'score or #'part), followed by a music expression. It is possible to put multiple tags on a piece of music with multiple \tag entries,

  \tag #'original-part \tag #'transposed-part ...

See also

Examples: input/regression/tag-filter.ly.

Bugs

Multiple rests are not merged if you create the score with both tagged sections.


Previous: Ottava brackets, Up: Preparing parts

This page is for LilyPond-2.10.33 (stable-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.