| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section explains how to include text (with various formatting) in music scores.
| 1.8.1 Writing text | ||
| 1.8.2 Formatting text | ||
| 1.8.3 Fonts |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section introduces different ways of adding text to a score.
Note: To write accented and special text (such as characters from other languages), simply insert the characters directly into the LilyPond file. The file must be saved as UTF-8. For more information, see Text encoding.
| Text objects overview | ||
| Text scripts | ||
| Text spanners | ||
| Text marks | ||
| Separate text |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Text objects are entered either as simple strings between
double quotes, or as \markup blocks that can accept
a variety of advanced text formatting and graphical enhancements,
as detailed in Formatting text.
As such, markup blocks may be used:
TextScript object (attached to notes with
-, ^ or _); see Text scripts;
RehearsalMark or MetronomeMark objects respectively
introduced with the \mark or \tempo keywords;
see Text marks;
\score block (in this specific case the
\markup {...} command is mandatory, and cannot be
omitted in favor of a simple text string between double quotes);
see Separate text;
\header block (e.g.,
title, subtitle, composer), or in specific
elements defined inside the \paper block such as
evenHeaderMarkup for page numbers. This is explained in
Titles and headers.
Many other text-based objects may be entered as markup blocks, even if that is not their primary use.
\finger command; see
Fingering instructions.
\markup
command; see Common notation for vocal music.
crescendoText; see
Dynamics.
In fact, it is possible to use \markup to customize the appearance of
virtually any graphical object (or ‘grob’), by overriding either its
text property if it has one, or its stencil property. Some of
the logic that makes this a possibility is explained in
(essay)Flexible architecture section ‘Flexible architecture’ in Essay.
The following example illustrates the ubiquity of markup blocks, not only as some of the objects listed above, but also by replacing musical objects with text objects through various methods.
\header { title = \markup "Header" } dyn = #(make-dynamic-script #{ \markup \text "DynamicText" #}) \markup \box "Top-level markup" \score { << \new ChordNames \with { majorSevenSymbol = \markup "majorSevenSymbol" } \chordmode { c1:maj7 } \new Staff { \tempo \markup "MetronomeMark" \mark \markup \smaller "RehearsalMark" \once \override TupletNumber.text = \markup "TupletNumber" \tuplet 3/2 { \once \override NoteHead.stencil = #ly:text-interface::print \once \override NoteHead.text = \markup \lower #0.5 "NoteHead" c''8^\markup \italic "TextScript" a'\finger \markup \text "Fingering" \once \override Rest.stencil = #(lambda (grob) (grob-interpret-markup grob #{ \markup "Rest" #})) r } } \new Lyrics \lyricmode { \markup \smallCaps "LyricText" 1 } \new Dynamics { s1\dyn } >> }
Notation Reference: Formatting text, Text scripts, Text spanners, Text marks, Separate text, Fingering instructions, Common notation for vocal music, Displaying chords, New dynamic marks, Dynamics, Balloon help.
Essay on automated music engraving: (essay)Flexible architecture section ‘Flexible architecture’ in Essay.
Snippets: (snippets)Text section ‘Text’ in Snippets.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Simple “quoted text” indications may be added to a score, as demonstrated in the following example. Such indications may be manually placed above or below the staff, using the syntax described in Direction and placement.
\relative { a'8^"pizz." g f e a4-"scherz." f }
This syntax is actually a shorthand; more complex text formatting may be
added to a note by explicitly using a \markup block, as described
in Formatting text.
\relative { a'8^\markup { \italic pizz. } g f e a4_\markup { \tiny scherz. \bold molto } f }
By default, text indications do not influence the note spacing. However, their widths can be taken into account: in the following example, the first text string does not affect spacing, whereas the second one does.
\relative { a'8^"pizz." g f e \textLengthOn a4_"scherzando" f }
In addition to text scripts, articulations can be attached to notes. For more information, see Articulations and ornamentations.
For more information about the relative ordering of text scripts and articulations, see (learning)Placement of objects section ‘Placement of objects’ in Learning Manual.
\textLengthOn,
\textLengthOff.
Learning Manual: (learning)Placement of objects section ‘Placement of objects’ in Learning Manual.
Notation Reference: Formatting text, Direction and placement, Articulations and ornamentations.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
Checking to make sure that text scripts and lyrics are within the margins requires additional calculations. In cases where slightly faster performance is desired, use
\override Score.PaperColumn.keep-inside-line = ##f |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Some performance indications, e.g., rallentando or accelerando, are written as text and are extended over multiple notes with dotted lines. Such objects, called “spanners”, may be created from one note to another using the following syntax:
\relative { \override TextSpanner.bound-details.left.text = "rit." b'1\startTextSpan e,\stopTextSpan }
The string to be printed is set through object properties. By default
it is printed in italic characters, but different formatting can be
obtained using \markup blocks, as described in
Formatting text.
\relative { \override TextSpanner.bound-details.left.text = \markup { \upright "rit." } b'1\startTextSpan c e,\stopTextSpan }
The line style, as well as the text string, can be defined as an object property. This syntax is described in Line styles.
\textSpannerUp,
\textSpannerDown,
\textSpannerNeutral.
LilyPond is only able to handle one text spanner per voice.
Dynamics text spanner postfix
Custom text spanners can be defined and used with hairpin and text
crescendos. \< and \> produce hairpins by default,
\cresc etc. produce text spanners by default.
% Some sample text dynamic spanners, to be used as postfix operators crpoco = #(make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text "cresc. poco a poco") \relative c' { c4\cresc d4 e4 f4 | g4 a4\! b4\crpoco c4 | c4 d4 e4 f4 | g4 a4\! b4\< c4 | g4\dim a4 b4\decresc c4\! }
Dynamics custom text spanner postfix
Postfix functions for custom crescendo text spanners. The spanners should start on the first note of the measure. One has to use -\mycresc, otherwise the spanner start will rather be assigned to the next note.
% Two functions for (de)crescendo spanners where you can explicitly give the % spanner text. mycresc = #(define-music-function (mymarkup) (markup?) (make-music 'CrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) mydecresc = #(define-music-function (mymarkup) (markup?) (make-music 'DecrescendoEvent 'span-direction START 'span-type 'text 'span-text mymarkup)) \relative c' { c4-\mycresc "custom cresc" c4 c4 c4 | c4 c4 c4 c4 | c4-\mydecresc "custom decresc" c4 c4 c4 | c4 c4\! c4 c4 }
Notation Reference: Line styles, Dynamics, Formatting text.
Snippets: (snippets)Text section ‘Text’ in Snippets, (snippets)Expressive marks section ‘Expressive marks’ in Snippets.
Internals Reference: (internals)TextSpanner section ‘TextSpanner’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Various text elements may be added to a score using the syntax described in Rehearsal marks:
\relative { \mark "Verse" c'2 g' \bar "||" \mark "Chorus" g2 c, \bar "|." }
This syntax makes it possible to put any text on a bar line;
more complex text formatting may be added using a \markup
block, as described in Formatting text:
\relative { <c' e>1 \mark \markup { \italic { colla parte } } <d f>2 <e g> <c f aes>1 }
This syntax also allows to print special signs, like coda, segno or fermata, by specifying the appropriate symbol name as explained in Music notation inside markup:
\relative { <bes' f>2 <aes d> \mark \markup { \musicglyph "scripts.ufermata" } <e g>1 }
Such objects are only typeset above the top staff of the score; depending on whether they are specified at the end or the middle of a bar, they can be placed above the bar line or between notes. When specified at a line break, the mark will be printed at the beginning of the next line.
\relative c'' { \mark "Allegro" c1 c \mark "assai" \break c c }
\markLengthOn,
\markLengthOff.
Printing marks at the end of a line
Marks can be printed at the end of the current line, instead of the beginning of the following line. In such cases, it might be preferable to align the right end of the mark with the bar line.
\relative c'' { g2 c d,2 a' \once \override Score.RehearsalMark.break-visibility = #end-of-line-visible \once \override Score.RehearsalMark.self-alignment-X = #RIGHT \mark "D.C. al Fine" \break g2 b, c1 \bar "||" }
Printing marks on every staff
Although text marks are normally only printed above the topmost staff, they may also be printed on every staff.
\score { << \new Staff { c''1 \mark "molto" c'' } \new Staff { c'1 \mark "molto" c' } >> \layout { \context { \Score \remove "Mark_engraver" \remove "Staff_collecting_engraver" } \context { \Staff \consists "Mark_engraver" \consists "Staff_collecting_engraver" } } }
Notation Reference: Rehearsal marks, Formatting text, Music notation inside markup, The Emmentaler font.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)MarkEvent section ‘MarkEvent’ in Internals Reference, (internals)Mark_engraver section ‘Mark_engraver’ in Internals Reference, (internals)RehearsalMark section ‘RehearsalMark’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A \markup block can exist by itself, outside of any
\score block, as a “top-level expression”. This syntax
is described in File structure.
\markup { Tomorrow, and tomorrow, and tomorrow... }
This allows printing text separately from the music, which is particularly useful when the input file contains several music pieces, as described in Multiple scores in a book.
\score { c'1 } \markup { Tomorrow, and tomorrow, and tomorrow... } \score { c'1 }
Separate text blocks can be spread over multiple pages, making it possible to print text documents or books entirely within LilyPond. This feature, and the specific syntax it requires, are described in Multi-page markup.
\markup,
\markuplist.
Stand-alone two-column markup
Stand-alone text may be arranged in several columns using
\markup commands:
\markup { \fill-line { \hspace #1 \column { \line { O sacrum convivium } \line { in quo Christus sumitur, } \line { recolitur memoria passionis ejus, } \line { mens impletur gratia, } \line { futurae gloriae nobis pignus datur. } \line { Amen. } } \hspace #2 \column \italic { \line { O sacred feast } \line { in which Christ is received, } \line { the memory of His Passion is renewed, } \line { the mind is filled with grace, } \line { and a pledge of future glory is given to us. } \line { Amen. } } \hspace #1 } }
Notation Reference: Formatting text, File structure, Multiple scores in a book, Multi-page markup.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section presents basic and advanced text formatting,
using the \markup mode specific syntax.
| Text markup introduction | ||
| Selecting font and font size | ||
| Text alignment | ||
| Graphic notation inside markup | ||
| Music notation inside markup | ||
| Multi-page markup |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A \markup block is used to typeset text with an extensible
syntax called “markup mode”. Such blocks may be used anywhere,
as explained in Text objects overview.
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 markup commands, entered using the
backslash \ character. Such commands only affect the first
following expression.
\relative { a'1-\markup intenso a2^\markup { poco \italic più forte } c e1 d2_\markup { \italic "string. assai" } e b1^\markup { \bold { molto \italic agitato } } c }
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.
Double quotation marks themselves may be printed by preceding them
with backslashes.
\relative { a'1^"\italic markup..." a_\markup { \italic "... prints \"italic\" letters!" } a a }
To be treated as a distinct expression, a list of words needs to be
enclosed with double quotes or preceded by a command. The way markup
expressions are defined affects how these expressions will be stacked,
centered and aligned; in the following example, the second
\markup expression is treated the same as the first one:
\relative c'' { c1^\markup { \center-column { a bbb c } } c1^\markup { \center-column { a { bbb c } } } c1^\markup { \center-column { a \line { bbb c } } } c1^\markup { \center-column { a "bbb c" } } }
Markups can be stored in variables. Such variables may be directly attached to notes:
allegro = \markup { \bold \large Allegro } { d''8.^\allegro d'16 d'4 r2 }
An exhaustive list of \markup-specific commands can be found in
Text markup commands.
The inner workings of these commands, and how to implement new ones, is
explained in
(extending)Markup functions section ‘Markup functions’ in Extending.
Notation Reference: Text objects overview, Text markup commands.
Extending LilyPond: (extending)Markup functions section ‘Markup functions’ in Extending.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Installed Files: ‘scm/markup.scm’.
Syntax error messages for markup mode can be confusing.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Basic font switching is supported in markup mode:
\relative { d''1^\markup { \bold { Più mosso } \italic { non troppo \underline Vivo } } r2 r4 r8 d,_\markup { \italic quasi \smallCaps Tromba } f1 d2 r }
The font size can be altered, relative to the global staff size, in a number of different ways.
It can be set to predefined size.
\relative b' { b1_\markup { \huge Sinfonia } b1^\markup { \teeny da } b1-\markup { \normalsize camera } }
It can be set relative to its previous value.
\relative b' { b1_\markup { \larger Sinfonia } b1^\markup { \smaller da } b1-\markup { \magnify #0.6 camera } }
It can be increased or decreased relative to the value set by the global staff size.
\relative b' { b1_\markup { \fontsize #-2 Sinfonia } b1^\markup { \fontsize #1 da } b1-\markup { \fontsize #3 camera } }
It can also be set to a fixed point-size, regardless of the global staff size.
\relative b' { b1_\markup { \abs-fontsize #20 Sinfonia } b1^\markup { \abs-fontsize #8 da } b1-\markup { \abs-fontsize #14 camera } }
If the text includes spaces, then it is best to put it all inside quote marks, so that the size of each space is appropriate for the size of the other characters.
\markup \fontsize #6 \bold { Sinfonia da camera } \markup \fontsize #6 \bold { "Sinfonia da camera" }
Text may be printed as subscript or superscript. By default these are printed in a smaller size, but a normal size can be used as well:
\markup { \column { \line { 1 \super st movement } \line { 1 \normal-size-super st movement \sub { (part two) } } } }
The markup mode provides an easy way to select alternate font families. The default serif font, of roman type, is automatically selected unless specified otherwise; on the last line of the following example, there is no difference between the first and the second word.
\markup { \column { \line { Act \number 1 } \line { \sans { Scene I. } } \line { \typewriter { Verona. An open place. } } \line { Enter \roman Valentine and Proteus. } } }
Some of these font families, used for specific items such as numbers or dynamics, do not provide all characters, as mentioned in New dynamic marks and Manual repeat marks.
When used inside a word, some font-switching or formatting commands may produce an unwanted blank space. This can easily be solved by concatenating the text elements together:
\markup { \column { \line { \concat { 1 \super st } movement } \line { \concat { \dynamic p , } \italic { con dolce espressione } } } }
An exhaustive list of font switching commands and custom font usage commands can be found in Font.
Defining custom font sets is also possible, as explained in Fonts.
\teeny,
\tiny,
\small,
\normalsize,
\large,
\huge,
\smaller,
\larger.
Notation Reference: Font, New dynamic marks, Manual repeat marks, Fonts.
Installed Files: ‘scm/define-markup-commands.scm’.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
Using the font sizing commands \teeny, \tiny,
\small, \normalsize, \large, and
\huge will lead to inconsistent line spacing compared to
using \fontsize.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This subsection discusses how to place text in markup mode. Markup objects can also be moved as a whole, using the syntax described in (learning)Moving objects section ‘Moving objects’ in Learning Manual.
Markup objects may be aligned in different ways. By default, a text indication is aligned on its left edge: in the following example, there is no difference between the first and the second markup. That example also demonstrates various syntactically correct ways of placing the alignment commands:
\relative { d''1-\markup { poco } f d-\markup { \left-align poco } f d-\markup { \center-align { poco } } f d-\markup \right-align { poco } }
Horizontal alignment may be fine-tuned using a numeric value:
\relative { a'1-\markup { \halign #-1 poco } e' a,-\markup { \halign #0 poco } e' a,-\markup { \halign #0.5 poco } e' a,-\markup { \halign #2 poco } }
Lastly, words and any other objects may be moved by preceding them with padding. Negative padding is also supported, and will move any objects that follow in the opposite direction. Although padding is normally invisible, in the following example some commands have been added to make it appear more clearly:
\relative { d''1-\markup { poco } f d-\markup { \with-color #darkred \box \hspace #4 poco } f d-\markup { \with-color #darkred \box \hspace #-4 poco } f d-\markup { \with-color #darkred \box \hspace #10 poco } }
Some objects may have alignment procedures of their own, and therefore are not affected by these commands. It is possible to move such markup objects as a whole, as shown for instance in Text marks.
Vertical alignment can be set in a similar way. As stated above, markup objects can be moved as a whole; however, it is also possible to move specific elements inside a markup block.
\relative { d'2^\markup { Acte I \raise #2 { Scène 1 } } a' g_\markup { \lower #4 \bold { Très modéré } } a d,^\markup \raise #4 \italic { Une forêt. } a'4 a g2 a }
Some commands can affect both the horizontal and vertical alignment of text objects in markup mode:
\relative { d'2^\markup { Acte I \translate #'(-1 . 2) "Scène 1" } a' g_\markup { \general-align #Y #3.2 \bold "Très modéré" } a d,^\markup \translate-scaled #'(-1 . 2) \teeny { "Une forêt." } a'4 a g2 a }
Here again, padding (either positive or negative) is a convenient way of positioning objects vertically, when inserted into markup columns:
\relative { d'2^\markup { Acte I \column { \with-color #darkred \box \vspace #-1 "Scène 1" } } a' g_\markup \column { \with-color #darkred \box \vspace #1 "Très modéré" } a d,^\markup \column { "Une forêt." \with-color #darkred \box \vspace #2 } a'4 a g2 a }
A markup object may include several lines of text. In the following example, each element or expression is placed on its own line, either left-aligned or centered:
\markup { \column { a "b c" \line { d e f } } \hspace #10 \center-column { a "b c" \line { d e f } } }
Similarly, a list of elements or expressions may be spread to fill the entire horizontal line width (if there is only one element, it will be centered on the page). These expressions can, in turn, include multi-line text or any other markup expression:
\markup { \fill-line { \line { William S. Gilbert } \center-column { \huge \smallCaps "The Mikado" or \smallCaps "The Town of Titipu" } \line { Sir Arthur Sullivan } } } \markup { \fill-line { 1885 } }
Elements may be spread to fill any specified width by overriding
the line-width property. By default it is set to
#f which indicates the entire line:
\markup { \column { \fill-line { left center right } \null \override #'(line-width . 30) \fill-line { left center right } } }
Long text indications can also be automatically wrapped accordingly to the given line width. These will be either left-aligned or justified, as shown in the following example.
\markup { \column { \line \smallCaps { La vida breve } \line \bold { Acto I } \wordwrap \italic { (La escena representa el corral de una casa de gitanos en el Albaicín de Granada. Al fondo una puerta por la que se ve el negro interior de una Fragua, iluminado por los rojos resplandores del fuego.) } \hspace #0 \line \bold { Acto II } \override #'(line-width . 50) \justify \italic { (Calle de Granada. Fachada de la casa de Carmela y su hermano Manuel con grandes ventanas abiertas a través de las que se ve el patio donde se celebra una alegre fiesta) } } }
An exhaustive list of text alignment commands can be found in Align.
Learning Manual: (learning)Moving objects section ‘Moving objects’ in Learning Manual.
Notation Reference: Align, Text marks.
Installed Files: ‘scm/define-markup-commands.scm’.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Various graphic objects may be added to a score, using markup commands.
Some markup commands allow decoration of text elements with graphics, as demonstrated in the following example.
\markup \fill-line { \center-column { \circle Jack \box "in the box" \null \line { Erik Satie \hspace #3 \bracket "1866 - 1925" } \null \rounded-box \bold Prelude } }
Some commands may require an increase in the padding around the text; this is achieved with some markup commands exhaustively described in Align.
\markup \fill-line { \center-column { \box "Charles Ives (1874 - 1954)" \null \box \pad-markup #2 "THE UNANSWERED QUESTION" \box \pad-x #8 "A Cosmic Landscape" \null } } \markup \column { \line { \hspace #10 \box \pad-to-box #'(-5 . 20) #'(0 . 5) \bold "Largo to Presto" } \pad-around #3 "String quartet keeps very even time, Flute quartet keeps very uneven time." }
Other graphic elements or symbols may be printed without requiring any text. As with any markup expression, such objects can be combined.
\markup { \combine \draw-circle #4 #0.4 ##f \filled-box #'(-4 . 4) #'(-0.5 . 0.5) #1 \hspace #5 \center-column { \triangle ##t \combine \draw-line #'(0 . 4) \arrow-head #Y #DOWN ##f } }
Advanced graphic features include the ability to include external image files converted to the Encapsulated PostScript format (eps), or to directly embed graphics into the input file, using native PostScript code. In such a case, it may be useful to explicitly specify the size of the drawing, as demonstrated below:
c'1^\markup { \combine \epsfile #X #10 "./context-example.eps" \with-dimensions #'(0 . 6) #'(0 . 10) \postscript " -2 3 translate 2.7 2 scale newpath 2 -1 moveto 4 -2 4 1 1 arct 4 2 3 3 1 arct 0 4 0 3 1 arct 0 0 1 -1 1 arct closepath stroke" } c'
An exhaustive list of graphics-specific commands can be found in Graphic.
Notation Reference: Align, Dimensions, Editorial annotations, Graphic.
Installed Files: ‘scm/define-markup-commands.scm’, ‘scm/stencil.scm’.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Various musical notation elements may be added to a score, inside a markup object.
Notes and accidentals can be entered using markup commands:
a'2 a'^\markup { \note {4} #1 = \note-by-number #1 #1 #1.5 } b'1_\markup { \natural \semiflat \flat \sesquiflat \doubleflat } \glissando a'1_\markup { \natural \semisharp \sharp \sesquisharp \doublesharp } \glissando b'
Other notation objects may also be printed in markup mode:
\relative { g1 bes ees\finger \markup \tied-lyric "4~1" fis_\markup { \dynamic rf } bes^\markup { \beam #8 #0.1 #0.5 } cis d-\markup { \markalphabet #8 \markletter #8 } }
More generally, any available musical symbol may be included separately in a markup object, as demonstrated below; an exhaustive list of these symbols and their names can be found in The Emmentaler font.
\relative { c''2 c'^\markup { \musicglyph "eight" } c,4 c,8._\markup { \musicglyph "clefs.G_change" } c16 c2^\markup { \musicglyph "timesig.neomensural94" } }
Another way of printing non-text glyphs is described in Fonts explained. This is useful for printing braces of various sizes.
The markup mode also supports diagrams for specific instruments:
\relative { c''1^\markup { \fret-diagram-terse "x;x;o;2;3;2;" } c^\markup { \harp-pedal "^-v|--ov^" } c c^\markup { \combine \musicglyph "accordion.discant" \combine \raise #0.5 \musicglyph "accordion.dot" \raise #1.5 \musicglyph "accordion.dot" } }
Such diagrams are documented in Instrument Specific Markup.
A whole score can even be nested inside a markup object:
\relative { c'4 d^\markup { \score { \relative { c'4 d e f } } } e f | c d e f }
An exhaustive list of music notation related commands can be found in Music.
Notation Reference: Music, The Emmentaler font, Fonts explained.
Installed Files: ‘scm/define-markup-commands.scm’, ‘scm/fret-diagrams.scm’, ‘scm/harp-pedals.scm’.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
Vertical spacing of a \score inside a markup object is controlled
by baseline-skip. Any \paper settings are ignored.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Although standard markup objects are not breakable, a specific syntax makes it possible to enter lines of text that can spread over multiple pages:
\markuplist { \justified-lines { A very long text of justified lines. ... } \wordwrap-lines { Another very long paragraph. ... } ... }
This syntax accepts a list of markups, that can be
An exhaustive list of markup list commands can be found in Text markup list commands.
Notation Reference: Text markup list commands.
Extending LilyPond: (extending)New markup list command definition section ‘New markup list command definition’ in Extending.
Installed Files: ‘scm/define-markup-commands.scm’.
Snippets: (snippets)Text section ‘Text’ in Snippets.
Internals Reference: (internals)TextScript section ‘TextScript’ in Internals Reference.
\markuplist.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section presents the way fonts are handled, and how they may be changed in scores.
| Fonts explained | ||
| Single entry fonts | ||
| Entire document fonts |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Fonts are handled through several libraries. FontConfig is used to detect available fonts; the selected fonts are rendered using Pango.
In addition to any font already installed on the operating system, additional fonts may be added to the set detected by FontConfig (and thus available in LilyPond scores) through the following commands:
#(ly:font-config-add-font "path/to/font-file.otf") #(ly:font-config-add-directory "path/to/directory/") |
Both of these commands accept either absolute or relative paths, which makes it possible to compile a score on any system by simply copying the relevant font files alongside the source code.
Having been detected, fonts must then be selected using the
methods described in Single entry fonts and
Entire document fonts. As it prints the complete
list of available fonts in the console log, the command
#(ly:font-config-display-fonts) may be of use
to verify which fonts are indeed detected, and under which
names (as these may differ from the file names themselves).
Music notation fonts can be described as a set of specific glyphs, ordered in several families. The following syntax allows LilyPond’s various Feta glyphs to be used directly in markup mode:
a'1^\markup { \vcenter { \override #'(font-encoding . fetaBraces) \lookup "brace120" \override #'(font-encoding . fetaText) \column { 1 3 sf } \override #'(font-encoding . fetaMusic) \lookup "noteheads.s0petrucci" } }
However, all these glyphs except the braces of various sizes contained
in fetaBraces are available using the simpler syntax described
in Music notation inside markup.
When using the glyphs contained in fetaBraces, the size of the
brace is specified by the numerical part of the glyph name, in
arbitrary units. Any integer from 0 to 575 inclusive
may be specified, 0 giving the smallest brace. The optimum
value must be determined by trial and error. These glyphs are all
left braces; right braces may be obtained by rotation, see
Rotating objects.
Three families of text fonts are made available: the roman (serif) font, the sans font, and the typewriter font.
For svg backend:
| Family | Default font |
|---|---|
| roman | serif |
| sans | sans-serif |
| typewriter | monospace |
serif, sans-serif, and monospace are
generic-family in SVG and CSS specifications.
For other backends:
| Family | Default font (alias) | Alias definition lists |
|---|---|---|
| roman | LilyPond Serif | TeX Gyre Schola, C059, Century SchoolBook URW, Century Schoolbook L, DejaVu Serif, ..., serif |
| sans | LilyPond Sans Serif | TeX Gyre Heros, Nimbus Sans, Nimbus Sans L, DejaVu Sans, ..., sans-serif |
| typewriter | LilyPond Monospace | TeX Gyre Cursor, Nimbus Mono PS, Nimbus Mono, Nimbus Mono L, DejaVu Sans Mono, ..., monospace |
LilyPond Serif, LilyPond Sans Serif,
and LilyPond Monospace are font aliases defined
in the LilyPond dedicated FontConfig configuration file
00-lilypond-fonts.conf.
Where a character doesn’t exist in the first font listed,
the next font listed will be used instead for that character.
For details of alias definitions, please see
to 00-lilypond-fonts.conf under the installed directory.
Each family may include different shapes and series. The following
example demonstrates the ability to select alternate families, shapes,
series and sizes. The value supplied to font-size is the
required change from the default size.
\override Score.RehearsalMark.font-family = #'typewriter \mark \markup "Ouverture" \override Voice.TextScript.font-shape = #'italic \override Voice.TextScript.font-series = #'bold d''2.^\markup "Allegro" \override Voice.TextScript.font-size = #-3 c''4^smaller
A similar syntax may be used in markup mode; however in this case it is preferable to use the simpler syntax explained in Selecting font and font size:
\markup { \column { \line { \override #'((font-shape . italic) (font-size . 4)) Idomeneo, } \line { \override #'(font-family . typewriter) { \override #'(font-series . bold) re di } \override #'(font-family . sans) Creta } } }
When using OpenType fonts, font features can be used. OpenType font scripts and languages can not be specified. Note: Not all OpenType fonts have all functions. If you request a feature that doesn’t exist in the chosen font, then the feature is simply ignored.
% True small caps \markup { Normal Style: Hello HELLO } \markup { \caps { Small Caps: Hello } } \markup { \override #'(font-features . ("smcp")) { True Small Caps: Hello } } % Number styles \markup { Normal Number Style: 0123456789 } \markup { \override #'(font-features . ("onum")) { Old Number Style: 0123456789 } } % Stylistic Alternates \markup { \override #'(font-features . ("salt 0")) { Stylistic Alternates 0: εφπρθ } } \markup { \override #'(font-features . ("salt 1")) { Stylistic Alternates 1: εφπρθ } } % Multiple features \markup { \override #'(font-features . ("onum" "smcp" "salt 1")) { Multiple features: Hello 0123456789 εφπρθ } }
For the full OpenType font feature list please see: https://www.microsoft.com/typography/otspec/featurelist.htm
For identifying features of OpenType fonts please see: http://lists.gnu.org/archive/html/lilypond-devel/2017-08/msg00004.html
Although it is easy to switch between preconfigured fonts, it is also possible to use other fonts, as explained in the following sections: Single entry fonts and Entire document fonts.
Notation Reference: The Emmentaler font, Music notation inside markup, Rotating objects, Selecting font and font size, Font.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Any font that is installed on the operating system and recognized by FontConfig may be used in a score, using the following syntax:
\override Staff.TimeSignature.font-name = "Bitstream Charter" \override Staff.TimeSignature.font-size = #2 \time 3/4 a'1_\markup { \override #'(font-name . "Bitstream Vera Sans,sans-serif, Oblique Bold") { Vera Oblique Bold } }
font-name can be described using a comma-separated list of ‘fonts’ and a white-space separated list of ‘styles’. As long as the ‘font’ in the list is installed and contains requested glyph, it will be used, otherwise the next font in the list will be used instead.
Running lilypond with the following option displays a list of all available fonts on the operating system:
lilypond -dshow-available-fonts |
Notation Reference: Fonts explained, Entire document fonts.
Snippets: (snippets)Text section ‘Text’ in Snippets.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
It is possible to change the fonts to be used as the default fonts in the roman, sans and typewriter font families by specifying them, in that order, as shown in the example below, which automatically scales the fonts with the value set for the global staff size. Similar to Single entry fonts, it can be described using a comma-separated list of ‘fonts’. However, font ‘styles’ can not be described. For an explanation of fonts, see Fonts explained.
\paper { #(define fonts (make-pango-font-tree "Times New Roman" "Nimbus Sans,Nimbus Sans L" "Luxi Mono" (/ staff-height pt 20))) } \relative c'{ c1-\markup { roman, \sans sans, \typewriter typewriter. } }
Note: make-pango-font-tree resets the notation fonts to default of
Emmentaler.
The following syntax allows you to change the specific fonts,
leaving others to the default values.
The following example has the same effect
as the above make-pango-font-tree example.
The same as make-pango-font-tree,
you can specify a comma-separated list of ‘fonts’ for roman,
sans, and typewriter categories.
If you don’t change the staff size from the default of 20 pt,
#:factor (/ staff-height pt 20) is unnecessary.
\paper {
#(define fonts
(set-global-fonts
#:roman "Times New Roman"
#:sans "Nimbus Sans,Nimbus Sans L"
#:typewriter "Luxi Mono"
#:factor (/ staff-height pt 20) ; unnecessary if the staff size is default
))
}
|
It also can specify the notation fonts. The following example also has the same effect as the above examples, because it sets the notation fonts as the default. For more information, see Replacing the notation font.
\paper {
#(define fonts
(set-global-fonts
#:music "emmentaler" ; default
#:brace "emmentaler" ; default
#:roman "Times New Roman"
#:sans "Nimbus Sans,Nimbus Sans L"
#:typewriter "Luxi Mono"
#:factor (/ staff-height pt 20) ; unnecessary if the staff size is default
))
}
|
Note: Each call to set-global-fonts completely resets both the main
notation and text fonts. If any category is left unspecified, then the default
font will be used for that category.
Each call of set-global-fonts affects each \book blocks that
follow it.
If there are multiple \book blocks and you want to use different fonts
for each, simply call set-global-fonts again, like this:
\paper {
#(define fonts
(set-global-fonts
…
))
}
\book {
…
}
\paper {
#(define fonts
(set-global-fonts
…
))
}
\book {
…
}
|
Notation Reference: Fonts explained, Single entry fonts, Selecting font and font size, Font, Replacing the notation font.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by gub on July 13, 2020 using texi2html 1.82.
Other languages: català, deutsch, español, français, italiano, 日本語.
About automatic language selection.