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. Occasionally you might want to override the automatic breaks; you can do this by specifying \break. This will force a line break at this point. However, line breaks can only occur at the end of ‘complete’ bars, i.e., where there are no notes or tuplets left ‘hanging’ over the bar line. If you want to have a line break where there is no bar line, you can force an invisible bar line by entering \bar "", although again there must be no notes left hanging over in any of the staves at this point, or it will be ignored.

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

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
line-width = #150
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 real music

A linebreaking configuration can be saved as a .ly file automatically. This allows vertical alignments to be stretched to fit pages in a second formatting run. This is fairly new and complicated. More details are available in Spacing.

Predefined commands

\break, \noBreak.

See also

Internals Reference: LineBreakEvent.

Snippets: Spacing.

Known issues and warnings

Line breaks can only occur if there is a ‘proper’ bar line. A note which is hanging over a bar line is not proper, such as

c4 c2 << c2 {s4 \break } >>  % this does nothing
c2 c4 |           % a break here would work
c4 c2 c4 ~ \break % as does this break
c4 c2 c4

[image of music]

This can be avoided by removing the Forbid_line_break_engraver. Note that manually forced line breaks have to be added in parallel with the music.

\new Voice \with {
  \remove Forbid_line_break_engraver
} {
  c4 c2 << c2 {s4 \break } >>  % now the break is allowed
  c2 c4

[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.

Other languages: espaƱol.

Notation Reference