]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/notation/text.itely
Issue 3034: Use \finger in a few documentation places
[lilypond.git] / Documentation / notation / text.itely
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @ignore
3     Translation of GIT committish: FILL-IN-HEAD-COMMITTISH
4
5     When revising a translation, copy the HEAD committish of the
6     version that you are working on.  For details, see the Contributors'
7     Guide, node Updating translation committishes..
8 @end ignore
9
10 @c \version "2.17.6"
11
12 @node Text
13 @section Text
14
15 @lilypondfile[quote]{text-headword.ly}
16
17 This section explains how to include text (with various
18 formatting) in music scores.
19
20 @noindent
21 Some text elements that are not dealt with here are discussed in other
22 specific sections: @ref{Vocal music}, @ref{Titles and headers}.
23
24 @menu
25 * Writing text::
26 * Formatting text::
27 * Fonts::
28 @end menu
29
30 @node Writing text
31 @subsection Writing text
32
33 This section introduces different ways of adding text to a score.
34
35 @cindex Text, other languages
36 @warning{To write accented and special text (such as characters
37 from other languages), simply insert the characters directly into
38 the LilyPond file.  The file must be saved as UTF-8.  For more
39 information, see @ref{Text encoding}.}
40
41 @menu
42 * Text scripts::
43 * Text spanners::
44 * Text marks::
45 * Separate text::
46 @end menu
47
48
49 @node Text scripts
50 @unnumberedsubsubsec Text scripts
51
52 @cindex Text scripts
53 @cindex text items, non-empty
54 @cindex non-empty texts
55 @cindex quoted text
56
57 Simple @qq{quoted text} indications may be added to a score, as
58 demonstrated in the following example.  Such indications may be
59 manually placed above or below the staff, using the syntax described
60 in @ref{Direction and placement}.
61
62 @lilypond[quote,verbatim,relative=2]
63 a8^"pizz." g f e a4-"scherz." f
64 @end lilypond
65
66 This syntax is actually a shorthand; more complex text formatting may be
67 added to a note by explicitly using a @code{\markup} block, as described
68 in @ref{Formatting text}.
69
70 @lilypond[quote,verbatim,relative=2]
71 a8^\markup { \italic pizz. } g f e
72 a4_\markup { \tiny scherz. \bold molto } f
73 @end lilypond
74
75 By default, text indications do not influence the note spacing. However,
76 their widths can be taken into account: in the following example, the
77 first text string does not affect spacing, whereas the second one does.
78
79 @lilypond[quote,verbatim,relative=2]
80 a8^"pizz." g f e
81 \textLengthOn
82 a4_"scherzando" f
83 @end lilypond
84
85 In addition to text scripts, articulations can be attached to notes.
86 For more information, see @ref{Articulations and ornamentations}.
87
88 For more information about the relative ordering of text scripts and
89 articulations, see @rlearning{Placement of objects}.
90
91 @funindex \textLengthOn
92 @funindex textLengthOn
93 @funindex \textLengthOff
94 @funindex textLengthOff
95
96 @predefined
97 @code{\textLengthOn},
98 @code{\textLengthOff}.
99 @endpredefined
100
101 @seealso
102 Learning Manual:
103 @rlearning{Placement of objects}.
104
105 Notation Reference:
106 @ref{Formatting text},
107 @ref{Direction and placement},
108 @ref{Articulations and ornamentations}.
109
110 Snippets:
111 @rlsr{Text}.
112
113 Internals Reference:
114 @rinternals{TextScript}.
115
116 @cindex text outside margin
117 @cindex margin, text running over
118 @cindex text, keeping inside margin
119 @cindex lyrics, keeping inside margin
120
121 @knownissues
122 Checking to make sure that text scripts and lyrics are within the
123 margins requires additonal calculations. In cases where slightly faster
124 performance is desired, use
125
126 @example
127 \override Score.PaperColumn.keep-inside-line = ##f
128 @end example
129
130
131 @node Text spanners
132 @unnumberedsubsubsec Text spanners
133
134 @cindex text spanners
135
136 Some performance indications, e.g., @notation{rallentando} or
137 @notation{accelerando}, are written as text and are extended over
138 multiple notes with dotted lines.  Such objects, called
139 @qq{spanners}, may be created from one note to another using the
140 following syntax:
141
142 @lilypond[verbatim,quote,relative=2]
143 \override TextSpanner.bound-details.left.text = "rit."
144 b1\startTextSpan
145 e,\stopTextSpan
146 @end lilypond
147
148 @cindex text spanners, formatting
149 @cindex formatting text spanners
150
151 @noindent
152 The string to be printed is set through object properties.  By default
153 it is printed in italic characters, but different formatting can be
154 obtained using @code{\markup} blocks, as described in
155 @ref{Formatting text}.
156
157 @lilypond[quote,relative=2,verbatim]
158 \override TextSpanner.bound-details.left.text =
159   \markup { \upright "rit." }
160 b1\startTextSpan c
161 e,\stopTextSpan
162 @end lilypond
163
164 The line style, as well as the text string, can be defined as an
165 object property.  This syntax is described in @ref{Line styles}.
166
167 @funindex \textSpannerUp
168 @funindex textSpannerUp
169 @funindex \textSpannerDown
170 @funindex textSpannerDown
171 @funindex \textSpannerNeutral
172 @funindex textSpannerNeutral
173
174
175 @predefined
176 @code{\textSpannerUp},
177 @code{\textSpannerDown},
178 @code{\textSpannerNeutral}.
179 @endpredefined
180
181 @knownissues
182 LilyPond is only able to handle one text spanner per voice.
183
184 @snippets
185
186 @lilypondfile[verbatim,quote,texidoc,doctitle]
187 {dynamics-text-spanner-postfix.ly}
188
189 @lilypondfile[verbatim,quote,texidoc,doctitle]
190 {dynamics-custom-text-spanner-postfix.ly}
191
192 @seealso
193 Notation Reference:
194 @ref{Line styles},
195 @ref{Dynamics},
196 @ref{Formatting text}.
197
198 Snippets:
199 @rlsr{Text},
200 @rlsr{Expressive marks}.
201
202 Internals Reference:
203 @rinternals{TextSpanner}.
204
205
206 @node Text marks
207 @unnumberedsubsubsec Text marks
208
209
210 @cindex text marks
211 @cindex marks, text
212 @cindex text on bar line
213 @cindex coda on bar line
214 @cindex segno on bar line
215 @cindex fermata on bar line
216 @cindex bar lines, symbols on
217
218 @funindex \mark
219 @funindex mark
220 @funindex \markup
221 @funindex markup
222
223 Various text elements may be added to a score using the syntax described
224 in @ref{Rehearsal marks}:
225
226 @c \mark needs to be placed on a separate line (it's not
227 @c attached to an object like \markup is). -vv
228
229 @lilypond[verbatim,quote,relative=2]
230 c4
231 \mark "Allegro"
232 c c c
233 @end lilypond
234
235 This syntax makes it possible to put any text on a bar line;
236 more complex text formatting may be added using a @code{\markup}
237 block, as described in @ref{Formatting text}:
238
239 @lilypond[quote,verbatim,relative=1]
240 <c e>1
241 \mark \markup { \italic { colla parte } }
242 <d f>2 <e g>
243 <c f aes>1
244 @end lilypond
245
246 @noindent
247 This syntax also allows to print special signs, like coda, segno
248 or fermata, by specifying the appropriate symbol name as explained in
249 @ref{Music notation inside markup}:
250
251 @lilypond[quote,verbatim,relative=2]
252 <bes f>2 <aes d>
253 \mark \markup { \musicglyph #"scripts.ufermata" }
254 <e g>1
255 @end lilypond
256
257 @noindent
258 Such objects are only typeset above the top staff of the score;
259 depending on whether they are specified at the end or the middle of a
260 bar, they can be placed above the bar line or between notes.  When
261 specified at a line break, the mark will be printed at the beginning of
262 the next line.
263
264 @lilypond[quote,verbatim,relative=2]
265 \mark "Allegro"
266 c1 c
267 \mark "assai" \break
268 c  c
269 @end lilypond
270
271
272 @snippets
273
274 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
275 {printing-marks-at-the-end-of-a-line.ly}
276
277 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
278 {aligning-marks-with-various-notation-objects.ly}
279
280 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
281 {printing-marks-on-every-staff.ly}
282
283 @seealso
284 Notation Reference:
285 @ref{Rehearsal marks},
286 @ref{Formatting text},
287 @ref{Music notation inside markup},
288 @ref{The Feta font}.
289
290 Snippets:
291 @rlsr{Text}.
292
293 Internals Reference:
294 @rinternals{MarkEvent},
295 @rinternals{Mark_engraver},
296 @rinternals{RehearsalMark}.
297
298
299 @node Separate text
300 @unnumberedsubsubsec Separate text
301
302 @cindex separate text
303 @cindex text, separate
304 @cindex standalone text
305 @cindex top-level text
306 @cindex text, top-level
307 @cindex text, standalone
308
309 @funindex \markup
310 @funindex markup
311
312 A @code{\markup} block can exist by itself, outside of any
313 @code{\score} block, as a @qq{top-level expression}.  This syntax
314 is described in @ref{File structure}.
315
316 @lilypond[verbatim,quote]
317 \markup {
318   Tomorrow, and tomorrow, and tomorrow...
319 }
320 @end lilypond
321
322 @noindent
323 This allows printing text separately from the music, which is
324 particularly useful when the input file contains several music pieces,
325 as described in @ref{Multiple scores in a book}.
326
327 @lilypond[quote,verbatim]
328 \score {
329   c'1
330 }
331 \markup {
332   Tomorrow, and tomorrow, and tomorrow...
333 }
334 \score {
335   c'1
336 }
337 @end lilypond
338
339 Separate text blocks can be spread over multiple pages,
340 making it possible to print text documents or books entirely
341 within LilyPond.  This feature, and the specific syntax it
342 requires, are described in @ref{Multi-page markup}.
343
344
345 @funindex \markup
346 @funindex markup
347 @funindex \markuplist
348 @funindex markuplist
349
350 @predefined
351 @code{\markup},
352 @code{\markuplist}.
353 @endpredefined
354
355
356 @snippets
357
358 @lilypondfile[verbatim,quote,ragged-right,texidoc,doctitle]
359 {stand-alone-two-column-markup.ly}
360
361 @seealso
362 Notation Reference:
363 @ref{Formatting text},
364 @ref{File structure},
365 @ref{Multiple scores in a book},
366 @ref{Multi-page markup}.
367
368 Snippets:
369 @rlsr{Text}.
370
371 Internals Reference:
372 @rinternals{TextScript}.
373
374
375 @node Formatting text
376 @subsection Formatting text
377
378 This section presents basic and advanced text formatting,
379 using the @code{\markup} mode specific syntax.
380
381 @menu
382 * Text markup introduction::
383 * Selecting font and font size::
384 * Text alignment::
385 * Graphic notation inside markup::
386 * Music notation inside markup::
387 * Multi-page markup::
388 @end menu
389
390 @node Text markup introduction
391 @unnumberedsubsubsec Text markup introduction
392
393 @cindex markup
394 @cindex text markup
395 @cindex markup text
396 @cindex typeset text
397
398 @funindex \markup
399 @funindex markup
400
401 A @code{\markup} block is used to typeset text with an extensible
402 syntax called @qq{markup mode}.
403
404 @cindex markup expressions
405 @cindex expressions, markup
406 @cindex markup syntax
407 @cindex syntax, markup
408
409 The markup syntax is similar to LilyPond's usual syntax: a
410 @code{\markup} expression is enclosed in curly braces
411 @code{@{@dots{} @}}.  A single word is regarded as a minimal expression,
412 and therefore does not need to be enclosed with braces.
413
414 Unlike simple @qq{quoted text} indications, @code{\markup} blocks may
415 contain nested expressions or markup commands, entered using the
416 backslash @code{\} character.  Such commands only affect the first
417 following expression.
418
419 @lilypond[quote,verbatim,relative=2]
420 a1-\markup intenso
421 a2^\markup { poco \italic più forte  }
422 c e1
423 d2_\markup { \italic "string. assai" }
424 e
425 b1^\markup { \bold { molto \italic  agitato } }
426 c
427 @end lilypond
428
429 @cindex special characters in markup mode
430 @cindex markup mode, special characters
431 @cindex reserved characters, printing
432 @cindex printing reserved characters
433 @cindex printing special characters
434 @cindex quoted text in markup mode
435 @cindex markup mode, quoted text
436
437 A @code{\markup} block may also contain quoted text strings.  Such
438 strings are treated as minimal text expressions, and therefore any
439 markup command or special character (such as @code{\} and@tie{}@code{#})
440 will be printed verbatim without affecting the formatting of the text.
441 Double quotation marks themselves may be printed by preceding them
442 with backslashes.
443
444 @lilypond[quote,verbatim,relative=2]
445 a1^"\italic markup..."
446 a_\markup { \italic "... prints \"italic\" letters!" }
447 a a
448 @end lilypond
449
450 To be treated as a distinct expression, a list of words needs to be
451 enclosed with double quotes or preceded by a command.  The way markup
452 expressions are defined affects how these expressions will be stacked,
453 centered and aligned; in the following example, the second
454 @code{\markup} expression is treated the same as the first one:
455
456 @lilypond[quote,verbatim,relative=2]
457 c1^\markup { \center-column { a bbb c } }
458 c1^\markup { \center-column { a { bbb c } } }
459 c1^\markup { \center-column { a \line { bbb c } } }
460 c1^\markup { \center-column { a "bbb c" } }
461 @end lilypond
462
463 Markups can be stored in variables.  Such variables may be
464 directly attached to notes:
465
466 @lilypond[quote,verbatim]
467 allegro = \markup { \bold \large Allegro }
468
469 {
470   d''8.^\allegro
471   d'16 d'4 r2
472 }
473 @end lilypond
474
475
476 @noindent
477 An exhaustive list of @code{\markup}-specific commands can be found in
478 @ref{Text markup commands}.
479
480 @seealso
481 Notation Reference:
482 @ref{Text markup commands}.
483
484 Snippets:
485 @rlsr{Text}.
486
487 Installed Files:
488 @file{scm/markup.scm}.
489
490 @knownissues
491 Syntax errors for markup mode can be confusing.
492
493
494 @node Selecting font and font size
495 @unnumberedsubsubsec Selecting font and font size
496
497 @cindex font switching
498 @cindex changing fonts
499 @cindex switching fonts
500
501 @funindex \italic
502 @funindex italic
503 @funindex \bold
504 @funindex bold
505 @funindex \underline
506 @funindex underline
507
508 Basic font switching is supported in markup mode:
509
510 @lilypond[quote,verbatim,relative=2]
511 d1^\markup {
512   \bold { Più mosso }
513   \italic { non troppo \underline Vivo }
514 }
515 r2 r4 r8
516 d,_\markup { \italic quasi \smallCaps Tromba }
517 f1 d2 r
518 @end lilypond
519
520 @cindex font size
521 @cindex text size
522
523 @funindex \abs-fontsize
524 @funindex \fontsize
525 @funindex fontsize
526 @funindex \smaller
527 @funindex smaller
528 @funindex \larger
529 @funindex larger
530 @funindex \magnify
531 @funindex magnify
532
533 The font size can be altered, relative to the global staff size, in a
534 number of different ways
535
536 It can be set to predefined size,
537
538 @lilypond[quote,verbatim,relative=2]
539 b1_\markup { \huge Sinfonia }
540 b1^\markup { \teeny da }
541 b1-\markup { \normalsize camera }
542 @end lilypond
543
544 It can be set relative to its previous value,
545
546 @lilypond[quote,verbatim,relative=2]
547 b1_\markup { \larger Sinfonia }
548 b1^\markup { \smaller da }
549 b1-\markup { \magnify #0.6  camera }
550 @end lilypond
551
552 It can be increased or decreased relative to the value set by the
553 global staff size,
554
555 @lilypond[quote,verbatim,relative=2]
556 b1_\markup { \fontsize #-2 Sinfonia }
557 b1^\markup { \fontsize #1 da }
558 b1-\markup { \fontsize #3 camera }
559 @end lilypond
560
561 It can also be set to a fixed point-size, regardless of the global staff
562 size,
563
564 @lilypond[quote,verbatim,relative=2]
565 b1_\markup { \abs-fontsize #20 Sinfonia }
566 b1^\markup { \abs-fontsize #8 da }
567 b1-\markup { \abs-fontsize #14 camera }
568 @end lilypond
569
570 @cindex subscript
571 @cindex superscript
572
573 @funindex \super
574 @funindex super
575 @funindex \sub
576 @funindex sub
577 @funindex \normal-size-super
578 @funindex normal-size-super
579
580 Text may be printed as subscript or superscript.  By default these are
581 printed in a smaller size, but a normal size can be used as well:
582
583 @lilypond[quote,verbatim]
584 \markup {
585   \column {
586     \line { 1 \super st movement }
587     \line { 1 \normal-size-super st movement
588       \sub { (part two) }  }
589   }
590 }
591 @end lilypond
592
593 @cindex font families
594
595 The markup mode provides an easy way to select alternate font
596 families.  The default serif font, of roman type, is automatically
597 selected unless specified otherwise; on the last line of the following
598 example, there is no difference between the first and the second word.
599
600 @lilypond[quote,verbatim]
601 \markup {
602   \column {
603     \line { Act \number 1 }
604     \line { \sans { Scene I. } }
605     \line { \typewriter { Verona. An open place. } }
606     \line { Enter \roman Valentine and Proteus. }
607   }
608 }
609 @end lilypond
610
611 @noindent
612 Some of these font families, used for specific items such as numbers
613 or dynamics, do not provide all characters, as mentioned in
614 @ref{New dynamic marks} and @ref{Manual repeat marks}.
615
616 @c \concat is actually documented in Align (it is not
617 @c a font-switching command).  But we need it here. -vv
618
619 When used inside a word, some font-switching or formatting commands
620 may produce an unwanted blank space.  This can easily be solved by
621 concatenating the text elements together:
622
623 @lilypond[quote,verbatim]
624 \markup {
625   \column {
626     \line {
627       \concat { 1 \super st }
628       movement
629     }
630     \line {
631       \concat { \dynamic p , }
632       \italic { con dolce espressione }
633     }
634   }
635 }
636 @end lilypond
637
638 An exhaustive list of font switching commands and custom font usage
639 commands can be found in @ref{Font}.
640
641 Defining custom font sets is also possible, as explained in
642 @ref{Fonts}.
643
644 @funindex \teeny
645 @funindex teeny
646 @funindex \tiny
647 @funindex tiny
648 @funindex \small
649 @funindex small
650 @funindex \normalsize
651 @funindex normalsize
652 @funindex \large
653 @funindex large
654 @funindex \huge
655 @funindex huge
656 @funindex \smaller
657 @funindex smaller
658 @funindex \larger
659 @funindex larger
660
661
662 @predefined
663 @code{\teeny},
664 @code{\tiny},
665 @code{\small},
666 @code{\normalsize},
667 @code{\large},
668 @code{\huge},
669 @code{\smaller},
670 @code{\larger}.
671 @endpredefined
672
673 @seealso
674 Notation Reference:
675 @ref{Font},
676 @ref{New dynamic marks},
677 @ref{Manual repeat marks},
678 @ref{Fonts}.
679
680 Installed Files:
681 @file{scm/define-markup-commands.scm}.
682
683 Snippets:
684 @rlsr{Text}.
685
686 Internals Reference:
687 @rinternals{TextScript}.
688
689 @knownissues
690 Using the font sizing commands @code{\teeny}, @code{\tiny},
691 @code{\small}, @code{\normalsize}, @code{\large}, and
692 @code{\huge} will lead to inconsistent line spacing compared to
693 using @code{\fontsize}.
694
695
696 @node Text alignment
697 @unnumberedsubsubsec Text alignment
698
699 @cindex text, aligning
700 @cindex aligning text
701 @cindex aligning markup text
702 @cindex aligning markups
703 @cindex markups, aligning
704 @cindex markup text, aligning
705
706 This subsection discusses how to place text in markup mode.  Markup
707 objects can also be moved as a whole, using the syntax described in
708 @rlearning{Moving objects}.
709
710 @c Padding commands should be mentioned on this page, but
711 @c most of these require \box to be more clearly illustrated. -vv
712
713 @cindex text, horizontal alignment
714 @cindex horizontal text alignment
715
716 @funindex \left-align
717 @funindex left-align
718 @funindex \center-align
719 @funindex center-align
720 @funindex \right-align
721 @funindex right-align
722
723 Markup objects may be aligned in different ways.  By default, a text
724 indication is aligned on its left edge: in the following example,
725 there is no difference between the first and the second markup.
726
727 @lilypond[quote,verbatim,relative=2]
728 d1-\markup { poco }
729 f
730 d-\markup { \left-align poco }
731 f
732 d-\markup { \center-align { poco } }
733 f
734 d-\markup { \right-align poco }
735 @end lilypond
736
737 @funindex \halign
738 @funindex halign
739
740 Horizontal alignment may be fine-tuned using a numeric value:
741
742 @lilypond[quote,verbatim,relative=2]
743 a1-\markup { \halign #-1 poco }
744 e'
745 a,-\markup { \halign #0 poco }
746 e'
747 a,-\markup { \halign #0.5 poco }
748 e'
749 a,-\markup { \halign #2 poco }
750 @end lilypond
751
752 @noindent
753 Some objects may have alignment procedures of their own, and therefore
754 are not affected by these commands.  It is possible to move such
755 markup objects as a whole, as shown for instance in
756 @ref{Text marks}.
757
758 @cindex text, vertical alignment
759 @cindex vertical text alignment
760
761 @funindex \raise
762 @funindex raise
763 @funindex \lower
764 @funindex lower
765 @funindex \null
766 @funindex null
767
768 @c QUERY Should the function of ``\null'' be clarified? rp
769
770 Vertical alignment is a bit more complex.  As stated above, markup
771 objects can be moved as a whole; however, it is also possible to move
772 specific elements inside a markup block.  In this case, the element to
773 be moved needs to be preceded with an @emph{anchor point}, that can be
774 another markup element or an invisible object.  The following example
775 demonstrates these two possibilities; the last markup in this example
776 has no anchor point, and therefore is not moved.
777
778 @lilypond[quote,verbatim,relative=1]
779 d2^\markup {
780   Acte I
781   \raise #2 { Scène 1 }
782 }
783 a'
784 g_\markup {
785   \null
786   \lower #4 \bold { Très modéré }
787 }
788 a
789 d,^\markup {
790   \raise #4 \italic { Une forêt. }
791 }
792 a'4 a g2 a
793 @end lilypond
794
795 @funindex \general-align
796 @funindex general-align
797 @funindex \translate
798 @funindex translate
799 @funindex \translate-scaled
800 @funindex translate-scaled
801
802 Some commands can affect both the horizontal and vertical alignment of
803 text objects in markup mode.  Any object affected by these commands
804 must be preceded with an anchor point:
805
806 @lilypond[quote,verbatim,relative=1]
807 d2^\markup {
808   Acte I
809   \translate #'(-1 . 2) "Scène 1"
810 }
811 a'
812 g_\markup {
813   \null
814   \general-align #Y #3.2 \bold "Très modéré"
815 }
816 a
817 d,^\markup {
818   \null
819   \translate-scaled #'(-1 . 2) \teeny "Une forêt."
820 }
821 a'4 a g2 a
822 @end lilypond
823
824 @cindex multi-line markup
825 @cindex markup, multi-line
826 @cindex multi-line text
827 @cindex text, multi-line
828 @cindex text in columns
829 @cindex columns, text
830
831 @funindex \column
832 @funindex column
833 @funindex \center-column
834 @funindex center-column
835
836 A markup object may include several lines of text.  In the following
837 example, each element or expression is placed on its own line, either
838 left-aligned or centered:
839
840 @lilypond[quote,verbatim]
841 \markup {
842   \column {
843     a
844     "b c"
845     \line { d e f }
846   }
847   \hspace #10
848   \center-column {
849     a
850     "b c"
851     \line { d e f }
852   }
853 }
854 @end lilypond
855
856 @cindex centering text on the page
857 @cindex text, centering on the page
858 @cindex markup, centering on the page
859
860 @funindex \fill-line
861 @funindex fill-line
862
863 Similarly, a list of elements or expressions may be spread to fill the
864 entire horizontal line width (if there is only one element, it will be
865 centered on the page).  These expressions can, in turn, include
866 multi-line text or any other markup expression:
867
868 @lilypond[quote,verbatim]
869 \markup {
870   \fill-line {
871     \line { William S. Gilbert }
872     \center-column {
873       \huge \smallCaps "The Mikado"
874       or
875       \smallCaps "The Town of Titipu"
876     }
877     \line { Sir Arthur Sullivan }
878   }
879 }
880 \markup {
881   \fill-line { 1885 }
882 }
883 @end lilypond
884
885 @cindex wordwrapped text
886 @cindex justified text
887 @cindex text, justified
888 @cindex text, wordwrapped
889 @cindex markup text, wordwrapped
890 @cindex markup text, justified
891
892 @funindex \wordwrap
893 @funindex wordwrap
894 @funindex \justify
895 @funindex justify
896
897 Long text indications can also be automatically wrapped accordingly to
898 the given line width.  These will be either left-aligned or justified,
899 as shown in the following example.
900
901 @lilypond[quote,verbatim]
902 \markup {
903   \column {
904     \line  \smallCaps { La vida breve }
905     \line \bold { Acto I }
906     \wordwrap \italic {
907       (La escena representa el corral de una casa de
908       gitanos en el Albaicín de Granada.  Al fondo una
909       puerta por la que se ve el negro interior de
910       una Fragua, iluminado por los rojos resplandores
911       del fuego.)
912     }
913     \hspace #0
914
915     \line \bold { Acto II }
916     \override #'(line-width . 50)
917     \justify \italic {
918       (Calle de Granada.  Fachada de la casa de Carmela
919       y su hermano Manuel con grandes ventanas abiertas
920       a través de las que se ve el patio
921       donde se celebra una alegre fiesta)
922     }
923   }
924 }
925 @end lilypond
926
927 @cindex text alignment commands
928 @cindex markup text alignment commands
929 @cindex alignment, text, commands
930
931 An exhaustive list of text alignment commands can be found in
932 @ref{Align}.
933
934 @seealso
935 Learning Manual:
936 @rlearning{Moving objects}.
937
938 Notation Reference:
939 @ref{Align},
940 @ref{Text marks}.
941
942 Installed Files:
943 @file{scm/define-markup-commands.scm}.
944
945 Snippets:
946 @rlsr{Text}.
947
948 Internals Reference:
949 @rinternals{TextScript}.
950
951
952 @node Graphic notation inside markup
953 @unnumberedsubsubsec Graphic notation inside markup
954
955 @cindex graphics, embedding
956 @cindex drawing graphic objects
957 @cindex graphic objects, drawing
958 @cindex embedding graphic objects
959 @cindex graphic objects, embedding
960
961 Various graphic objects may be added to a score, using markup
962 commands.
963
964 @cindex decorating text
965 @cindex framing text
966 @cindex text, framing
967 @cindex text, decorating
968 @cindex markup text, decorating
969 @cindex markup text, framing
970
971 @funindex \box
972 @funindex box
973 @funindex \circle
974 @funindex circle
975 @funindex \rounded-box
976 @funindex rounded-box
977 @funindex \bracket
978 @funindex bracket
979 @funindex \hbracket
980 @funindex hbracket
981
982 Some markup commands allow decoration of text elements with graphics,
983 as demonstrated in the following example.
984
985 @lilypond[quote,verbatim]
986 \markup \fill-line {
987   \center-column {
988     \circle Jack
989     \box "in the box"
990     \null
991     \line {
992       Erik Satie
993       \hspace #3
994       \bracket "1866 - 1925"
995     }
996     \null
997     \rounded-box \bold Prelude
998   }
999 }
1000 @end lilypond
1001
1002 @cindex padding around text
1003 @cindex text padding
1004 @cindex markup text padding
1005
1006 @funindex \pad-markup
1007 @funindex pad-markup
1008 @funindex \pad-x
1009 @funindex pad-x
1010 @funindex \pad-to-box
1011 @funindex pad-to-box
1012 @funindex \pad-around
1013 @funindex pad-around
1014
1015 Some commands may require an increase in the padding around the text;
1016 this is achieved with some markup commands exhaustively described in
1017 @ref{Align}.
1018
1019 @lilypond[quote,verbatim]
1020 \markup \fill-line {
1021   \center-column {
1022     \box "Charles Ives (1874 - 1954)"
1023     \null
1024     \box \pad-markup #2 "THE UNANSWERED QUESTION"
1025     \box \pad-x #8 "A Cosmic Landscape"
1026     \null
1027   }
1028 }
1029 \markup \column {
1030   \line {
1031     \hspace #10
1032     \box \pad-to-box #'(-5 . 20) #'(0 . 5)
1033       \bold "Largo to Presto"
1034   }
1035   \pad-around #3
1036       "String quartet keeps very even time,
1037 Flute quartet keeps very uneven time."
1038 }
1039 @end lilypond
1040
1041 @cindex graphic notation
1042 @cindex symbols, non-musical
1043 @cindex non-musical symbols
1044 @cindex notation, graphic
1045
1046 @funindex \combine
1047 @funindex combine
1048 @funindex \draw-circle
1049 @funindex draw-circle
1050 @funindex \filled-box
1051 @funindex filled-box
1052 @funindex \triangle
1053 @funindex triangle
1054 @funindex \draw-line
1055 @funindex draw-line
1056 @funindex \arrow-head
1057 @funindex arrow-head
1058
1059 Other graphic elements or symbols may be printed without requiring any
1060 text.  As with any markup expression, such objects can be combined.
1061
1062 @lilypond[quote,verbatim]
1063 \markup {
1064   \combine
1065     \draw-circle #4 #0.4 ##f
1066     \filled-box #'(-4 . 4) #'(-0.5 . 0.5) #1
1067   \hspace #5
1068
1069   \center-column {
1070     \triangle ##t
1071     \combine
1072       \draw-line #'(0 . 4)
1073       \arrow-head #Y #DOWN ##f
1074   }
1075 }
1076 @end lilypond
1077
1078 @cindex embedded graphics
1079 @cindex images, embedding
1080 @cindex graphics, embedding
1081 @cindex postscript
1082
1083 @funindex \epsfile
1084 @funindex epsfile
1085 @funindex \postscript
1086 @funindex postscript
1087
1088 Advanced graphic features include the ability to include external
1089 image files converted to the Encapsulated PostScript format
1090 (@emph{eps}), or to directly embed graphics into the input file, using
1091 native PostScript code.  In such a case, it may be useful to
1092 explicitly specify the size of the drawing, as demonstrated below:
1093
1094 @lilypond[quote,verbatim,relative=1]
1095 c1^\markup {
1096   \combine
1097     \epsfile #X #10 #"./context-example.eps"
1098     \with-dimensions #'(0 . 6) #'(0 . 10)
1099     \postscript #"
1100       -2 3 translate
1101       2.7 2 scale
1102       newpath
1103       2 -1 moveto
1104       4 -2 4 1 1 arct
1105       4 2 3 3 1 arct
1106       0 4 0 3 1 arct
1107       0 0 1 -1 1 arct
1108       closepath
1109       stroke"
1110   }
1111 c
1112 @end lilypond
1113
1114 An exhaustive list of graphics-specific commands can be found in
1115 @ref{Graphic}.
1116
1117 @seealso
1118 Notation Reference:
1119 @ref{Graphic},
1120 @ref{Editorial annotations},
1121 @ref{Align}.
1122
1123 Installed Files:
1124 @file{scm/define-markup-commands.scm},
1125 @file{scm/stencil.scm}.
1126
1127 Snippets:
1128 @rlsr{Text}.
1129
1130 Internals Reference:
1131 @rinternals{TextScript}.
1132
1133
1134 @node Music notation inside markup
1135 @unnumberedsubsubsec Music notation inside markup
1136
1137 @cindex notation inside markup
1138 @cindex music inside markup
1139 @cindex markup, music notation inside
1140
1141 Various musical notation elements may be added to a score, inside a
1142 markup object.
1143
1144 Notes and accidentals can be entered using markup commands:
1145
1146 @lilypond[quote,verbatim,relative=2]
1147 a2 a^\markup {
1148   \note #"4" #1
1149   =
1150   \note-by-number #1 #1 #1.5
1151 }
1152 b1_\markup {
1153   \natural \semiflat \flat
1154   \sesquiflat \doubleflat
1155 }
1156 \glissando
1157 a1_\markup {
1158   \natural \semisharp \sharp
1159   \sesquisharp \doublesharp
1160 }
1161 \glissando b
1162 @end lilypond
1163
1164 Other notation objects may also be printed
1165 in markup mode:
1166
1167 @lilypond[quote,verbatim,relative=1]
1168 g1 bes
1169 ees\finger \markup \tied-lyric #"4~1"
1170 fis_\markup { \dynamic rf }
1171 bes^\markup {
1172   \beam #8 #0.1 #0.5
1173 }
1174 cis
1175 d-\markup {
1176   \markalphabet #8
1177   \markletter #8
1178 }
1179 @end lilypond
1180
1181 More generally, any available musical symbol may be included
1182 separately in a markup object, as demonstrated below; an exhaustive
1183 list of these symbols and their names can be found in
1184 @ref{The Feta font}.
1185
1186 @lilypond[quote,verbatim,relative=2]
1187 c2
1188 c'^\markup { \musicglyph #"eight" }
1189 c,4
1190 c,8._\markup { \musicglyph #"clefs.G_change" }
1191 c16
1192 c2^\markup { \musicglyph #"timesig.neomensural94" }
1193 @end lilypond
1194
1195 Another way of printing non-text glyphs is described in
1196 @ref{Fonts explained}.  This is useful for printing braces of various
1197 sizes.
1198
1199 The markup mode also supports diagrams for specific
1200 instruments:
1201
1202 @lilypond[quote,verbatim,relative=2]
1203 c1^\markup {
1204   \fret-diagram-terse #"x;x;o;2;3;2;"
1205 }
1206 c^\markup {
1207   \harp-pedal #"^-v|--ov^"
1208 }
1209 c
1210 c^\markup {
1211   \combine
1212     \musicglyph #"accordion.discant"
1213     \combine
1214       \raise #0.5 \musicglyph #"accordion.dot"
1215       \raise #1.5 \musicglyph #"accordion.dot"
1216 }
1217 @end lilypond
1218
1219 @c The accordion diagram is actually taken from a snippet.
1220
1221 @noindent
1222 Such diagrams are documented in @ref{Instrument Specific Markup}.
1223
1224 @cindex score inside markup
1225 @cindex markup, score inside
1226
1227 A whole score can even be nested inside a markup object.  In such a
1228 case, the nested @code{\score} block must contain a @code{\layout}
1229 block, as demonstrated here:
1230
1231 @lilypond[quote,verbatim,relative=1]
1232 c4 d^\markup {
1233   \score {
1234     \relative c' { c4 d e f }
1235     \layout { }
1236   }
1237 }
1238 e f |
1239 c d e f
1240 @end lilypond
1241
1242 An exhaustive list of music notation related commands can be found in
1243 @ref{Music}.
1244
1245 @seealso
1246 Notation Reference:
1247 @ref{Music},
1248 @ref{The Feta font},
1249 @ref{Fonts explained}.
1250
1251 Installed Files:
1252 @file{scm/define-markup-commands.scm},
1253 @file{scm/fret-diagrams.scm},
1254 @file{scm/harp-pedals.scm}.
1255
1256 Snippets:
1257 @rlsr{Text}.
1258
1259 Internals Reference:
1260 @rinternals{TextScript}.
1261
1262
1263 @node Multi-page markup
1264 @unnumberedsubsubsec Multi-page markup
1265
1266 @cindex multi-page markup
1267 @cindex markup, multi-page
1268 @cindex markup text, multi-page
1269 @cindex text spread over multiple pages
1270
1271 @funindex \markuplist
1272 @funindex markuplist
1273 @funindex \justified-lines
1274 @funindex justified-lines
1275 @funindex \wordwrap-lines
1276 @funindex wordwrap-lines
1277
1278 Although standard markup objects are not breakable, a specific syntax
1279 makes it possible to enter lines of text that can spread over multiple
1280 pages:
1281
1282 @lilypond[quote,verbatim]
1283 \markuplist {
1284   \justified-lines {
1285     A very long text of justified lines.
1286     ...
1287   }
1288   \wordwrap-lines {
1289     Another very long paragraph.
1290     ...
1291   }
1292   ...
1293 }
1294 @end lilypond
1295
1296 This syntax accepts a list of markups, that can be
1297 @itemize
1298 @item
1299 the result of a markup list command,
1300 @item
1301 a list of markups,
1302 @item
1303 a list of markup lists.
1304 @end itemize
1305
1306 An exhaustive list of markup list commands can be found in
1307 @ref{Text markup list commands}.
1308
1309 @seealso
1310 Notation Reference:
1311 @ref{Text markup list commands}.
1312
1313 Extending LilyPond:
1314 @rextend{New markup list command definition}.
1315
1316 Installed Files:
1317 @file{scm/define-markup-commands.scm}.
1318
1319 Snippets:
1320 @rlsr{Text}.
1321
1322 Internals Reference:
1323 @rinternals{TextScript}.
1324
1325 @funindex \markuplist
1326 @funindex markuplist
1327
1328 @predefined
1329 @code{\markuplist}.
1330 @endpredefined
1331
1332
1333 @node Fonts
1334 @subsection Fonts
1335
1336 This section presents the way fonts are handled, and how they may be
1337 changed in scores.
1338
1339 @menu
1340 * Fonts explained::
1341 * Single entry fonts::
1342 * Entire document fonts::
1343 @end menu
1344
1345 @node Fonts explained
1346 @unnumberedsubsubsec Fonts explained
1347
1348 @cindex Pango
1349 @cindex fonts, explained
1350 @cindex braces, various sizes
1351 @cindex fonts, non-text in markup
1352 @cindex non-text fonts in markup
1353
1354 @funindex font-interface
1355
1356 Fonts are handled through several libraries.  FontConfig is used to
1357 detect available fonts on the system; the selected fonts are rendered
1358 using Pango.
1359
1360 Music notation fonts can be described as a set of specific glyphs,
1361 ordered in several families.  The following syntax allows various
1362 LilyPond @code{feta} non-text fonts to be used directly in markup
1363 mode:
1364
1365 @lilypond[quote,verbatim,relative=2]
1366 a1^\markup {
1367   \vcenter {
1368     \override #'(font-encoding . fetaBraces)
1369     \lookup #"brace120"
1370     \override #'(font-encoding . fetaText)
1371     \column { 1 3 sf }
1372     \override #'(font-encoding . fetaMusic)
1373     \lookup #"noteheads.s0petrucci"
1374   }
1375 }
1376 @end lilypond
1377
1378 @noindent
1379 However, all these glyphs except the braces of various sizes contained
1380 in @code{fetaBraces} are available using the simpler syntax described
1381 in @ref{Music notation inside markup}.
1382
1383 When using the glyphs contained in @code{fetaBraces}, the size of the
1384 brace is specified by the numerical part of the glyph name, in
1385 arbitrary units.  Any integer from @code{0} to @code{575} inclusive
1386 may be specified, @code{0} giving the smallest brace.  The optimum
1387 value must be determined by trial and error.  These glyphs are all
1388 left braces; right braces may be obtained by rotation, see
1389 @ref{Rotating objects}.
1390
1391 Three families of text fonts are made available: the @emph{roman}
1392 (serif) font, that defaults to New Century Schoolbook, the
1393 @emph{sans} font and the monospaced @emph{typewriter} font -- these
1394 last two families are determined by the Pango installation.
1395
1396 Each family may include different shapes and series.  The following
1397 example demonstrates the ability to select alternate families, shapes,
1398 series and sizes.  The value supplied to @code{font-size} is the
1399 required change from the default size.
1400
1401 @lilypond[quote,verbatim,relative=2]
1402 \override Score.RehearsalMark.font-family = #'typewriter
1403 \mark \markup "Ouverture"
1404 \override Voice.TextScript.font-shape = #'italic
1405 \override Voice.TextScript.font-series = #'bold
1406 d2.^\markup "Allegro"
1407 \override Voice.TextScript.font-size = #-3
1408 c4^smaller
1409 @end lilypond
1410
1411 @noindent
1412 A similar syntax may be used in markup mode; however in this case it
1413 is preferable to use the simpler syntax explained in
1414 @ref{Selecting font and font size}:
1415
1416 @lilypond[quote,verbatim]
1417 \markup {
1418   \column {
1419     \line {
1420       \override #'(font-shape . italic)
1421       \override #'(font-size . 4)
1422       Idomeneo,
1423     }
1424     \line {
1425       \override #'(font-family . typewriter)
1426       {
1427         \override #'(font-series . bold)
1428         re
1429         di
1430       }
1431       \override #'(font-family . sans)
1432       Creta
1433     }
1434   }
1435 }
1436 @end lilypond
1437
1438 Although it is easy to switch between preconfigured fonts, it is also
1439 possible to use other fonts, as explained in the following sections:
1440 @ref{Single entry fonts} and @ref{Entire document fonts}.
1441
1442 @seealso
1443 Notation Reference:
1444 @ref{The Feta font},
1445 @ref{Music notation inside markup},
1446 @ref{Rotating objects},
1447 @ref{Selecting font and font size},
1448 @ref{Font}.
1449
1450
1451 @node Single entry fonts
1452 @unnumberedsubsubsec Single entry fonts
1453
1454 Any font that is installed on the operating system and recognized by
1455 FontConfig may be used in a score, using the following syntax:
1456
1457 @lilypond[quote,verbatim,relative=2]
1458 \override Staff.TimeSignature.font-name = #"Bitstream Charter"
1459 \override Staff.TimeSignature.font-size = #2
1460 \time 3/4
1461
1462 a1_\markup {
1463   \override #'(font-name . "Vera Bold")
1464     { Vera Bold }
1465 }
1466 @end lilypond
1467
1468 @cindex fonts, finding available
1469 @cindex finding available fonts
1470 @cindex listing available fonts
1471 @cindex available fonts, listing
1472
1473 @funindex show-available-fonts
1474
1475 The following command displays a list of all available fonts on the
1476 operating system:
1477
1478 @example
1479 lilypond -dshow-available-fonts x
1480 @end example
1481
1482 @seealso
1483 Notation Reference:
1484 @ref{Fonts explained},
1485 @ref{Entire document fonts}.
1486
1487 Snippets:
1488 @rlsr{Text}.
1489
1490 @c A source file gets never installed...
1491 @c Installed Files:
1492 @c @file{lily/font-config-scheme.cc}.
1493
1494
1495 @node Entire document fonts
1496 @unnumberedsubsubsec Entire document fonts
1497
1498 It is possible to change the fonts to be used as the default fonts in
1499 the @emph{roman}, @emph{sans} and @emph{typewriter} font families by
1500 specifying them, in that order, as shown in the example below, which
1501 automatically scales the fonts with the value set for the global staff
1502 size.  For an explanation of fonts, see @ref{Fonts explained}.
1503
1504 @cindex font families, setting
1505 @cindex fonts, changing for entire document
1506
1507 @funindex make-pango-font-tree
1508
1509 @lilypond[verbatim,quote]
1510 \paper  {
1511   #(define fonts
1512     (make-pango-font-tree "Times New Roman"
1513                           "Nimbus Sans"
1514                           "Luxi Mono"
1515                           (/ staff-height pt 20)))
1516 }
1517
1518 \relative c'{
1519   c1-\markup {
1520     roman,
1521     \sans sans,
1522     \typewriter typewriter. }
1523 }
1524 @end lilypond
1525
1526 @c we don't do Helvetica / Courier, since GS incorrectly loads
1527 @c Apple TTF fonts
1528
1529 @seealso
1530 Notation Reference:
1531 @ref{Fonts explained},
1532 @ref{Single entry fonts},
1533 @ref{Selecting font and font size},
1534 @ref{Font}.
1535