lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Counter in a repeat


From: David Kastrup
Subject: Re: Counter in a repeat
Date: Fri, 28 Jul 2017 19:03:44 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

"John Schlomann" <address@hidden> writes:

> Hello Everyone,
>
> I'd like to maintain a counter that can track the current number of passes
> through a repeat, something like this:
>
> \version "2.18.2"
>
>  
>
> rpt-number = 0  % Initialize the counter
>
> {
>
>   \repeat unfold 3 {
>
>     #(set! rpt-number (1+ rpt-number))  % Increment the counter
>
>     c'4 e'4 g'4 c''4
>
>   }
>
> }
>
>  
>
> Is there any way to do such a thing? My purpose, which is not apparent
> here, is to use the counter to build symbols used with tags, so that I
> can select different tagged parts as the repeat unfolds. In my case,
> the content of the repeat would essentially be an entire hymn stanza.

Tags are expanded at the level of music expressions but if you take a
look at the actual music code produced by \repeat unfold, you'll see
that it only contains the respective music expression once.

> I'm always amazed at the power and elegance of LilyPond, but this may
> be asking for something it wasn't designed for.

You want to use frontend tools on backend results.  That is not going to
work unless you try _simulating_ in the frontend what is supposed to be
done in the backend.  However, that is likely to lead to subtly
differing results.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]