Filtering parts from the command line

If you need to create scores for different audiences from the same sources you need to filter the input. The \tag command partially addresses this, but source files have to be changed in order to create different scores. This snippet shows how to use scheme code to filter music expressions, markup expressions, set up header fields and layout context overrides based on a switch passed on the command line.

The basic idea is to use a command line such as lilypond -dtarget=chords -o chords snippet.ly, for example, to build a score emphasizing chords. In the input file several facilities are provided: