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? }
The markup in the example demonstrates font switching commands. The
command \bold
and \italic
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 absolute 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
\number
\italic
font-shape
to italic
.
\bold
font-series
to bold
.
Raising and lowering texts can be done with \super
and
\sub
:
c1^\markup { E "=" mc \super "2" }
If you want to give an explicit amount for lowering or raising, use
\raise
. This command takes a Scheme valued first argument, and
a markup object as second argument:
c1^\markup { C \small \raise #1.0 \bold { "9/7+" }}
The argument to
\raise
is the vertical displacement amount,
measured in (global) staff spaces. \raise
and \super
raise objects in relation to their surrounding markups. They cannot be
used to move a single text up or down, when it is above or below a
note, since the mechanism that positions it next to the note cancels
any vertical shift. For vertical positioning, use the padding
and/or extra-offset
properties.
Other commands taking single arguments include
\bracket, \hbracket
\musicglyph
\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
\char #65
produces the
letter 'A'.
\note
log
dots
dir
This produces a note with a stem pointing in dir direction, with
duration log log and dots augmentation dots. The duration
log is the negative 2-logarithm of the duration denominator. For
example, a quarter note has log 2, an eighth note 3 and a breve has
log -1.
\hspace #
amount
\markup { A \hspace #2.0 B }will put extra space between A and B, on top of the space that is normally inserted before elements on a line.
\fontsize #
size
A \fontsize #2 { B C } D
This will enlarge the B and the C by two steps.
\translate #(cons
x
y)
A \translate #(cons 2 -3) { B C } DThis moves `B C' 2 spaces to the right, and 3 down.
\magnify #
mag
A \magnify #1.1 { A } A
\override #(
key .
value)
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 > }
The markup mechanism is extensible. Refer to
scm/new-markup.scm
for more information.
scm/new-markup.scm
.
Text layout is ultimately done by TeX, which does kerning of letters. LilyPond does not account for kerning, so texts will be spaced slightly too wide.
Syntax errors for markup mode are confusing.
Markup texts cannot be used in the titling of the \header
field. Titles are made by LaTeX, so LaTeX commands should be used
for formatting.
This page is for LilyPond-2.0.1 (stable-branch).