lilypond-user
[Top][All Lists]
Advanced

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

Re: Counters in markup (LSR 543) - getcounter addition


From: Olivier Biot
Subject: Re: Counters in markup (LSR 543) - getcounter addition
Date: Thu, 20 Dec 2012 21:13:47 +0100

On Wed, Dec 19, 2012 at 5:30 PM, Olivier Biot <address@hidden> wrote:
Hi all,

I propose to extend LSR snippet 543 (counters in markup, http://lsr.dsi.unimi.it/LSR/Snippet?id=543) by adding a "getcounter" command that does NOT increment a counter when called (as opposed to the current "counter" command):

#(define-markup-command (getcounter layout props name) (string?)
  "Prints out the value of the given counter named @var{name}.
  If the counter does not yet exist, return 0."
  (let* ((curval (assoc-ref counter-alist name))
         (theval (if (number? curval) curval 0)))
  (interpret-markup layout props
    (markup (number->string theval)))))


I hope it will be useful to others as well.

Dear all,

I realize I ran into a known limitation of LSR snippet 543 severely impairing its usability:
http://lists.gnu.org/archive/html/bug-lilypond/2010-10/msg00144.html

Is there a command to defer / force parsing a command at the "parsing" stage (as explained in this October 2010 thread), or is the only option to replace all calls to \counter with the cumbersome snippet below:
#(set! sequence-number (1+ sequence-number))
b'1^\markup\score-sequence #sequence-number
Best regards,

Olivier

reply via email to

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