2.5.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")
                  #:larger #:line ("foo" "bar" "baz")))

is equivalent to:

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

This example demonstrates the main translation rules between regular LilyPond markup syntax and Scheme markup syntax. Using #{ … #} for entering in LilyPond syntax will often be most convenient, but we explain how to use the markup macro to get a Scheme-only solution.

LilyPond

Scheme

\markup markup1

(markup markup1)

\markup { markup1 markup2 ... }

(markup markup1 markup2 ... )

\markup-command

#:markup-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)))

他の言語: deutsch, español, français
About automatic language selection.

LilyPond — Extending

inserted by FC2 system