lilypond-user
[Top][All Lists]
Advanced

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

Re: automatic numbers for examples


From: coffer
Subject: Re: automatic numbers for examples
Date: Sun, 11 Jan 2009 15:29:44 -0800 (PST)

Thank you for this nice feature! I do really like it.
Can you tell me how to change the appearance of the counter? For example,
putting it in the title I canĀ“t change to bold style.

Thanks,
coffer.



Reinhold Kainhofer wrote:
> 
> -----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, address@hidden, 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-----
> 
>  
> \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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/lilypond-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/automatic-numbers-for-examples-tp21391871p21405880.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.





reply via email to

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