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