Next: , Up: Formatting text


Text markup introduction

A \markup block is used to typeset text with an extensible syntax called “markup mode”.

The markup syntax is similar to LilyPond's usual syntax: a \markup expression is enclosed in curly braces { ... }. A single word is regarded as a minimal expression, and therefore does not need to be enclosed with braces.

Unlike simple “quoted text” indications, \markup blocks may contain nested expressions or markup commands, entered using the backslash \ character. Such commands only affect the first following expression.

     
     a1-\markup intenso
     a2^\markup { poco \italic più forte  }
     c e1
     d2_\markup { \italic "string. assai" }
     e
     b1^\markup { \bold { molto \italic  agitato } }
     c

[image of music]

A \markup block may also contain quoted text strings. Such strings are treated as minimal text expressions, and therefore any markup command or special character (such as \ and #) will be printed verbatim without affecting the formatting of the text. Double quotation marks themselves may be printed by preceding them with backslashes.

     
     a1^"\italic markup..."
     a_\markup { \italic "... prints \"italic\" letters!" }
     a a

[image of music]

To be treated as a distinct expression, a list of words needs to be enclosed with double quotes or preceded by a command. The way markup expressions are defined affects how these expressions will be stacked, centered and aligned; in the following example, the second \markup expression is treated the same as the first one:

     
     c1^\markup { \center-column { a bbb c } }
     c1^\markup { \center-column { a { bbb c } } }
     c1^\markup { \center-column { a \line { bbb c } } }
     c1^\markup { \center-column { a "bbb c" } }

[image of music]

Markups can be stored in variables. Such variables may be directly attached to notes:

     
     allegro = \markup { \bold \large Allegro }
     
     {
       d''8.^\allegro
       d'16 d'4 r2
     }

[image of music]

An exhaustive list of \markup-specific commands can be found in Text markup commands.

See also

Notation Reference: Text markup commands.

Snippets: Text.

Installed files: scm/markup.scm.

Known issues and warnings

Syntax errors for markup mode can be confusing.

Other languages: français, español, deutsch.