A.12.2 Align

\align-on-other axis (non-negative, exact integer) other-dir (number) other (markup) self-dir (number) self (markup)

Align markup self on markup other along axis axis, using self-dir and other-dir for mutual alignment of self and other, respectively. This command translates self as requested relative to its surroundings; other is not printed.

\markup \column {
  1
  12
  \align-on-other #X #RIGHT 12
                     #LEFT 12345
  123
}

[image of music]

\center-align arg (markup)

Align arg to its X center.

\markup {
  \column {
    one
    \center-align
    two
    three
  }
}

[image of music]

\center-column args (markup list)

Put args in a centered column.

\markup {
  \center-column {
    one
    two
    three
  }
}

[image of music]

Used properties:

  • baseline-skip
\column args (markup list)

Stack the markups in args vertically. The property baseline-skip determines the space between markups in args.

\markup {
  \column {
    one
    two
    three
  }
}

[image of music]

Used properties:

  • baseline-skip
\combine arg1 (markup) arg2 (markup)

Print two markups on top of each other.

Note: \combine cannot take a list of markups enclosed in curly braces as an argument; for this purpose use \overlay instead.

\markup {
  \fontsize #5
  \override #'(thickness . 2)
  \combine
    \draw-line #'(0 . 4)
    \arrow-head #Y #DOWN ##f
}

[image of music]

\concat args (markup list)

Concatenate args in a horizontal line, without spaces in between. Strings are concatenated on the input level, allowing ligatures. For example, \concat { "f" "i" } is equivalent to "fi".

\markup {
  \concat {
    one
    two
    three
  }
}

[image of music]

\dir-column args (markup list)

Make a column of args, going up or down, depending on the setting of the direction layout property.

\markup {
  \override #`(direction . ,UP)
  \dir-column {
    going up
  }
  \hspace #1
  \dir-column {
    going down
  }
  \hspace #1
  \override #'(direction . 1)
  \dir-column {
    going up
  }
}

[image of music]

Used properties:

  • baseline-skip
  • direction
\fill-line args (markup list)

Put markups in a horizontal line of width line-width. The markups are spaced or flushed to fill the entire line. If there are no arguments, return an empty stencil.

\markup {
  \column {
    \fill-line {
      Words evenly spaced across the page
    }
    \null
    \fill-line {
      \line { Text markups }
      \line {
        \italic { evenly spaced }
      }
      \line { across the page }
    }
    \null
    \override #'(line-width . 50)
    \fill-line {
      Width explicitly specified
    }
  }
}

[image of music]

Used properties:

  • line-width (#f)
  • word-space (0.6)
  • text-direction (1)
\fill-with-pattern space (number) dir (direction) pattern (markup) left (markup) right (markup)

Put left and right in a horizontal line of width line-width with a line of markups pattern in between. Patterns are spaced apart by space. Patterns are aligned to the dir markup.

\markup \column {
  "right-aligned :"
  \fill-with-pattern #1 #RIGHT . first right
  \fill-with-pattern #1 #RIGHT . second right
  \null
  "center-aligned :"
  \fill-with-pattern #1.5 #CENTER - left right
  \null
  "left-aligned :"
  \override #'(line-width . 50)
  \fill-with-pattern #2 #LEFT : left first
  \override #'(line-width . 50)
  \fill-with-pattern #2 #LEFT : left second
}

[image of music]

Used properties:

  • line-width
  • word-space
\general-align axis (integer) dir (number) arg (markup)

Align arg in axis direction to the dir side.

\markup {
  \column {
    one
    \general-align #X #LEFT
    two
    three
    \null
    one
    \general-align #X #CENTER
    two
    three
    \null
    \line {
      one
      \general-align #Y #UP
      two
      three
    }
    \null
    \line {
      one
      \general-align #Y #3.2
      two
      three
    }
  }
}

[image of music]

\halign dir (number) arg (markup)

Set horizontal alignment. If dir is -1, then it is left-aligned, while +1 is right. Values in between interpolate alignment accordingly.

\markup {
  \column {
    one
    \halign #LEFT
    two
    three
    \null
    one
    \halign #CENTER
    two
    three
    \null
    one
    \halign #RIGHT
    two
    three
    \null
    one
    \halign #-5
    two
    three
  }
}

[image of music]

\hcenter-in length (number) arg (markup)

Center arg horizontally within a box of extending length/2 to the left and right.

\new StaffGroup <<
  \new Staff {
    \set Staff.instrumentName = \markup {
      \hcenter-in #12
      Oboe
    }
    c''1
  }
  \new Staff {
    \set Staff.instrumentName = \markup {
      \hcenter-in #12
      Bassoon
    }
    \clef tenor
    c'1
  }
>>

[image of music]

\hspace amount (number)

Create an invisible object taking up horizontal space amount.

\markup {
  one
  \hspace #2
  two
  \hspace #8
  three
}

[image of music]

\justify args (markup list)

Like \wordwrap, but with lines stretched to justify the margins. Use \override #'(line-width . X) to set the line width; X is the number of staff spaces.

\markup {
  \justify {
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore
    magna aliqua.  Ut enim ad minim veniam, quis nostrud
    exercitation ullamco laboris nisi ut aliquip ex ea
    commodo consequat.
  }
}

[image of music]

Used properties:

  • text-direction (1)
  • word-space
  • line-width (#f)
  • baseline-skip
\justify-field symbol (symbol)

Justify the data which has been assigned to symbol.

\header {
  title = "My title"
  myText = "Lorem ipsum dolor sit amet, consectetur
    adipisicing elit, sed do eiusmod tempor incididunt
    ut labore et dolore magna aliqua.  Ut enim ad minim
    veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat."
}

\paper {
  bookTitleMarkup = \markup {
    \column {
      \fill-line { \fromproperty #'header:title }
      \null
      \justify-field #'header:myText
    }
  }
}

\markup {
  \null
}

[image of music]

\justify-line args (markup list)

Put markups in a horizontal line of width line-width. The markups are spread to fill the entire line and separated by equal space. If there are no arguments, return an empty stencil.

\markup {
  \justify-line {
    Constant space between neighboring words
  }
}

[image of music]

Used properties:

  • line-width (#f)
  • word-space (0.6)
  • text-direction (1)
\justify-string arg (string)

Justify a string. Paragraphs may be separated with double newlines

\markup {
  \override #'(line-width . 40)
  \justify-string #"Lorem ipsum dolor sit amet, consectetur
      adipisicing elit, sed do eiusmod tempor incididunt ut
      labore et dolore magna aliqua.


      Ut enim ad minim veniam, quis nostrud exercitation
      ullamco laboris nisi ut aliquip ex ea commodo
      consequat.


      Excepteur sint occaecat cupidatat non proident, sunt
      in culpa qui officia deserunt mollit anim id est
      laborum"
}

[image of music]

Used properties:

  • text-direction (1)
  • word-space
  • line-width
  • baseline-skip
\left-align arg (markup)

Align arg on its left edge.

\markup {
  \column {
    one
    \left-align
    two
    three
  }
}

[image of music]

\left-column args (markup list)

Put args in a left-aligned column.

\markup {
  \left-column {
    one
    two
    three
  }
}

[image of music]

Used properties:

  • baseline-skip
\line args (markup list)

Put args in a horizontal line. The property word-space determines the space between markups in args.

\markup {
  \line {
    one two three
  }
}

[image of music]

Used properties:

  • text-direction (1)
  • word-space
\lower amount (number) arg (markup)

Lower arg by the distance amount. A negative amount indicates raising; see also \raise.

\markup {
  one
  \lower #3
  two
  three
}

[image of music]

\overlay args (markup list)

Takes a list of markups combining them.

\markup {
  \fontsize #5
  \override #'(thickness . 2)
  \overlay {
    \draw-line #'(0 . 4)
    \arrow-head #Y #DOWN ##f
    \translate #'(0 . 4)\arrow-head #Y #UP ##f
  }
}

[image of music]

\pad amount (number) arg (markup)

Add space around a markup object. Identical to pad-around.

\markup {
  \box {
    default
  }
  \hspace #2
  \box {
    \pad-markup #1 {
      padded
    }
  }
}

[image of music]

\pad-around amount (number) arg (markup)

Add padding amount all around arg.

\markup {
  \box {
    default
  }
  \hspace #2
  \box {
    \pad-around #0.5 {
      padded
    }
  }
}

[image of music]

\pad-to-box x-ext (pair of numbers) y-ext (pair of numbers) arg (markup)

Make arg take at least x-ext, y-ext space.

\markup {
  \box {
    default
  }
  \hspace #4
  \box {
    \pad-to-box #'(0 . 10) #'(0 . 3) {
      padded
    }
  }
}

[image of music]

\pad-x amount (number) arg (markup)

Add padding amount around arg in the X direction.

\markup {
  \box {
    default
  }
  \hspace #4
  \box {
    \pad-x #2 {
      padded
    }
  }
}

[image of music]

\put-adjacent axis (integer) dir (direction) arg1 (markup) arg2 (markup)

Put arg2 next to arg1, without moving arg1.

\raise amount (number) arg (markup)

Raise arg by the distance amount. A negative amount indicates lowering, see also \lower.

The argument to \raise is the vertical displacement amount, measured in (global) staff spaces. \raise and \super raise objects in relation to their surrounding markups.

If the text object itself is positioned above or below the staff, then \raise cannot be used to move it, since the mechanism that positions it next to the staff cancels any shift made with \raise. For vertical positioning, use the padding and/or extra-offset properties.

\markup {
  C
  \small
  \bold
  \raise #1.0
  9/7+
}

[image of music]

\right-align arg (markup)

Align arg on its right edge.

\markup {
  \column {
    one
    \right-align
    two
    three
  }
}

[image of music]

\right-column args (markup list)

Put args in a right-aligned column.

\markup {
  \right-column {
    one
    two
    three
  }
}

[image of music]

Used properties:

  • baseline-skip
\rotate ang (number) arg (markup)

Rotate object with ang degrees around its center.

\markup {
  default
  \hspace #2
  \rotate #45
  \line {
    rotated 45°
  }
}

[image of music]

\translate offset (pair of numbers) arg (markup)

Translate arg relative to its surroundings. offset is a pair of numbers representing the displacement in the X and Y axis.

\markup {
  *
  \translate #'(2 . 3)
  \line { translated two spaces right, three up }
}

[image of music]

\translate-scaled offset (pair of numbers) arg (markup)

Translate arg by offset, scaling the offset by the font-size.

\markup {
  \fontsize #5 {
    * \translate #'(2 . 3) translate
    \hspace #2
    * \translate-scaled #'(2 . 3) translate-scaled
  }
}

[image of music]

Used properties:

  • font-size (0)
\vcenter arg (markup)

Align arg to its Y center.

\markup {
  one
  \vcenter
  two
  three
}

[image of music]

\vspace amount (number)

Create an invisible object taking up vertical space of amount multiplied by 3.

\markup {
    \center-column {
    one
    \vspace #2
    two
    \vspace #5
    three
  }
}

[image of music]

\wordwrap args (markup list)

Simple wordwrap. Use \override #'(line-width . X) to set the line width, where X is the number of staff spaces.

\markup {
  \wordwrap {
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore
    magna aliqua.  Ut enim ad minim veniam, quis nostrud
    exercitation ullamco laboris nisi ut aliquip ex ea
    commodo consequat.
  }
}

[image of music]

Used properties:

  • text-direction (1)
  • word-space
  • line-width (#f)
  • baseline-skip
\wordwrap-field symbol (symbol)

Wordwrap the data which has been assigned to symbol.

\header {
  title = "My title"
  myText = "Lorem ipsum dolor sit amet, consectetur
    adipisicing elit, sed do eiusmod tempor incididunt ut
    labore et dolore magna aliqua.  Ut enim ad minim
    veniam, quis nostrud exercitation ullamco laboris nisi
    ut aliquip ex ea commodo consequat."
}

\paper {
  bookTitleMarkup = \markup {
    \column {
      \fill-line { \fromproperty #'header:title }
      \null
      \wordwrap-field #'header:myText
    }
  }
}

\markup {
  \null
}

[image of music]

\wordwrap-string arg (string)

Wordwrap a string. Paragraphs may be separated with double newlines.

\markup {
  \override #'(line-width . 40)
  \wordwrap-string #"Lorem ipsum dolor sit amet,
      consectetur adipisicing elit, sed do eiusmod tempor
      incididunt ut labore et dolore magna aliqua.


      Ut enim ad minim veniam, quis nostrud exercitation
      ullamco laboris nisi ut aliquip ex ea commodo
      consequat.


      Excepteur sint occaecat cupidatat non proident,
      sunt in culpa qui officia deserunt mollit anim id
      est laborum"
}

[image of music]

Used properties:

  • text-direction (1)
  • word-space
  • line-width
  • baseline-skip

LilyPond — Notation Reference v2.24.4 (stable-branch).