1 @c -*- coding: utf-8; mode: texinfo; -*-
3 Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
5 When revising a translation, copy the HEAD committish of the
6 version that you are working on. See TRANSLATION for details.
12 @lilypondfile[quote]{text-headword.ly}
14 This section explains how to include text (with various
15 formatting) in your scores.
17 @cindex Text, other languages
18 @warning{To write accented and special text (such as characters
19 from other languages), simply insert the characters directly into
20 the LilyPond file. The file must be saved as UTF-8. For more
21 information, see @ref{Text encoding}.}
26 * Special text concerns::
31 @subsection Writing text
34 * Overview of text entry::
40 @node Overview of text entry
41 @subsubsection Overview of text entry
43 There are four ways to add text to scores:
47 @ref{Text scripts}: blah blah
49 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
54 @ref{Text spanners}: blah blah
56 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
58 \override TextSpanner #'bound-details #'left #'text =
59 \markup { \upright "rall" }
60 c2\startTextSpan b c\stopTextSpan a
64 @ref{Text marks}: blah blah
66 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
71 @ref{Vocal music}: blah blah, not in this section.
73 @lilypond[verbatim,quote,ragged-right]
75 \relative c'' { c4 c c c }
76 \addlyrics { one two three four }
84 Snippets: @lsrdir{Text,Text}
89 @subsubsection Text scripts
92 @cindex text items, non-empty
93 @cindex non-empty texts
95 It is possible to add arbitrary text indications with
96 @var{note}@code{-"}@var{text}@code{"}.
97 Such indications can also be manually placed
98 above or below the staff, using the
99 simple syntax described in @ref{Controlling direction and
102 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
103 d8^"pizz." e f g a4-"scherz." f
106 In LilyPond, such text strings are called @command{markup}
107 objects. This syntax is actually a shorthand; more complex text
108 formatting may be added to a note by explicitly using the
109 @code{\markup} command, as described in @ref{Text markup}.
111 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
112 d8^\markup { \italic pizz. } e f g
113 a4_\markup { \tiny scherz. \bold molto } f
116 By default, text indications do not influence the note spacing.
117 However, their widths can be taken into account:
118 in the following example, the first text string does not affect
119 spacing, whereas the second one does.
121 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
122 d8^"pizz." e f g \textLengthOn a4_"scherzando" f
127 @funindex \textLengthOn
128 @code{\textLengthOn},
129 @funindex \textLengthOff
130 @code{\textLengthOff}.
135 Notation Reference: @ref{Text markup}.
137 Snippets: @lsrdir{Text,Text}
139 Internals Reference: @internalsref{TextScript}.
143 Checking to make sure that text scripts and lyrics are within the
144 margins is a relatively large computational task. To speed up
145 processing, LilyPond does not perform such calculations by
146 default; to enable it, use
149 \override Score.PaperColumn #'keep-inside-line = ##t
154 @subsubsection Text spanners
156 @cindex Text spanners
158 @c TODO: merge these explanations with the ones below in
159 @c "Text and Line spanners" -vv
161 Some performance indications, e.g., @i{rallentando} or
162 @i{accelerando}, are written as text and are extended over many
163 measures with dotted lines; you can create such text spanners
164 from one note to another by using the following syntax:
166 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
167 \override TextSpanner #'bound-details #'left #'text = "rit."
173 The string to be printed is set through
174 object properties. By default it is printed in italic characters,
175 but different formatting can be obtained using
176 @code{\markup} blocks:
178 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
179 \override TextSpanner #'bound-details #'left #'text =
180 \markup { \upright "rit." }
187 @funindex textSpannerUp
188 @code{\textSpannerUp},
189 @funindex textSpannerDown
190 @code{\textSpannerDown},
191 @funindex textSpannerNeutral
192 @code{\textSpannerNeutral}.
194 The line style, as well as the text string, can be defined as an
195 object property, as described in @ref{Line styles}.
200 Snippets: @lsrdir{Text,Text}
202 Internals Reference: @internalsref{TextSpanner}.
206 @subsubsection Text marks
208 @cindex coda on bar line
209 @cindex segno on bar line
210 @cindex fermata on bar line
211 @cindex bar lines, symbols on
214 Various text elements can be added to a score using
215 the syntax described in @ref{Rehearsal marks}:
217 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
218 c4\mark "dolce" c c c
221 This syntax makes possible to put any text on a bar line, but also
222 signs like coda, segno, or fermata, by specifying the appropriate
223 symbol name. These symbols are listed in @ref{The Feta font}.
225 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
226 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
231 Such objects are only typeset above the top staff of the score; they
232 can be placed above the bar line or between notes, depending on whether
233 you specify it at the end or the middle of a bar. When specified at the
234 beginning of a score or at a line break, the mark will be printed at
235 the beginning of the line (the next line, in case of a line break).
237 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
239 c\mark "assai" \break
246 @c TODO: to be LSR-ized stuff -vv
248 To print the mark at the end of the current line, use
251 \override Score.RehearsalMark
252 #'break-visibility = #begin-of-line-invisible
255 @code{\mark} is often useful for adding text to the end of bar.
256 In such cases, changing the @code{#'self-alignment} is very useful
258 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
259 \override Score.RehearsalMark
260 #'break-visibility = #begin-of-line-invisible
262 \once \override Score.RehearsalMark #'self-alignment-X = #right
263 \mark "D.S. al Fine "
266 If specified, text marks may be aligned with notation objects
267 other than bar lines. These objects include @code{ambitus},
268 @code{breathing-sign}, @code{clef}, @code{custos},
269 @code{staff-bar}, @code{left-edge}, @code{key-cancellation},
270 @code{key-signature}, and @code{time-signature}.
273 In such cases, text marks will be, by default, horizontally centered
274 above the object. However, this can be changed, as demonstrated
275 on the second line of this example (in a score with multiple staves,
276 this setting should be done for all the staves).
279 @lilypond[fragment,quote,ragged-right,verbatim,relative=1]
282 % the RehearsalMark will be centered above the Clef
283 \override Score.RehearsalMark #'break-align-symbols = #'(clef)
289 % the RehearsalMark will be centered above the TimeSignature
290 \override Score.RehearsalMark #'break-align-symbols = #'(time-signature)
297 % the RehearsalMark will be centered above the KeySignature
298 \override Score.RehearsalMark #'break-align-symbols = #'(key-signature)
308 % the RehearsalMark will be aligned with the left edge of the KeySignature
309 \once \override Score.KeySignature #'break-align-anchor-alignment = #LEFT
314 % the RehearsalMark will be aligned with the right edge of the KeySignature
315 \once \override Score.KeySignature #'break-align-anchor-alignment = #RIGHT
320 % the RehearsalMark will be aligned with the left edge of the KeySignature
321 % and then shifted right by 1 unit.
322 \once \override Score.KeySignature #'break-align-anchor = #1
328 Although text marks are normally only printed above the topmost
329 staff, you may alter this to print them on every staff,
331 @lilypond[quote,ragged-right,verbatim,relative=2]
334 \remove "Mark_engraver"
338 \consists "Mark_engraver"
340 { c''1 \mark "foo" c'' }
342 \consists "Mark_engraver"
344 { c'1 \mark "foo" c' }
352 Snippets: @lsrdir{Text,Text}
354 Internals Reference: @internalsref{RehearsalMark}.
357 @c IMO this is a bug; hopefully it'll be fixed soon, so I can
358 @c delete this sentence. -gp
360 If a mark is entered at the end of the last bar of the score (where
361 there is no next line), then the mark will not be printed at
364 @c TODO: add this here? -vv
366 @c @subsubsection Text marks
369 @subsection Text markup
372 * Text markup introduction::
374 * Page wrapping text::
378 @node Text markup introduction
379 @subsubsection Text markup introduction
386 Use @code{\markup} to typeset text. Commands are entered with the
387 backslash @code{\}. To enter @code{\} and @code{#}, use double
390 @lilypond[quote,verbatim,fragment,relative=1]
392 c1_\markup { hi there }
393 c1^\markup { hi \bold there, is \italic {anyone home?} }
394 c1_\markup { "\special {weird} #characters" }
398 See @ref{Overview of text markup commands}, for a list of all
401 @code{\markup} is primarily used for @internalsref{TextScript}s,
402 but it can also be used anywhere text is called in LilyPond
404 @lilypond[quote,verbatim]
405 \header{ title = \markup{ \bold { foo \italic { bar! } } } }
408 \override Score.RehearsalMark
409 #'break-visibility = #begin-of-line-invisible
410 \override Score.RehearsalMark #'self-alignment-X = #right
412 \set Staff.instrumentName = \markup{ \column{ Alto solo } }
413 c2^\markup{ don't be \flat }
414 \override TextSpanner #'bound-details #'left #'text = \markup{\italic rit }
416 a2\mark \markup{ \large \bold Fine }
420 \addlyrics { bar, foo \markup{ \italic bar! } }
424 A @code{\markup} command can also be placed on its own, away from
425 any @code{\score} block, see @ref{Multiple scores in a book}.
427 @lilypond[quote,ragged-right,verbatim]
428 \markup{ Here is some text. }
431 @cindex font switching
433 The markup in the example demonstrates font switching commands.
434 The command @code{\bold} and @code{\italic} apply to the first
435 following word only; to apply a command to more than one word,
436 enclose the words with braces,
439 \markup @{ \bold @{ hi there @} @}
443 For clarity, you can also do this for single arguments, e.g.,
446 \markup @{ is \italic @{ anyone @} home @}
449 In markup mode you can compose expressions, similar to
450 mathematical expressions, XML documents, and music expressions.
451 You can stack expressions grouped vertically with the command
452 @code{\column}. Similarly, @code{\center-align} aligns texts by
455 @lilypond[quote,verbatim,fragment,relative=1]
456 c1^\markup { \column { a bbbb \line { c d } } }
457 c1^\markup { \center-align { a bbbb c } }
458 c1^\markup { \line { a b c } }
461 Lists with no previous command are not kept distinct. The
465 \center-align @{ @{ a b @} @{ c d @} @}
473 \center-align @{ a b c d @}
478 To keep lists of words distinct, please use quotes @code{"} or
479 the @code{\line} command
481 @lilypond[quote,verbatim,fragment,relative=1]
483 c4^\markup{ \center-align { on three lines } }
484 c4^\markup{ \center-align { "all one line" } }
485 c4^\markup{ \center-align { { on three lines } } }
486 c4^\markup{ \center-align { \line { on one line } } }
489 Markups can be stored in variables and these variables may be
490 attached to notes, like
493 allegro = \markup @{ \bold \large @{ Allegro @} @}
494 @{ a^\allegro b c d @}
497 Some objects have alignment procedures of their own, which cancel
498 out any effects of alignments applied to their markup arguments as
499 a whole. For example, the @internalsref{RehearsalMark} is
500 horizontally centered, so using @code{\mark \markup @{ \left-align
501 .. @}} has no effect.
503 In addition, vertical placement is performed after creating the
504 text markup object. If you wish to move an entire piece of
505 markup, you need to use the #'padding property or create an
506 @q{anchor} point inside the markup (generally with @code{\hspace
509 @lilypond[quote,verbatim,fragment,relative=1]
511 c'4^\markup{ \raise #5 "not raised" }
512 \once \override TextScript #'padding = #3
513 c'4^\markup{ raised }
514 c'4^\markup{ \hspace #0 \raise #1.5 raised }
517 Some situations (such as dynamic marks) have preset font-related
518 properties. If you are creating text in such situations, it is
519 advisable to cancel those properties with @code{normal-text}. See
520 @ref{Overview of text markup commands}, for more details.
525 This manual: @ref{Overview of text markup commands}.
527 Snippets: @lsrdir{Text,Text}
529 Internals Reference: @internalsref{TextScript}.
531 Init files: @file{scm/@/new@/-markup@/.scm}.
536 Kerning or generation of ligatures is only done when the @TeX{}
537 backend is used. In this case, LilyPond does not account for them
538 so texts will be spaced slightly too wide.
540 Syntax errors for markup mode are confusing.
544 @subsubsection Nested scores
546 It is possible to nest music inside markups, by adding a
547 @code{\score} block to a markup expression. Such a score must
548 contain a @code{\layout} block.
550 @lilypond[quote,verbatim,ragged-right]
554 \relative { c4 d e f }
564 Snippets: @lsrdir{Text,Text}
566 @node Page wrapping text
567 @subsubsection Page wrapping text
569 Whereas @code{\markup} is used to enter a non-breakable block of
570 text, @code{\markuplines} can be used at top-level to enter lines
571 of text that can spread over multiple pages:
576 A very long text of justified lines.
580 An other very long paragraph.
587 @code{\markuplines} accepts a list of markup, that is either the
588 result of a markup list command, or a list of markups or of markup
589 lists. The built-in markup list commands are described in
590 @ref{Overview of text markup list commands}.
594 This manual: @ref{Overview of text markup list commands}, @ref{New
595 markup list command definition}.
597 Snippets: @lsrdir{Text,Text}
601 @funindex \markuplines
605 @subsubsection Font selection
607 @cindex font selection
608 @cindex font magnification
609 @funindex font-interface
611 By setting the object properties described below, you can select a
612 font from the preconfigured font families. LilyPond has default
613 support for the feta music fonts. Text fonts are selected through
614 Pango/FontConfig. The serif font defaults to New Century
615 Schoolbook, the sans and typewriter to whatever the Pango
616 installation defaults to.
620 @item @code{font-encoding}
621 is a symbol that sets layout of the glyphs. This should only be
622 set to select different types of non-text fonts, e.g.
624 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
625 standard music font, including ancient glyphs, @code{fetaDynamic}
626 for dynamic signs and @code{fetaNumber} for the number font.
628 @item @code{font-family}
629 is a symbol indicating the general class of the typeface.
630 Supported are @code{roman} (Computer Modern), @code{sans}, and
633 @item @code{font-shape}
634 is a symbol indicating the shape of the font. There are typically
635 several font shapes available for each font family. Choices are
636 @code{italic}, @code{caps}, and @code{upright}.
638 @item @code{font-series}
639 is a symbol indicating the series of the font. There are
640 typically several font series for each font family and shape.
641 Choices are @code{medium} and @code{bold}.
645 Fonts selected in the way sketched above come from a predefined
646 style sheet. If you want to use a font from outside the style
647 sheet, then set the @code{font-name} property,
649 @lilypond[fragment,verbatim]
651 \override Staff.TimeSignature #'font-name = #"Charter"
652 \override Staff.TimeSignature #'font-size = #2
655 \override #'(font-name . "Vera Bold")
656 { This text is in Vera Bold }
662 Any font can be used, as long as it is available to
663 Pango/FontConfig. To get a full list of all available fonts, run
667 lilypond -dshow-available-fonts blabla
670 (the last argument of the command can be anything, but has to be
674 The size of the font may be set with the @code{font-size}
675 property. The resulting size is taken relative to the
676 @code{text-font-size} as defined in the @code{\paper} block.
679 @cindex font magnification
682 It is also possible to change the default font family for the
683 entire document. This is done by calling the
684 @code{make-pango-font-tree} from within the @code{\paper} block.
685 The function takes names for the font families to use for roman,
686 sans serif and monospaced text. For example,
688 @cindex font families, setting
697 (make-pango-font-tree "Times New Roman"
704 c'^\markup { roman: foo \sans bla \typewriter bar }
708 @c we don't do Helvetica / Courier, since GS incorrectly loads
715 Snippets: @lsrdir{Text,Text}
718 @node Special text concerns
719 @subsection Special text concerns
721 @c FIXME: this section is to be removed
722 @c (see comments below) -vv
725 * New dynamic marks::
728 @node New dynamic marks
729 @subsubsection New dynamic marks
731 @c FIXME: this whole section should be removed and put in
732 @c "Writing text" -vv
734 It is possible to print new dynamic marks or text that should be
735 aligned with dynamics. Use @code{make-dynamic-script} to create
736 these marks. Note that the dynamic font only contains the
737 characters @code{f,m,p,r,s} and @code{z}.
739 Some situations (such as dynamic marks) have preset font-related
740 properties. If you are creating text in such situations, it is
741 advisable to cancel those properties with @code{normal-text}. See
742 @ref{Overview of text markup commands}, for more details.
744 @cindex make-dynamic-script
746 @lilypond[quote,verbatim,ragged-right]
747 sfzp = #(make-dynamic-script "sfzp")
753 @cindex Dynamics, editorial
754 @cindex Dynamics, parenthesis
756 It is also possible to print dynamics in round parenthesis or
757 square brackets. These are often used for adding editorial
760 @lilypond[quote,verbatim,ragged-right]
761 rndf = \markup{ \center-align {\line { \bold{\italic (}
762 \dynamic f \bold{\italic )} }} }
763 boxf = \markup{ \bracket { \dynamic f } }
764 { c'1_\rndf c'1_\boxf }
769 Snippets: @lsrdir{Text,Text}