[icon]

GNU LilyPond

-- --

What is LilyPond
Home
Examples
Templates
Download
GNU/Linux binaries
Windows binaries
Source code
Documentation
Tutorial
Manual
Glossary
Index

Support
Mailing lists
Search
WikiWiki

External sites
lilypond.org/stable
lilypond.org/development
savannah.gnu.org
ftp.lilypond.org
Mutopia
Other music online

Text markup

LilyPond has an internal mechanism to typeset texts. You can access it with the keyword \markup. Within markup mode, you can enter texts similar to lyrics: simply enter them, surrounded by spaces.

      c1^\markup { hello }
      c1_\markup { hi there }
      c1^\markup { hi \bold there, is \italic anyone home? }
     
[picture of music]

The line of the example demonstrates font switching commands. Notice that the command only apply to the first following word; enclose a set of texts with braces to apply a command to more words.

       \markup { \bold { hi there } }
     
For clarity, you can also do this for single arguments, e.g.
       \markup { is \italic { anyone } home }
     

The following size commands set abolute sizes

\teeny

\tiny

\small

\large

\huge

You can also make letter larger or smaller relative to their neighbors, with the commands \larger and \smaller.

The following font change commands are defined:

\dynamic
This changes to the font used for dynamic signs. Note that this font doesn't contain all characters of the alphabet.
\number
This changes to the font used for time signatures. It only contains numbers and a few punctuation marks.
\italic

\bold

Raising and lowering texts can be done with \super and \sub.

      c1^\markup { E "=" mc \super "2" }
     
[picture of music]

If you want to give an explicit amount for lowering or raising, use \raise. This command takes a Scheme valued argument,

      c1^\markup { C \small \raise #1.0 { "9/7+" }}
     
[picture of music]
The argument to \raise is the vertical displacement amount, measured in (global) staff spaces.

Other commands taking single arguments include


\musicglyph
This is converted to a musical symbol, e.g. \musicglyph #"accidentals-0" will select the natural sign from the music font. See The Feta font for a complete listing of the possible glyphs.
\char
This produces a single character, e.g. \char #65 produces the letter 'A'.
\hspace #amount
This produces a invisible object taking horizontal space.
          \markup { A \hspace #2.0 B }
          
will put extra space between A and B. Note that lilypond inserts space before and after \hspace.
\fontsize #size
This sets the relative font size, eg.
          A \fontsize #2 { B C } D
          

This will enlarge the B and the C by two steps.

\translate #(cons x y)
This translates an object. It's first argument is a cons of numbers
          A \translate #(cons 2 -3) { B C } D
          
This moves `B C' 2 spaces to the right, and 3 down.
\magnify #mag
This sets the font magnification for the its argument. In the following example, the middle A will be 10% larger.
          A \magnify #1.1 { A } A
          

\override #(key . value)
This overrides a formatting property for its argument. The argument should be a key/value pair, e.g.
          m \override #'(font-family . math) m m
          

In markup mode you can compose expressions, similar to mathematical expressions, XML documents and music expressions. The braces group notes into horizontal lines. Other types of lists also exist: you can stack expressions grouped with <<, and >> vertically with the command \column. Similarly, \center aligns texts by their center lines.

      c1^\markup { \column << a bbbb c >> }
      c1^\markup { \center << a bbbb c >> }
      c1^\markup { \line << a b c >> }
     
[picture of music]

The markup mechanism is very flexible and extensible. Refer to scm/new-markup.scm for more information on extending the markup mode.

One practical application of complicated markup is to fake a metronome marking:

     eighthStem = \markup \combine
     	\musicglyph #"flags-stem"
     	\translate #'(0.0 . 3.5) \musicglyph #"flags-u3"
     eighthNote = \markup
     	\override #'(word-space . 0.0)
     	{ \musicglyph #"noteheads-2"
     	  \translate #'(-0.05 . 0.1) \eighthStem }
     
     \score {
       \notes\relative c'' {
         a1^\markup { \magnify #0.9 \eighthNote " = 64" }
       }
     }
     
[picture of music]

BUGS

LilyPond does not account for kerning in its text formatting, so it spaces texts slightly too wide.

Syntax errors for markup mode are confusing.

Go back to index of LilyPond.

Please send GNU LilyPond questions and comments to lilypond-user@gnu.org.

Please send comments on these web pages to (address unknown)

Copyright (c) 1997--2002 Han-Wen Nienhuys and Jan Nieuwenhuizen.

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.


This page was built from LilyPond-1.7.14 (development-branch) by

Buchan Milne <(address unknown)>, Thu Mar 6 21:11:35 2003 CET.