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