Hi All,
I'm wanting to use this great counter markup code:

"Implementing a counter in markup text"
http://lsr.dsi.unimi.it/LSR/Snippet?id=543

though I would like to use it with \mark for example:
\mark \markup {\counter #"mycounter"}

But it gives results I don't expect and I'm having difficulty
understanding why. Can anyone help me?

Thanks!

Here's a snippet...

%%%%

#(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 newval)))))

\relative c' {
  \mark \markup {\counter #"mycounter" "(why not 1?)"}
  c2^\markup {\counter #"mycounter" }
  d
  e^\markup {\counter #"mycounter" }
  f
  g^\markup {\counter #"mycounter" }
  a
}

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to