|
From: | Paolo Prete |
Subject: | Re: Need help with Scheme code |
Date: | Wed, 18 Dec 2019 03:01:52 +0100 |
On 2019-12-17 4:21 pm, Paolo Prete wrote:
> Hi Stefano,
>
> unfortunately, it doesn't increment the counter globally, and the two
> ids
> in the SVG file are identical
You will need to define a music function so that the (serial) procedure
is called on each occurrence. Here's an option that rolls in the
counter logic:
%%%%
\version "2.19.83"
token = #(let* ((ctr 0) (ctr! (lambda () (set! ctr (1+ ctr)) ctr)))
(define-music-function (mus) (ly:music?)
(let ((id (format #f "foobar_~a" (ctr!))))
#{ \tweak output-attributes #`((id . ,id)) #mus #})))
\relative { c'4 d8 -\token [ e ] f -\token [ g ] c,4 }
%%%%
-- Aaron Hill
[Prev in Thread] | Current Thread | [Next in Thread] |