Next: , Up: Markup programmer interface


12.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-align { ... } #:center-align ( ... )
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).

Bugs

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)))


Next: , Up: Markup programmer interface

This page is for LilyPond-2.10.33 (stable-branch).

Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.