|
From: | Olivier Biot |
Subject: | Re: Counters in markup (LSR 543) - getcounter addition |
Date: | Thu, 20 Dec 2012 21:13:47 +0100 |
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.
#(set! sequence-number (1+ sequence-number)) b'1^\markup\score-sequence #sequence-numberBest regards,
[Prev in Thread] | Current Thread | [Next in Thread] |