Next: , Previous: Text marks, Up: Text



8.1.4 Text markup

Use \markup to typeset text. Commands are entered with the backslash \.

     c1^\markup { hello }
     c1_\markup { hi there }
     c1^\markup { hi \bold there, is \italic anyone home? }

[image of music]

See Overview of text markup commands for a list of all commands.

\markup is primarily used for TextScripts, but it can also be used anywhere text is called in lilypond

     \header{ title = \markup{ \bold { foo \italic { bar! } } } }
     \score{
       \relative c'' {
         \override Score.RehearsalMark
           #'break-visibility = #begin-of-line-invisible
         \override Score.RehearsalMark #'self-alignment-X = #right
     
         \set Staff.instrument = \markup{ \column{ Alto solo } }
         c2^\markup{ don't be \flat }
         b2
         a2\mark \markup{ \large \bold Fine }
         r2
         \bar "||"
       }
       \addlyrics { bar, foo \markup{ \italic bar! } }
     }

[image of music]

The markup in the example demonstrates font switching commands. The command \bold and \italic apply to the first following word only; to apply a command to more than one word, enclose the words with braces,

\markup { \bold { hi there } }

For clarity, you can also do this for single arguments, e.g.,

\markup { is \italic { anyone } home }

In markup mode you can compose expressions, similar to mathematical expressions, XML documents, and music expressions. You can stack expressions grouped vertically with the command \column. Similarly, \center-align aligns texts by their center lines:

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

[image of music]

Lists with no previous command are not kept distinct. The expression

\center-align { { a b } { c d } }

is equivalent to

\center-align { a b c d }

To keep lists of words distinct, please use quotes " or the \line command

     \fatText
     c4^\markup{ \center-align { on three lines } }
     c4^\markup{ \center-align { "all one line" } }
     c4^\markup{ \center-align { { on three lines } } }
     c4^\markup{ \center-align { \line { on one line } } }

[image of music]

Markups can be stored in variables and these variables may be attached to notes, like

allegro = \markup { \bold \large { Allegro } }
 { a^\allegro b c d }

Some objects have alignment procedures of their own, which cancel out any effects of alignments applied to their markup arguments as a whole. For example, the RehearsalMark is horizontally centered, so using \mark \markup { \left-align .. } has no effect.

See also

This manual: Overview of text markup commands.

Program reference: TextScript.

Init files: scm/new-markup.scm.

Bugs

Kerning or generation of ligatures is only done when the TeX backend is used. In this case, LilyPond does not account for them so texts will be spaced slightly too wide.

Syntax errors for markup mode are confusing.

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

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

Other languages: English.
Using automatic language selection.