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.
14 @lilypondfile[quote]{text-headword.ly}
16 This section explains how to include text (with various
17 formatting) in music scores.
20 Some text elements that are not dealt with here are discussed in other
21 specific sections: @ref{Vocal music}, @ref{Titles and headers}.
24 @cindex Text, other languages
25 @warning{To write accented and special text (such as characters
26 from other languages), simply insert the characters directly into
27 the LilyPond file. The file must be saved as UTF-8. For more
28 information, see @ref{Text encoding}.}
38 @subsection Writing text
40 This section introduces different ways of adding text to a score.
51 @subsubsection Text scripts
54 @cindex text items, non-empty
55 @cindex non-empty texts
58 Simple @q{quoted text} indications may be added
59 to a score, as demonstrated in the following example.
60 Such indications can be manually placed
61 above or below the staff, using the
62 syntax described in @ref{Direction and
65 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
66 d8^"pizz." e f g a4-"scherz." f
69 This syntax is actually a shorthand; more complex text
70 formatting may be added to a note by explicitly using a
71 @code{\markup} block, as described in @ref{Formatting text}.
73 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
74 d8^\markup { \italic pizz. } e f g
75 a4_\markup { \tiny scherz. \bold molto } f
78 By default, text indications do not influence the note spacing.
79 However, their widths can be taken into account:
80 in the following example, the first text string does not affect
81 spacing, whereas the second one does.
83 @lilypond[quote,fragment,ragged-right,verbatim,relative=1]
91 @funindex \textLengthOn
93 @funindex \textLengthOff
99 Notation Reference: @ref{Formatting text},
100 @ref{Direction and placement}.
105 Internals Reference: @rinternals{TextScript}.
109 Checking to make sure that text scripts and lyrics are within the
110 margins is a relatively large computational task. To speed up
111 processing, LilyPond does not perform such calculations by
112 default; to enable it, use
115 \override Score.PaperColumn #'keep-inside-line = ##t
120 @subsubsection Text spanners
122 @cindex Text spanners
124 Some performance indications, e.g., @notation{rallentando} or
125 @notation{accelerando}, are written as text and are extended over
126 multiple notes with dotted lines.
127 Such objects, called @q{spanners}, may be created
128 from one note to another using the following syntax:
130 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
131 \override TextSpanner #'bound-details #'left #'text = "rit."
137 The string to be printed is set through
138 object properties. By default it is printed in italic characters,
139 but different formatting can be obtained using
140 @code{\markup} blocks, as described in @ref{Formatting text}.
142 @lilypond[quote,ragged-right,fragment,relative=2,verbatim]
143 \override TextSpanner #'bound-details #'left #'text =
144 \markup { \upright "rit." }
149 The line style, as well as the text string, can be defined as an
150 object property. This syntax is described in @ref{Line styles}.
154 @funindex textSpannerUp
155 @code{\textSpannerUp},
156 @funindex textSpannerDown
157 @code{\textSpannerDown},
158 @funindex textSpannerNeutral
159 @code{\textSpannerNeutral}
163 Notation Reference: @ref{Line styles}.
168 Internals Reference: @rinternals{TextSpanner}.
172 @subsubsection Text marks
174 @cindex coda on bar line
175 @cindex segno on bar line
176 @cindex fermata on bar line
177 @cindex bar lines, symbols on
180 Various text elements can be added to a score using
181 the syntax described in @ref{Rehearsal marks}:
183 @lilypond[verbatim,quote,ragged-right,fragment,relative=2]
184 c4\mark "Allegro" c c c
187 This syntax makes it possible to put any text on a bar line;
188 more complex text formatting may be added using a @code{\markup}
189 block, as described in @ref{Formatting text}. This can be used to print
190 signs like coda, segno or fermata, by specifying the appropriate
193 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
194 c1 \mark \markup { \musicglyph #"scripts.ufermata" }
199 Such objects are only typeset above the top staff of the score; depending on
200 whether they are specified at the end or the middle of a bar, they
201 can be placed above the bar line or between notes. When specified at the
202 beginning of a score or at a line break, marks will be printed at
203 the beginning of the line (the next line, in case of a line break).
205 @lilypond[fragment,quote,ragged-right,verbatim,relative=2]
207 c\mark "assai" \break
214 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
215 {printing-marks-at-the-end-of-a-line-or-a-score.ly}
217 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
218 {aligning-marks-with-various-notation-objects.ly}
220 @lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
221 {printing-marks-on-every-staff.ly}
225 Notation Reference: @ref{Rehearsal marks},
226 @ref{Formatting text}, @ref{The Feta font}.
231 Internals Reference: @rinternals{RehearsalMark}.
234 @c To be removed when Issue 69 in the tracker gets fixed. -vv
236 If a mark is entered at the end of the last bar of the score (where
237 there is no next line), then the mark will not be printed at
241 @subsubsection Separate text
243 @cindex separate text
244 @cindex standalone text
245 @cindex top-level text
246 @cindex text, standalone
249 A @code{\markup} block can exist by itself, outside of any
250 any @code{\score} block, as a @qq{top-level
251 expression}. This syntax is described in @ref{File structure}.
253 @lilypond[verbatim,quote]
255 Tomorrow, and tomorrow, and tomorrow...
260 This allows printing text separately
261 from the music, which is particularly
262 useful when the input file contains
263 several music pieces, as described in
264 @ref{Multiple scores in a book}.
266 @lilypond[quote,ragged-right,verbatim]
271 Tomorrow, and tomorrow, and tomorrow...
278 Using a specific syntax, text blocks can be spread
279 over multiple pages, making possible to print
280 text documents or books -- and therefore to
281 use LilyPond as a word processor. This syntax is described in
282 @ref{Multi-page markup}.
287 @funindex \markuplines
293 TODO: add convenient snippets in input/new -vv
298 Notation Reference: @ref{Formatting text},
299 @ref{File structure},
300 @ref{Multiple scores in a book},
301 @ref{Multi-page markup}.
306 Internals Reference: @rinternals{TextScript}.
309 @node Formatting text
310 @subsection Formatting text
312 This section presents basic and advanced text formatting,
313 using the @code{\markup} mode specific syntax.
316 * Text markup introduction::
317 * Common markup commands::
319 * Graphic notation inside markup::
320 * Music notation inside markup::
321 * Multi-page markup::
324 @node Text markup introduction
325 @subsubsection Text markup introduction
333 A @code{\markup} block is used to typeset text with an extensible
334 specific syntax called @qq{markup mode}.
336 @cindex markup expressions
337 @cindex markup syntax
339 The markup syntax is similar to LilyPond's usual syntax: a
340 @code{\markup} expression is enclosed in curly braces @code{@{
343 Unlike simple @q{quoted text} indications, @code{\markup} blocks
344 may contain nested expressions or specific commands,
345 entered using the backslash @code{\} character.
346 Such commands only affect the first following expression.
348 @lilypond[quote,verbatim,fragment,relative=1]
350 a2^\markup { poco \italic più forte }
352 d2_\markup { \italic "string. assai" }
354 b1^\markup { \bold { molto \italic agitato } }
358 @cindex special characters in markup mode
359 @cindex markup mode, special characters
360 @cindex reserved characters, printing
361 @cindex printing special characters
362 @cindex quoted text in markup mode
364 A @code{\markup} block may also contain quoted text, which
365 can be useful to print special characters (such as @code{\} and @code{#}).
366 Quoted text even allows to print double quotation marks, by preceding
367 them with backslashes:
369 @lilypond[quote,verbatim,fragment,relative=1]
371 a^\markup "##\ LEPORELLO \##"
372 a_\markup "Bravi! \"Cosa rara\"!"
377 The way markup expressions are defined affects
378 how these expressions will stacked, centered and aligned
379 when using the commands explained in @ref{Text alignment}.
381 @lilypond[quote,verbatim,fragment,relative=1]
382 c1^\markup { \column { a bbbb \line { c d } } }
383 c1^\markup { \center-align { a bbbb c } }
384 c1^\markup { \line { a b c } }
387 Lists of words that are not enclosed with double quotes
388 or preceded by a command are not kept distinct. In
389 the following example, the first two @code{\markup} expressions
392 @lilypond[quote,verbatim,fragment,relative=1]
393 c1^\markup { \center-align { a bbb c } }
394 c1^\markup { \center-align { a { bbb c } } }
395 c1^\markup { \center-align { a \line { bbb c } } }
399 Markups can be stored in variables. These variables may be
400 directly attached to notes:
402 @lilypond[quote,verbatim]
403 allegro = \markup { \bold \large Allegro }
413 An exhaustive list of @code{\markup}-specific commands can be found in
414 @ref{Text markup commands}.
419 This manual: @ref{Text markup commands}.
424 Internals Reference: @rinternals{TextScript}.
426 Init files: @file{scm/@/new@/-markup@/.scm}.
431 Syntax errors for markup mode are confusing.
434 @node Common markup commands
435 @subsubsection Common markup commands
437 Markup text may be formatted in different ways.
439 @cindex font switching
444 Basic font switching is supported:
446 @lilypond[quote,verbatim,relative=2]
450 \italic { non troppo \underline Vivo }
453 d,_\markup { \italic quasi \smallCaps Tromba }
466 The size of the characters can also be altered in different ways:
469 the font size can be defined to an absolute value,
472 predefined commands allow to easily select standard sizes,
475 other commands allow to change the size relatively to its previous value.
479 The following example demonstrates these three methods:
481 @lilypond[quote,verbatim,relative=2]
483 f1^\markup { \fontsize #5 Sinfonia }
492 \magnify #0.6 { e sentimento } )
503 Text may be printed as subscript or superscript. By default
504 these are printed in a smaller size, but a normal size can be used as well:
506 @lilypond[quote,verbatim]
509 \line { 1 \super st movement }
510 \line { 1 \normal-size-super st movement
511 \sub { (part two) } }
516 The markup mode provides an easy way to select alternate
517 font families. The default serif font, of roman type, is automatically
518 selected unless specified otherwise: on the last line of the following example,
519 there is no difference between the first word and the following words.
521 @lilypond[quote,verbatim]
524 \line { Act \number 1 }
525 \line { \sans { Scene I. } }
526 \line { \typewriter { Verona. An open place. } }
527 \line { \roman Enter Valentine and Proteus. }
533 Some of these font families, used for specific items
534 such as numbers or dynamics, do not provide all
535 characters, as mentioned in @ref{New dynamic marks} and
536 @ref{Manual repeat marks}.
539 Defining custom font sets is also possible, as explained in
540 @ref{Fonts}. An exhaustive list of font-switching, font-size
541 and font-families related commands can be found in @ref{Font}.
548 @funindex \normalsize
559 @c TODO: add @seealso
562 When used inside a word, some of these commands may produce an unwanted
563 blank space. This can easily be solved by concatenating the text
564 elements together, using a specific command
565 described in @ref{Text alignment}.
570 @subsubsection Text alignment
572 @warning{This subsection discusses how to place text in markup mode,
573 inside a @code{\markup} block. However, markup objects can also
574 be moved as a whole using the syntax described in
575 @rlearning{Moving objects}.}
577 Markup objects can be aligned in different ways. By default,
578 a text indication is aligned on its left edge: in the following
579 example, there's no difference between the first and the second
582 @lilypond[quote,verbatim,fragment,relative=1]
585 a,-\markup { \left-align poco }
587 a,-\markup { \center-align { poco } }
589 a,-\markup { \right-align poco }
592 @c FIXME: \center-align actually doesn't belong here
593 @c \center-align vs \column
594 @c \center-align vs \hcenter
596 Horizontal alignment:
618 Building a "large" markup:
631 Alignment inside a "large" markup:
643 TODO: here are some commands that could be described here.
644 I'm putting them in bulk, prior to working on this section. -vv
656 \page-ref (see also "Table of contents")
669 Some objects have alignment procedures of their own, which cancel
670 out any effects of alignments applied to their markup arguments as
671 a whole. For example, the @rinternals{RehearsalMark} is
672 horizontally centered, so using @code{\mark \markup @{ \left-align
673 .. @}} has no effect.
677 @node Graphic notation inside markup
678 @subsubsection Graphic notation inside markup
679 Graphics around text:
686 "Standalone" graphics:
706 @node Music notation inside markup
707 @subsubsection Music notation inside markup
709 Notes can be printed in markup mode blah blah:
714 Accidental symbols can be obtained easily:
726 Some other notation objects blah blah
734 @c TODO: add \text here? -vv
736 Any musical symbol can be printed
739 @c TODO: add \lookup here? -vv
742 The markup mode has support for fret diagrams:
746 \fret-diagram-verbose
748 An entire @code{\score} block can even be nested in a @code{\markup}
749 block. In such a case, the @code{\score} must contain a @code{\layout} block.
755 @lilypond[quote,verbatim,ragged-right]
759 \relative { c4 d e f }
772 @node Multi-page markup
773 @subsubsection Multi-page markup
775 Whereas @code{\markup} is used to enter a non-breakable block of
776 text, @code{\markuplines} can be used at top-level to enter lines
777 of text that can spread over multiple pages:
782 A very long text of justified lines.
786 An other very long paragraph.
793 @code{\markuplines} accepts a list of markup, that is either the
794 result of a markup list command, or a list of markups or of markup
795 lists. The built-in markup list commands are described in
796 @ref{Text markup list commands}.
800 This manual: @ref{Text markup list commands}, @ref{New
801 markup list command definition}.
808 @funindex \markuplines
816 * Entire document fonts::
817 * Single entry fonts::
820 @node Entire document fonts
821 @subsubsection Entire document fonts
823 It is also possible to change the default font family for the
824 entire document. This is done by calling the
825 @code{make-pango-font-tree} from within the @code{\paper} block.
826 The function takes names for the font families to use for roman,
827 sans serif and monospaced text. For example,
829 @cindex font families, setting
838 (make-pango-font-tree "Times New Roman"
845 c'^\markup { roman: foo \sans bla \typewriter bar }
849 @c we don't do Helvetica / Courier, since GS incorrectly loads
853 @node Single entry fonts
854 @subsubsection Single entry fonts
856 @cindex font selection
857 @cindex font magnification
858 @funindex font-interface
860 By setting the object properties described below, you can select a
861 font from the preconfigured font families. LilyPond has default
862 support for the feta music fonts. Text fonts are selected through
863 Pango/FontConfig. The serif font defaults to New Century
864 Schoolbook, the sans and typewriter to whatever the Pango
865 installation defaults to.
869 @item @code{font-encoding}
870 is a symbol that sets layout of the glyphs. This should only be
871 set to select different types of non-text fonts, e.g.
873 @code{fetaBraces} for piano staff braces, @code{fetaMusic} the
874 standard music font, including ancient glyphs, @code{fetaDynamic}
875 for dynamic signs and @code{fetaNumber} for the number font.
877 @item @code{font-family}
878 is a symbol indicating the general class of the typeface.
879 Supported are @code{roman} (Computer Modern), @code{sans}, and
882 @item @code{font-shape}
883 is a symbol indicating the shape of the font. There are typically
884 several font shapes available for each font family. Choices are
885 @code{italic}, @code{caps}, and @code{upright}.
887 @item @code{font-series}
888 is a symbol indicating the series of the font. There are
889 typically several font series for each font family and shape.
890 Choices are @code{medium} and @code{bold}.
894 Fonts selected in the way sketched above come from a predefined
895 style sheet. If you want to use a font from outside the style
896 sheet, then set the @code{font-name} property,
898 @lilypond[fragment,verbatim]
900 \override Staff.TimeSignature #'font-name = #"Charter"
901 \override Staff.TimeSignature #'font-size = #2
904 \override #'(font-name . "Vera Bold")
905 { This text is in Vera Bold }
911 Any font can be used, as long as it is available to
912 Pango/FontConfig. To get a full list of all available fonts, run
916 lilypond -dshow-available-fonts blabla
919 (the last argument of the command can be anything, but has to be
923 The size of the font may be set with the @code{font-size}
924 property. The resulting size is taken relative to the
925 @code{text-font-size} as defined in the @code{\paper} block.
928 @cindex font magnification