Next: , Up: Formatting text


1.8.2.1 Text markup introduction

A \markup block is used to typeset text with an extensible specific 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 specific commands, entered using the backslash \ character. Such commands only affect the first following expression.

     
     e1-\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. This syntax even allows to print double quotation marks, by preceding them with backslashes

     
     d1^"\italic markup..."
     d_\markup \italic "... prints \"italic\" letters!"
     d d

[image of music]

The way markup expressions are defined affects how these expressions will stacked, centered and aligned when using the commands explained in Text alignment.

     
     c1^\markup { \column { a bbbb \line { c d } } }
     c1^\markup { \center-column { a bbbb c } }
     c1^\markup { \line { a b c } }

[image of music]

Lists of words that are not enclosed with double quotes or preceded by a command are not treated as a distinct expression. In the following example, the first two \markup expressions are equivalent:

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

[image of music]

Markups can be stored in variables. These 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

This manual: Text markup commands.

Snippets: Text.

Internals Reference: TextScript.

Init files: scm/new-markup.scm.

Known issues and warnings

Syntax errors for markup mode can be confusing.

This page is for LilyPond-2.11.58 (development-branch).

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

Your suggestions for the documentation are welcome.

Other languages: français, español.