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