Next: , Previous: Selecting font and font size, Up: Formatting text


1.8.2.3 Text alignment

This subsection discusses how to place text in markup mode, inside a \markup block. 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.

     
     a1-\markup { poco }
     e'
     a,-\markup { \left-align poco }
     e'
     a,-\markup { \center-align { poco } }
     e'
     a,-\markup { \right-align poco }

[image of music]

The horizontal alignment may be fine-tuned using a numeric value:

     
     a1-\markup { \halign #-1 poco }
     e'
     a,-\markup { \halign #0 poco }
     e'
     a,-\markup { \halign #0.5 poco }
     e'
     a,-\markup { \halign #2 poco }

[image of music]

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 is a bit more complex. As stated above, markup objects can be moved as a whole; however, it is also possible to move specific elements inside a markup block. In this case, the element to be moved needs to be preceded with an anchor point, that can be another markup element or an invisible object. The following example demonstrates these two possibilities; the last markup in this example has no anchor point, and therefore is not moved.

     
     d2^\markup { 
       Acte I
       \raise #2 { Scène 1 } }
     a'
     g_\markup {
       \null
       \lower #4 \bold { Très modéré } }
     a
     d,^\markup {
       \raise #4 \italic { Une forêt. } }
     a'4 a g2 a

[image of music]

Some commands can affect both the horizontal and vertical alignment of text objects in markup mode. Any object affected by these commands must be preceded with an anchor point:

     
     d2^\markup {
       Acte I
       \translate #'(-1 . 2) "Scène 1" }
     a'
     g_\markup {
       \null
       \general-align #Y #3.2 \bold "Très modéré" }
     a
     d,^\markup {
       \null
       \translate-scaled #'(-1 . 2) \teeny "Une forêt." }
     a'4 a g2 a

[image of music]

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 }
       }
     }

[image of music]

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 } 
     }

[image of music]

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 vé 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)
         }
       }
     }

[image of music]

An exhaustive list of text alignment commands can be found in Align.

Esta página corresponde a LilyPond-2.11.58 (rama de desarrollo).

Informe de los fallos a través de la lista en español lilypond-es, o en inglés a través de http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.

Se agradecen las sugerencias para la documentación.