A.12.1 Font markup

\abs-fontsize size (number) arg (markup)

Use size as the absolute font size (in points) to display arg.

This function adjusts the baseline-skip and word-space properties accordingly.

\markup {
  default text font size
  \hspace #2
  \abs-fontsize #16 { text font size 16 }
  \hspace #2
  \abs-fontsize #12 { text font size 12 }
}

[image of music]

Used properties:

  • baseline-skip (3)
  • word-space (0.6)
\bold arg (markup)

Print arg with a bold face.

\markup {
  default
  \hspace #2
  \bold bold
}

[image of music]

The code \markup \bold … is a shorthand for \markup \override #'(font-series . bold) … – using the more verbose form, it is possible to obtain nuances such as semi-bold, if the text font has such variants. Refer to the documentation for the font-series properties (User backend properties).

\box arg (markup)

Draw a box around arg.

This function looks at the thickness, box-padding, and font-size properties to determine the line thickness and padding around the markup.

\markup {
  \override #'(box-padding . 0.5)
  \box \line { V. S. }
}

[image of music]

Note that the box does not horizontally displace its argument. Use markup commands like \left-align or \table to make LilyPond realign it.

\markup {
  \override #'(box-padding . 1.5)
  \column {
    "text"
    \box "text"
    \left-align \box "text"
  }
}

[image of music]

Used properties:

  • box-padding (0.2)
  • font-size (0)
  • thickness (1)
\caps arg (markup)

Print arg in (fake) small caps.

This function is a copy of the \smallCaps command.

\markup {
  default
  \hspace #2
  \caps {
    Text in small caps
  }
}

[image of music]

Use \fontCaps for real small caps (if the font provides it).

\dynamic arg (markup)

Print arg using the (music) font for dynamics.

This font only contains letters f, m, n, p, r, s, and z. When producing phrases like ‘più f’, the normal words (like ‘più’) should be done in a different font. The recommended font for this is bold and italic.

\markup {
  \dynamic {
    sfzp
  }
}

[image of music]

\figured-bass arg (markup)

Set arg as small numbers for figured bass.

Specially slashed digits can be achieved with a trailing backslash (for numbers 6, 7, and 9) or a trailing plus (for numbers 2, 4, and 5).9

The use of a backslash is in analogy to \figuremode (see Entering figured bass). Note that to get a backslash character in markup it must be escaped by doubling it. Additionally, it must be put into double quotes.

\markup {
  \figured-bass {
    2 3 4+ 7 "9\\"
  }
}

[image of music]

\finger arg (markup)

Set arg as small numbers for fingering instructions.

\markup {
  \finger {
    1 2 3 4 5
  }
}

[image of music]

\fontCaps arg (markup)

Print arg in small caps.

This command sets the font-variant property to small-caps.

Unlike \smallCaps, which merely uses capital letters at a smaller font size, this uses the actual variant of the font for small caps. (As a consequence, if you configure a custom text font, this command has no effect if that font does not have a small caps variant.)

\markup \fontCaps "Small caps"

[image of music]

\fontsize increment (number) arg (markup)

Increase current font size by increment to print arg.

This function adjusts the baseline-skip and word-space properties accordingly.

\markup {
  default
  \hspace #2
  \fontsize #-1.5 smaller
}

[image of music]

Used properties:

  • baseline-skip (2)
  • word-space (1)
  • font-size (0)
\huge arg (markup)

Set font size to value 2 to print arg.

\markup {
  default
  \hspace #2
  \huge huge
}

[image of music]

\italic arg (markup)

Print arg in italics.

This command sets the font-shape property to italic.

\markup {
  default
  \hspace #2
  \italic italic
}

[image of music]

\large arg (markup)

Set font size to value 1 to print arg.

\markup {
  default
  \hspace #2
  \large large
}

[image of music]

\larger arg (markup)

Increase current font size by 1 to print arg.

This function adjusts the baseline-skip and word-space properties accordingly.

\markup {
  default
  \hspace #2
  \larger larger
}

[image of music]

\magnify sz (number) arg (markup)

Magnify current font by factor sz to print arg.

\markup {
  default
  \hspace #2
  \magnify #1.5 {
    50% larger
  }
}

[image of music]

Note that magnification only works if a font name is explicitly selected. Use \fontsize otherwise.

\normal-size-sub arg (markup)

Set arg in subscript with a normal font size.

\markup {
  default
  \normal-size-sub {
    subscript in standard size
  }
}

[image of music]

Used properties:

  • font-size (0)
\normal-size-super arg (markup)

Set arg in superscript with a normal font size.

\markup {
  default
  \normal-size-super {
    superscript in standard size
  }
}

[image of music]

Used properties:

  • font-size (0)
\normal-text arg (markup)

Print arg with default text font.

This resets all font-related properties (except the size), no matter what font was used earlier.

\markup {
  \huge \bold \sans \fontCaps {
    huge bold sans caps
    \hspace #2
    \normal-text {
      huge normal
    }
    \hspace #2
    as before
  }
}

[image of music]

\normal-weight arg (markup)

Switch to normal weight (in contrast to bold) to print arg.

This command sets the font-series property to normal.

\markup {
  \bold {
    some bold text
    \hspace #2
    \normal-weight {
      normal font series
    }
    \hspace #2
    bold again
  }
}

[image of music]

\normalsize arg (markup)

Set font size to default (i.e., to value 0) to print arg.

\markup {
  \teeny {
    this is very small
    \hspace #2
    \normalsize {
      normal size
    }
    \hspace #2
    teeny again
  }
}

[image of music]

\number arg (markup)

Print arg using the (music) font for numbers.

This font also contains symbols for figured bass, some punctuation, spaces of various widths, some letters and text variants of accidentals. Use \dynamic to access the (very small number of) letters. For accidentals you might use \number in combination with Unicode characters to access the text representation forms of accidental glyphs, as the following table shows.

[image of music]

To get accidentals protected against overrides of font-name it is preferable to use \text-doubleflat, \text-flat, \text-natural, \text-sharp, \text-doublesharp or the general \text-accidental for the text variants of accidentals.

The appearance of digits in the Emmentaler font can be controlled with four OpenType features: ‘tnum’, ‘cv47’, ‘ss01’, and ‘kern’, which can be arbitrarily combined.

tnum

If off (which is the default), glyphs ‘zero’ to ‘nine’ have no left and right side bearings. If on, the glyphs all have the same advance width by making the bearings non-zero.

cv47

If on, glyphs ‘four’ and ‘seven’ have shorter vertical strokes. Default is off.

ss01

If on, glyphs ‘zero’ to ‘nine’ have a fatter design, making them more readable at small sizes. Default is off.

kern

If on (which is the default), provide pairwise kerning between (most) glyphs.

\markuplist
  \number
  \fontsize #4.5
  \override #'((padding . 2)
               (baseline-skip . 4)
               (box-padding . 0)
               (thickness . 0.1))
  \table #'(-1 -1 -1 -1) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 }
    \normal-text \normalsize "(time signatures)"
    \override #'(font-features .("cv47")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(alternatives)"
    \override #'(font-features .("tnum" "cv47" "-kern")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(fixed-width)"
    \override #'(font-features . ("tnum" "cv47" "ss01")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(figured bass)"
    \override #'(font-features . ("cv47" "ss01")) {
      0123456789 \box 147 \concat { \box 1 \box 4 \box 7 } }
    \normal-text \normalsize "(fingering)"
  }

[image of music]

See also the markup commands \figured-bass and \finger, which set the font features accordingly.

\overtie arg (markup)

Overtie arg.

\markup \line {
  \overtie "overtied"
  \override #'((offset . 5) (thickness . 1))
  \overtie "overtied"
  \override #'((offset . 1) (thickness . 5))
  \overtie "overtied"
}

[image of music]

Used properties:

  • shorten-pair ((0 . 0))
  • height-limit (0.7)
  • direction (1)
  • offset (2)
  • thickness (1)
\replace replacements (list) arg (markup)

Use replacements to replace strings in arg.

Each (key . value) pair of the replacements alist specifies what should be replaced; key gets replaced by value. Note the quasiquoting syntax with a backquote in the second example.

\markup \replace #'(("2nd" . "Second"))
  "2nd time"
\markup \replace
  #`(("2nd" . ,#{ \markup \concat { 2 \super nd } #}))
  \center-column {
    \line { Play only }
    \line { the 2nd time }
  }

[image of music]

Used properties:

  • replacement-alist
\sans arg (markup)

Print arg with a sans-serif font.

This command sets the font-family property to sans.

\markup {
  default
  \hspace #2
  \sans {
    sans serif
  }
}

[image of music]

\serif arg (markup)

Print arg with a serif font.

This command sets the font-family property to serif.

\markup {
  \sans \bold {
    sans serif, bold
    \hspace #2
    \serif {
      text in serif font
    }
    \hspace #2
    return to sans
  }
}

[image of music]

\simple str (string)

Print string str.

\markup \simple "x" is equivalent to \markup "x". This command was previously used internally, but no longer is, and is being kept for backward compatibility only.

\small arg (markup)

Set font size to value -1 to print arg.

\markup {
  default
  \hspace #2
  \small small
}

[image of music]

\smallCaps arg (markup)

Print arg in (fake) small caps.

Unlike \fontCaps, which uses the actual small caps variant of the current font, this fakes small caps by using capital letters at a smaller font size. It can thus be used for fonts that don’t have a small caps variant.

\markup {
  default
  \hspace #2
  \smallCaps {
    Text in small caps
  }
}

[image of music]

\smaller arg (markup)

Decrease current font size by 1 to print arg.

This function adjusts the baseline-skip and word-space properties accordingly.

\markup {
  \fontsize #3.5 {
    large text
    \hspace #2
    \smaller { smaller text }
    \hspace #2
    large text
  }
}

[image of music]

\sub arg (markup)

Set arg in subscript.

\markup { \concat { H \sub 2 O } }

[image of music]

Ssee also \super.

Used properties:

  • font-size (0)
\super arg (markup)

Set arg in superscript.

\markup { E = \concat { mc \super 2 } }

[image of music]

See also \sub.

Used properties:

  • font-size (0)
\teeny arg (markup)

Set font size to value -3 to print arg.

\markup {
  default
  \hspace #2
  \teeny teeny
}

[image of music]

\tie arg (markup)

Add a horizontal bow at the bottom or top of arg.

This function uses make-tie-stencil to create the bow; it looks at the thickness and offset properties to determine the line thickness and vertical offset, respectively. The added bow fits the extent of arg; use the shorten-pair property to modify this. The direction property may be set explicitly using override or direction modifiers, or implicitly by using voiceOne, etc.

\markup {
  \override #'(direction . 1)
  \tie "above"
  \override #'(direction . -1)
  \tie "below"
}

[image of music]

See also \undertie and \overtie, which are shorthands for this function.

Used properties:

  • shorten-pair ((0 . 0))
  • height-limit (0.7)
  • direction (1)
  • offset (2)
  • thickness (1)
\tiny arg (markup)

Set font size to value -2 to print arg.

\markup {
  default
  \hspace #2
  \tiny tiny
}

[image of music]

\typewriter arg (markup)

Print arg in typewriter.

This command sets the font-family property to typewriter, also switching off the ‘liga’ OpenType feature to disable ligatures like ‘ff’ or ‘fi’.

\markup {
  "default fi ff"
  \hspace #2
  \typewriter "typewriter fi ff"
}

[image of music]

\underline arg (markup)

Underline arg.

This function looks at the property thickness to determine the line thickness, at offset to determine the line’s vertical offset from arg, and at underline-skip to determine the distance of additional lines from the others.

The underline-shift property is used to make subsequent calls work correctly. Overriding it makes little sense since it would end up adding the provided value to the one of offset.

\markup \justify-line {
  \underline "underlined"
  \override #'(offset . 5)
  \override #'(thickness . 1)
  \underline "underlined"
  \override #'(offset . 1)
  \override #'(thickness . 5)
  \underline "underlined"
  \override #'(offset . 5)
  \override #'(underline-skip . 4)
  \underline \underline \underline "underlined thrice"
}

[image of music]

Used properties:

  • underline-skip (2)
  • underline-shift (0)
  • offset (2)
  • thickness (1)
\undertie arg (markup)

Print a tie under arg.

\markup \line {
  \undertie "undertied"
  \override #'((offset . 5) (thickness . 1))
  \undertie "undertied"
  \override #'((offset . 1) (thickness . 5))
  \undertie "undertied"
}

[image of music]

Used properties:

  • shorten-pair ((0 . 0))
  • height-limit (0.7)
  • direction (1)
  • offset (2)
  • thickness (1)
\upright arg (markup)

Print arg upright.

This command is the opposite of \italic; it sets the font-shape property to upright.

\markup {
  \italic {
    italic text
    \hspace #2
    \upright {
      upright text
    }
    \hspace #2
    italic again
  }
}

[image of music]

\volta-number arg (markup)

Set arg in a font appropriate for volta numbers.

\markup \volta-number "4."

[image of music]

\with-string-transformer transformer (procedure) arg (markup)

Apply string transformer function transformer to arg.

Whenever a string is interpreted inside arg, function transformer is called first, and its result is then interpreted. The arguments passed to transformer are the output definition, the property alist chain, and the markup arg. See New markup command definition about the two first arguments.

\markup \with-string-transformer
  #(lambda (layout props str)
     (string-upcase str))
  \concat { "abc" \larger "def" }

[image of music]


Footnotes

(9)

Internally, this works by activating the ‘dlig’ OpenType feature of the Emmentaler font.


LilyPond Notation Reference v2.25.21 (development-branch).