-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Samstag, 10. Januar 2009 23:11:35 schrieb Stefan Thomas:
> Dear Kieren,
> thanks! I did'nt think on the possibilitie to do this with latex!

No need to use latex for this. In LilyPond you have the full power of Scheme / 
GUILE available, so you can define your own markup command to display a 
counter value (that automatically increases).

Attached is a sample file. Simply copy the definitions at the beginning of the 
file (counter-alist and the counter and set-counter markup functions) to your 
file and get started!

Cheers,
Reinhold

PS: The LSR is currently down, so I can't add it there :(
- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, reinh...@kainhofer.com, http://reinhold.kainhofer.com/
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * LilyPond, Music typesetting, http://www.lilypond.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFJaTT9TqjEwhXvPN0RAs86AKCySCUrnGrClJn+UYZqgaaYZ/jwiQCeIPij
SNG40un6Cx+HkFeYovy5utE=
=KOVx
-----END PGP SIGNATURE-----

Attachment: counter.pdf
Description: Adobe PDF document

\version "2.12.0"

#(define counter-alist '())

#(define-markup-command (counter layout props name) (string?)
  (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)))))

#(define-markup-command (setcounter layout props name value) (string? number?)
  (set! counter-alist (assoc-set! counter-alist name (- value 1)))
  (interpret-markup layout props (make-counter-markup name)))

\markup {This is a counter: \counter #"testing" }
\markup {It is increasing: \counter #"testing" }
\markup {It is increasing: \counter #"testing" }
\markup {Setting to a specific value works, too:}
\markup {Set to 15: \setcounter #"testing" #15 }
\markup {It is increasing: \counter #"testing" }
\markup {It is increasing: \counter #"testing" }
\markup {It is increasing: \counter #"testing" }
\markup {It is increasing: \counter #"testing" }
\markup {It is increasing: \counter #"testing" }
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to