lilypond-user
[Top][All Lists]
Advanced

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

Re: Toc with counter


From: David Kastrup
Subject: Re: Toc with counter
Date: Tue, 03 Jul 2018 12:14:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Pierre Perol-Schneider <address@hidden> writes:

> How about :
>
> \version "2.19.82"
>
> #(set-default-paper-size "a6")
>
> #(define counter-alist '())
>
> #(define-markup-command (counter layout props name) (string?)
>   "Increases and prints out the value of the given counter named @var{name}.
>   If the counter does not yet exist, it is initialized with 1."
>   (let* ((oldval (assoc-ref counter-alist name))
>          (newval (if (number? oldval) (+ oldval 1) 1)))
>   (set! counter-alist (assoc-set! counter-alist name newval))
>   (interpret-markup layout props
>     (markup (number->string (round newval))))))
>
> \markup {
>   \column {
>     "counter :"
>     \fill-line {
>       \counter #"counter" \counter #"counter" \counter #"counter"
>       \counter #"counter" \counter #"counter" \counter #"counter"
>       \counter #"counter"
>     }
>     \null
>     "\pattern :"
>     \fill-line { \pattern #7 #X #7 \counter #"pattern" }
>     \null
>     "\fill-with-pattern :"
>     \fill-with-pattern #7 #RIGHT \counter #"fill-with-pattern" \null \null
>   }
> }

Too much unrelated clutter for a regtest.  I committed something
more to the point.

-- 
David Kastrup



reply via email to

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