Marc Hohl <m...@hohlart.de> writes:

> Has someone an idea
> how to create a loop which scans for textA, textB, textC etc. and puts
> a command that acts like
> \addlyrics for each hit?

This is exactly what I do in my LP templates :)

I just define 

 highMusic
 leadMusic
 highWords
 highAWords
 highBWords
 
and so on, and the templates will process exactly what has been defined,
leaving out the undefined parts.

I found \ifDefined and friends (attached) helpful to write the templates.

So it boils down to something like:

    % Add lyrics if requestes.
    \ifDefinedThen \leadWords  \new Lyrics \lyricsto \voiceName \ifDefined 
\leadWords
    \ifDefinedThen \leadAWords \new Lyrics \lyricsto \voiceName \ifDefined 
\leadAWords
    \ifDefinedThen \leadBWords \new Lyrics \lyricsto \voiceName \ifDefined 
\leadBWords
    \ifDefinedThen \leadCWords \new Lyrics \lyricsto \voiceName \ifDefined 
\leadCWords

So it is not exactly scanning, but there's no problem in adding as many
cases as necessary.

The real templates are more generic than the above example.

BTW: I'd be happy to share these templates to LSR but the snippet repo
(still) cannot handle template collections.

-- Johan

Attachment: ifdefined.ly
Description: Binary data

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to