GNU LilyPond Learning Manual: 3.1.4 On the un-nestedness of brackets and ties

### 3.1.4 On the un-nestedness of brackets and ties

You have already met a number of different types of bracket in writing the input file to LilyPond. These obey different rules which can be confusing at first. Before we explain the rules let’s first review the different types of bracket.

Bracket Type | Function
--- | ---
`{ .. }` | 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 `\times 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 brackets, 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. 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:

>      { g8\( a b[ c b\) a] }

In general, different kinds of brackets, 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).

>     {
>       r16[ g16 \times 2/3 {r16 e'8] }
>       g16( a \times 2/3 {b d) e' }
>       g8[( a \times 2/3 {b d') e'~]}
>       \times 4/5 {e'32\( a b d' e'} a'4.\)
>     }

Other languages: français, español, deutsch.

#### Learning Manual