Counters in markup (LSR 543) - getcounter addition
From:
Olivier Biot
Subject:
Counters in markup (LSR 543) - getcounter addition
Date:
Wed, 19 Dec 2012 17:30:43 +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)))))