Next: , Up: Markup programmer interface


6.4.1 Markup construction in Scheme

The markup macro builds markup expressions in Scheme while providing a LilyPond-like syntax. For example,

(markup #:column (#:line (#:bold #:italic "hello" #:raise 0.4 "world")
                  #:bigger #:line ("foo" "bar" "baz")))

is equivalent to:

\markup \column { \line { \bold \italic "hello" \raise #0.4 "world" }
                  \bigger \line { foo bar baz } }

This example demonstrates the main translation rules between regular LilyPond markup syntax and Scheme markup syntax.

LilyPond Scheme
\markup markup1 (markup markup1)
\markup { markup1 markup2 ... } (markup markup1 markup2 ... )
\command #:command
\variable variable
\center-column { ... } #:center-column ( ... )
string "string"
#scheme-arg scheme-arg

The whole Scheme language is accessible inside the markup macro. For example, You may use function calls inside markup in order to manipulate character strings. This is useful when defining new markup commands (see New markup command definition).

Known issues and warnings

The markup-list argument of commands such as #:line, #:center, and #:column cannot be a variable or the result of a function call.

(markup #:line (function-that-returns-markups))

is invalid. One should use the make-line-markup, make-center-markup, or make-column-markup functions instead,

(markup (make-line-markup (function-that-returns-markups)))

Cette page documente LilyPond-2.11.58 (branche de développement).

Rapportez toute anomalie en français à lilypond-user-fr@gnu.org ou en anglais à http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs

Vos suggestions à propos de la documentation sont les bienvenues.