3.1.5 On the un-nestedness of brackets and ties

You have already met a number of different types of bracket and bracket-like constructs in writing the input file to LilyPond. These obey different rules which can be confusing at first. Let’s first review the different types of brackets and bracket-like constructs.

Bracket TypeFunction
{ … }Encloses a sequential segment of music
< … >Encloses the notes of a chord
<< … >>Encloses simultaneous music expressions
( … )Marks the start and end of a slur
\( … \)Marks the start and end of a phrasing slur
[ … ]Marks the start and end of a manual beam

To these we should add other constructs which generate lines between or across notes: ties (marked by a tilde, ~), tuplets written as \tuplet x/y { … }, and grace notes written as \grace { … }.

Outside LilyPond, the conventional use of brackets requires the different types to be properly nested, like this, << [ { ( … ) } ] >>, with the closing brackets being encountered in exactly the opposite order to the opening brackets. This is a requirement for the three types of bracket described by the word ‘Encloses’ in the table above – they must nest properly. However, the remaining bracket-like constructs, described with the word ‘Marks’ in the table above together with ties and tuplets, do not have to nest properly with any of the brackets or bracket-like constructs. In fact, these are not brackets in the sense that they enclose something – they are simply markers to indicate where something starts and ends.

So, for example, a phrasing slur can start before a manually inserted beam and end before the end of the beam – not very musical, perhaps, but possible:

\relative { g'8\( a b[ c b\) a] g4 }

[image of music]

In general, different kinds of brackets, bracket-like constructs, and those implied by tuplets, ties and grace notes, may be mixed freely. This example shows a beam extending into a tuplet (line 1), a slur extending into a tuplet (line 2), a beam and a slur extending into a tuplet, a tie crossing two tuplets, and a phrasing slur extending out of a tuplet (lines 3 and 4).

\relative {
  r16[ g' \tuplet 3/2 { r16 e'8] }
  g,16( a \tuplet 3/2 { b16 d) e }
  g,8[( a \tuplet 3/2 { b8 d) e~] } |
  \tuplet 5/4 { e32\( a, b d e } a4.\)

[image of music]

LilyPond — Learning Manual v2.22.1 (stable-branch).