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:
\ifTargetIn #'(<list of eligible targets>) expr
. If the target entered on the command-line isn't in the list, then the expression won't be rendered.\if-target-in #'(<list of eligible targets>) expr
.\targetName
is provided and can be assigned to header fields. This name isn't the actual text of the target but can be more exotic, for example 'chords => "Full accompaniment"
. You just need to set up the the target-names map correctly.\override LyricText #'font-size = #(value-if-target-in '(chords) -1 0)
.