Previous: Unmetered music, Up: Staff notation



3.3.8 Bar lines

Bar lines delimit measures, but are also used to indicate repeats. Normally, they are inserted automatically. Line breaks may only happen on bar lines.

Special types of bar lines can be forced with the \bar command

     c4 \bar "|:" c4

[image of music]

The following bar types are available

     c4
     \bar "|" c
     \bar "" c
     \bar "|:" c
     \bar "||" c
     \bar ":|" c
     \bar ".|" c
     \bar ".|." c
     \bar ":|:" c
     \bar "|." c
     \bar ":" c

[image of music]

For allowing line breaks, there is a special command,

       \bar "empty"

This will insert an invisible bar line, and allow line breaks at this point.

In scores with many staves, a \bar command in one staff is automatically applied to all staves. The resulting bar lines are connected between different staves of a StaffGroup

     <<
       \context StaffGroup <<
         \new Staff {
           e'4 d'
           \bar "||"
           f' e'
         }
         \new Staff { \clef bass c4 g e g }
       >>
       \new Staff { \clef bass c2 c2 }
     >>

[image of music]

A bar line is created whenever the whichBar property is set. At the start of a measure it is set to the contents of defaultBarType. The contents of repeatCommands are used to override default measure bars.

The command \bar bartype is a short cut for doing \set Timing.whichBar = bartype. Whenever whichBar is set to a string, a bar line of that type is created.

You are encouraged to use \repeat for repetitions. See Repeats.

See also

In this manual: Repeats.

Program reference: the bar line objects that are created at Staff level are called BarLine, the bar lines that span staves are SpanBar objects.

The bar lines at the start of each system are SystemStartBar, SystemStartBrace, and SystemStartBracket. Only one of these types is created in every context, and that type is determined by the property systemStartDelimiter.

Examples: input/test/bar-lines.ly,

Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.