lilypond-user
[Top][All Lists]
Advanced

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

markups in scheme


From: Nicolas Sceaux
Subject: markups in scheme
Date: Sat, 02 Aug 2003 22:55:07 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

Hello,

Having upgraded from 1.6 to 1.7.something, I had a look to the new
markups, as many messages in this list reported that it was a big
improvement. (They were not lying.)

I looked for a scheme user interface, so that I could build markups in
scheme functions. In a comment, it is said that is left as an exercise
to the reader. But maybe I missed something?

Anyway, I have written a `markup' macro in scheme, which builds text
markups. As it might interest someone else, it is put here:

  http://nicolas.sceaux.free.fr/lilypond/scheme-hacks.html

The `text markups' section explains how to use them:

\markup { \bold "Dal" " " \raise #0.8 \musicglyph #"scripts-segno" }
===
#(markup (#:bold "Dal") " " (#:raise 0.8 (#:musicglyph "scripts-segno")))

It allows the user to define functions that build markups, which is
usefull for large scores, where they can help making sort of
stylesheets.

-------
#(define* (character name #:optional scenical (translation (cons -3 2)))
   (if scenical
       (markup (#:translate translation
                  (#:line (#:large (#:bold (make-simple-markup 
(string-capitalize name))))
                          (#:italic (make-simple-markup scenical)))))
       (markup (#:translate translation 
                 (#:large (#:bold (make-simple-markup (string-append 
(string-capitalize name) 
                                                                     "."))))))))

\score {
    \context Staff {
        \notes { \clef bass 
                 c^#(character "cesare") c c c c c c c
                 c^#(character "cleopatra" "(entra.)") c c c c c c } } }

The generated markups are equivalent to:

\markup \translate #(cons -3 2) { \large \bold "Cesare." }
\markup \translate #(cons -3 2) { \large \bold "Cleopatra" 
                                  \italic "(entra.)" }

Regards,
nicolas sceaux







reply via email to

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