4.3.1 Line breaking

Line breaks are normally determined automatically. They are chosen so that lines look neither cramped nor loose, and consecutive lines have similar density.

To manually force a line break at a bar line, use the \break command:

c4 c c c | \break
c4 c c c |

[image of music]

By default, a \break in the middle of a measure is ignored, and a warning is printed. To force a line break in the middle of a measure, add an invisible bar line with ‘\bar ""’:

c4 c c
\bar "" \break
c |
c4 c c c |

[image of music]

A \break occurring at a bar line is also ignored if the previous measure ends in the middle of a note, such as when a tuplet begins and ends in different measures. To allow \break commands to work in these situations, remove the Forbid_line_break_engraver from the Voice context. Note that manually forced line breaks have to be added in parallel with the music:

\new Voice \with {
  \remove "Forbid_line_break_engraver"
} \relative c'' {
    { c2. \tuplet 3/2 { c4 c c } c2. | }
    { s1 | \break s1 | }

[image of music]

Similarly, line breaks are normally forbidden when beams cross bar lines. This behavior can be changed by setting \override Beam.breakable = ##t:

\override Beam.breakable = ##t
c2. c8[ c | \break
c8 c] c2. |

[image of music]

The \noBreak command forbids a line break at the bar line where it is inserted.

Within a score, automatic line breaking is prevented within music lying between \autoLineBreaksOff and \autoLineBreaksOn commands. If automatic page breaks should also be prevented, the commands \autoBreaksOff and \autoBreaksOn should be used. Manual breaks are unaffected by these commands. Note that inhibiting automatic line breaks may cause music to run over the right margin if it cannot all be contained within one line.

Automatic line breaks (but not page breaks) may be enabled at single bar lines by using \once \autoLineBreaksOn at a bar line. This identifies a permitted rather than a forced line break.

The most basic settings influencing line spacing are indent and line-width. They are set in the \layout block. They control the indentation of the first line of music, and the lengths of the lines.

If ragged-right is set to true in the \layout block, then systems end at their natural horizontal length, instead of being spread horizontally to fill the whole line. This is useful for short fragments, and for checking how tight the natural spacing is.

The option ragged-last is similar to ragged-right, but affects only the last line of the piece.

\layout {
  indent = 0\mm
  line-width = 150\mm
  ragged-last = ##t

For line breaks at regular intervals use \break separated by skips and repeated with \repeat. For example, this would cause the following 28 measures (assuming 4/4 time) to be broken every 4 measures, and only there:

  \repeat unfold 7 {
    s1 \noBreak s1 \noBreak
    s1 \noBreak s1 \break
  { the actual music… }

Predefined commands

\break, \noBreak, \autoBreaksOff, \autoBreaksOn, \autoLineBreaksOff, \autoLineBreaksOn.

Selected Snippets

Using an extra voice for breaks

Often it is easier to manage line and page-breaking information by keeping it separate from the music by introducing an extra voice containing only skips along with the \break, pageBreak and other layout information.

This pattern becomes especially helpful when overriding line-break-system-details and the other useful but long properties of NonMusicalPaperColumnGrob.

music = \relative c'' { c4 c c c }

\score {
  \new Staff <<
    \new Voice {
      s1 * 2 \break
      s1 * 3 \break
      s1 * 6 \break
      s1 * 5 \break
    \new Voice {
      \repeat unfold 2 { \music }
      \repeat unfold 3 { \music }
      \repeat unfold 6 { \music }
      \repeat unfold 5 { \music }

[image of music]

See also

Notation Reference: \paper variables for line breaking The \layout block.

Snippets: Spacing.

Internals Reference: LineBreakEvent.

Known issues and warnings

Placing \autoLineBreaksOff or \autoBreaksOff before any music will cause error messages to appear. Always place these commands after some music.

Other languages: deutsch, español, français, italiano, 日本語.
About automatic language selection.

LilyPond — Notation Reference v2.19.16 (development-branch).