[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Selecting font and font size ] | [ Up : Formatting text ] | [ Graphic notation inside markup > ] |
Text alignment
This subsection discusses how to place text in markup mode. Markup objects can also be moved as a whole, using the syntax described in Moving objects.
Markup objects may be aligned in different ways. By default, a text indication is aligned on its left edge: in the following example, there is no difference between the first and the second markup. That example also demonstrates various syntactically correct ways of placing the alignment commands:
\relative { d''1-\markup { poco } f d-\markup { \left-align poco } f d-\markup { \center-align { poco } } f d-\markup \right-align { poco } }![]()
Horizontal alignment may be fine-tuned using a numeric value:
\relative { a'1-\markup { \halign #-1 poco } e' a,-\markup { \halign #0 poco } e' a,-\markup { \halign #0.5 poco } e' a,-\markup { \halign #2 poco } }![]()
Lastly, words and any other objects may be moved horizontally by
preceding them with \hspace
. Negative values are also
supported and move any objects that follow into the opposite
direction. Here, we put \hspace
into a box to better show
its effect.
\relative { d''1-\markup { poco } f d-\markup \concat { \with-color #darkred \box \hspace #4 poco } f d-\markup \concat { \with-color #darkred \box \hspace #-4 poco } f d-\markup \concat { \with-color #darkred \box \hspace #10 poco } }![]()
Some objects may have alignment procedures of their own, and therefore are not affected by these commands. It is possible to move such markup objects as a whole, as shown for instance in Text marks.
Vertical alignment can be set in a similar way. As stated above, markup objects can be moved as a whole; however, it is also possible to move specific elements inside a markup block.
\relative { d'2^\markup { Acte I \raise #2 { Scène 1 } } a' g_\markup { \lower #4 \bold { Très modéré } } a d,^\markup \raise #4 \italic { Une forêt. } a'4 a g2 a }![]()
Some commands can affect both the horizontal and vertical alignment of text objects in markup mode:
\relative { d'2^\markup { Acte I \translate #'(2 . 2) "Scène 1" } a' g_\markup { \general-align #Y #5 \bold "Très modéré" } a d,^\markup \translate-scaled #'(-3 . 2) \teeny { "Une forêt." } a'4 a g2 a }![]()
Note that \vspace
can not be used in general to move
arbitrary objects up or down within a \column
markup due to
the way the latter is implemented. The following naïve approach
thus fails.
\relative { d'2^\markup { Acte I \column { \vspace #-2 "Scène 1" } } a' g_\markup \column { \vspace #1 "Très modéré" } a d,^\markup \column { "Une forêt." \vspace #2 } a'4 a g2 a }![]()
What actually works is to put \vspace
between two objects
that have non-empty extents.
\relative { d'2^\markup { Acte I \column { " " \vspace #-2 "Scène 1" } } a' g_\markup \column { " " \vspace #1 "Très modéré" } a d,^\markup \column { "Une forêt." \vspace #2 " " } a'4 a g2 a }![]()
A markup object may include several lines of text. In the following example, each element or expression is placed on its own line, either left-aligned or centered:
\markup { \column { a "b c" \line { d e f } } \hspace #10 \center-column { a "b c" \line { d e f } } }![]()
Similarly, a list of elements or expressions may be spread to fill the entire horizontal line width (if there is only one element, it will be centered on the page). These expressions can, in turn, include multi-line text or any other markup expression:
\markup { \fill-line { \line { William S. Gilbert } \center-column { \huge \smallCaps "The Mikado" or \smallCaps "The Town of Titipu" } \line { Sir Arthur Sullivan } } } \markup { \fill-line { 1885 } }![]()
Elements may be spread to fill any specified width by overriding
the line-width
property. By default it is set to
#f
which indicates the entire line:
\markup { \column { \fill-line { left center right } \null \override #'(line-width . 30) \fill-line { left center right } } }![]()
Long text indications can also be automatically wrapped accordingly to the given line width. These will be either left-aligned or justified, as shown in the following example.
\markup { \column { \line \smallCaps { La vida breve } \line \bold { Acto I } \wordwrap \italic { (La escena representa el corral de una casa de gitanos en el Albaicín de Granada. Al fondo una puerta por la que se ve el negro interior de una Fragua, iluminado por los rojos resplandores del fuego.) } \hspace #0 \line \bold { Acto II } \override #'(line-width . 50) \justify \italic { (Calle de Granada. Fachada de la casa de Carmela y su hermano Manuel con grandes ventanas abiertas a través de las que se ve el patio donde se celebra una alegre fiesta) } } }![]()
An exhaustive list of text alignment commands can be found in Markup for text alignment.
See also
Learning Manual: Moving objects.
Notation Reference: Markup for text alignment, Text marks.
Installed Files: scm/define-markup-commands.scm.
Snippets: Text.
Internals Reference: TextScript.
[ << Musical notation ] | [Top][Contents][Index] | [ Specialist notation >> ] |
[ < Selecting font and font size ] | [ Up : Formatting text ] | [ Graphic notation inside markup > ] |