Next: , Up: Markup programmer interface



C.2.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 < { \bold \italic "hello" \raise #0.4 "world" }
                       \bigger { foo bar baz } >

This example exposes the main translation rules between regular LilyPond markup syntax and scheme markup syntax, which are summed up is this table:

LilyPond Scheme
\command #:command
\variable variable
{ ... } #:line ( ... )
\center-align < ... > #:center ( ... )
string "string"
#scheme-arg scheme-arg

Besides, the whole scheme language is accessible inside the markup macro: thus, one may use function calls inside markup in order to manipulate character strings for instance. This proves useful when defining new markup commands (see Markup command definition).

Bugs

One can not feed the #:line (resp #:center, #:column) command with a variable or the result of a function call. E.g.:

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

is illegal. One should use the make-line-markup (resp make-center-markup, make-column-markup) function instead:

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

Read comments on this page, or add one.

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

Report errors to <bug-lilypond@gnu.org>.