#### 4.5.6 Proportional notation

LilyPond supports proportional notation, a type of horizontal spacing in which each note consumes an amount of horizontal space exactly equivalent to its rhythmic duration. This type of proportional spacing is comparable to horizontal spacing on top of graph paper. Some late 20th- and early 21st-century scores use proportional notation to clarify complex rhythmic relationships, or to facilitate the placement of timelines or other graphics directly in the score.

The following settings for proportional notation are provided, which may be used together or alone:

• `proportionalNotationDuration`
• `uniform-stretching`
• `strict-note-spacing`
• `\remove Separating_line_group_engraver`

In the examples that follow, we explore these different proportional notation settings and examine how they interact.

We start with the following one-measure example, which uses classical spacing with ragged-right turned on.

```\new RhythmicStaff {
c2 16 16 16 16 \tuplet 5/4 { 16 16 16 16 16 }
}
```

Notice that the half note starting the measure takes up far less than half of the horizontal space of the measure. Likewise, the sixteenth notes and sixteenth-note quintuplets (or twentieth notes) ending the measure together take up far more than half the horizontal space of the measure.

In classical engraving, this spacing may be exactly what we want because we can borrow horizontal space from the half note and conserve horizontal space across the measure as a whole.

On the other hand, if we want to insert a measured timeline or some other graphic above or below our score, we need proportional notation. We turn proportional notation on with the `proportionalNotationDuration` setting.

```\new RhythmicStaff {
c2 16 16 16 16 \tuplet 5/4 { 16 16 16 16 16 }
}
\layout {
\context {
\Score
proportionalNotationDuration = \musicLength 1*1/20
}
}
```

The half note at the beginning of the measure and the faster notes in the second half of the measure now occupy equal amounts of horizontal space. We could place a measured timeline or graphic above or below this example.

The `proportionalNotationDuration` setting is a context setting that lives in `Score`. Remember that context settings can appear in one of three locations within our input file – in a `\with` block, in a `\context` block, or directly in the music entry preceded by the `\set` command. As with all context settings, users can pick in which of the three different locations they would like to set `proportionalNotationDuration`.

The `proportionalNotationDuration` setting takes a single argument, which is the reference length to space all music. The call `\musicLength 1*1/20` specifies one twentieth of a whole note; values such as `\musicLength 16` and `\musicLength {2 2.}` are possible as well.

How do we select the right reference duration to pass to `proportionalNotationDuration`? Usually by a process of trial and error, beginning with a duration close to the fastest (or smallest) duration in the piece. Smaller reference durations space music loosely; larger reference durations space music tightly.

```rhythm = { c2 16 16 16 16 \tuplet 5/4 { 16 16 16 16 16 } }

\new RhythmicStaff {
\set Score.proportionalNotationDuration = \musicLength 8
% Allow overlapping of note heads.
\override NoteHead.extra-spacing-width = #'(+inf.0 . -inf.0)
\rhythm
}

\new RhythmicStaff {
\set Score.proportionalNotationDuration = \musicLength 16
\rhythm
}

\new RhythmicStaff {
\set Score.proportionalNotationDuration = \musicLength 32
\rhythm
}
```

Note that too large a reference duration – such as the eighth note, above – spaces music too tightly and can cause note head collisions. In general, proportional notation takes up more horizontal space than classical spacing. Proportional spacing provides rhythmic clarity at the expense of horizontal space.

Next we examine how to optimally space overlapping tuplets. We start by examining what happens to our original example, with classical spacing, when we add a second staff with a different type of tuplet.

```<<
\new RhythmicStaff {
c2 16 16 16 16 \tuplet 5/4 { 16 16 16 16 16 }
}
\new RhythmicStaff {
\tuplet 9/8 { c8 8 8 8 8 8 8 8 8 }
}
>>
```

The spacing is bad because the evenly spaced notes of the bottom staff do not stretch uniformly. Classical engravings include very few complex triplets and so classical engraving rules can generate this type of result. Setting `proportionalNotationDuration` fixes this.

```<<
\new RhythmicStaff {
c2 16 16 16 16 \tuplet 5/4 { 16 16 16 16 16 }
}
\new RhythmicStaff {
\tuplet 9/8 { c8 8 8 8 8 8 8 8 8 }
}
>>
\layout {
\context {
\Score
proportionalNotationDuration = \musicLength 1*1/20
}
}
```

But if we look very carefully we can see that notes of the second half of the 9-tuplet space ever so slightly more widely than the notes of the first half of the 9-tuplet. To ensure uniform stretching, we turn on `uniform-stretching`, which is a property of `SpacingSpanner`.

```<<
\new RhythmicStaff {
c2 16 16 16 16 \tuplet 5/4 { 16 16 16 16 16 }
}
\new RhythmicStaff {
\tuplet 9/8 { c8 8 8 8 8 8 8 8 8 }
}
>>
\layout {
\context {
\Score
proportionalNotationDuration = \musicLength 1*1/20
\override SpacingSpanner.uniform-stretching = ##t
}
}
```

Our two-staff example now spaces exactly, our rhythmic relationships are visually clear, and we can include a measured timeline or graphic if we want.

It is recommended to always set the `SpacingSpanner`’s `uniform-stretching` property to `#t` if you use `proportionalNotationDuration`. Omitting it, for example, causes skips to consume an incorrect amount of horizontal space.

The `SpacingSpanner` is an abstract grob that lives in the `Score` context. As with our settings of `proportionalNotationDuration`, overrides to the `SpacingSpanner` can occur in any of three different places in our input file – in the `Score`’s `\with` block, in a `Score`’s `\context` block, or directly in the note entry.

By default, there is only one `SpacingSpanner` per `Score`. This means that `uniform-stretching` is either turned on for the entire score or turned off for the entire score. We can, however, override this behavior and turn on different spacing features at different places in the score by using the command `\newSpacingSection`. See New spacing section, for more info.

Next we examine the effects of the `Separating_line_group_engraver` and see why proportional scores frequently remove this engraver. The following example shows that there is a small amount of “prefatory” space just before the first note in each system.

```\paper {
indent = 0
}

\new Staff {
c'1 \break
c'1
}
```

The amount of this prefatory space stays the same regardless whether a time signature, a key signature, or a clef follows. `Separating_line_group_engraver` is responsible for this space, and removing this engraver reduces the prefatory space to zero.

```\paper {
indent = 0
}

\new Staff \with {
\remove Separating_line_group_engraver
} {
c'1 \break
c'1
}
```

Non-musical elements like time signatures, key signatures, clefs, and accidentals are problematic in proportional notation. None of these elements has rhythmic duration, but all of them consume horizontal space. Different proportional scores approach these problems differently.

It may be possible to avoid spacing problems with key signatures simply by not having any. This is a valid option since most proportional scores are contemporary music. The same may be true of time signatures, especially for those scores that include a measured timeline or other graphic. However, such scores are exceptional, and most proportional scores do include at least some time signatures. Clefs and accidentals are even more essential.

So what strategies exist for spacing non-musical elements in a proportional context? One good option is the `strict-note-spacing` property of `SpacingSpanner`. Compare the two scores below:

```{
\set Score.proportionalNotationDuration = \musicLength 16
c''8 8 8 \clef alto d'2 d'8
}

{
\set Score.proportionalNotationDuration = \musicLength 16
\override Score.SpacingSpanner.strict-note-spacing = ##t
c''8 8 8 \clef alto d'2 d'8
}
```

Both scores are proportional, but the spacing in the first score is too loose because of the clef change. The spacing of the second score remains strict, however, because `strict-note-spacing` is turned on. Turning on this property causes the width of time signatures, key signatures, clefs, and accidentals to play no part in the spacing algorithm.

In addition to the settings given here, there are other settings that frequently appear in proportional scores.

`\override SpacingSpanner.strict-grace-spacing = ##t`

space grace notes strictly (see Positioning grace notes with floating space)

`\set tupletFullLength = ##t`

extend tuplet brackets to mark both rhythmic start and stop points

`\override Beam.breakable = ##t`

permit broken beams (see Beams across line breaks)

`\override Glissando.breakable = ##t`

permit broken glissandi (see Making glissandi breakable)

`\remove Forbid_line_break_engraver`

allow line breaks even if a musical element is still active (see Line breaking)