### 4.5.5 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.

LilyPond supports five different settings for proportional notation, which may be used together or alone:

- `proportionalNotationDuration`
- `uniform-stretching`
- `strict-note-spacing`
- `\remove "Separating_line_group_engraver"`
- `\override PaperColumn.used = ##t`

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

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

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>       >>
>     }

Notice that the half note which begins 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) which end 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 other graphic above or below our score, we need proportional notation. We turn proportional notation on with the proportionalNotationDuration setting.

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>       >>
>      \layout {
>         \context {
>           \Score
>           proportionalNotationDuration = #(ly:make-moment 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 music entry preceded by the `\set` command. As with all context settings, users can pick which of the three different locations they would like to set `proportionalNotationDuration` in to.

The `proportionalNotationDuration` setting takes a single argument, which is the reference duration against that all music will be spaced. The LilyPond Scheme function `make-moment` takes two arguments – a numerator and denominator which together express some fraction of a whole note. The call `(ly:make-moment 1/20)` therefore produces a reference duration of a twentieth note. Values such as `(ly:make-moment 1/16)`, `(ly:make-moment 1/8)`, and `(ly:make-moment 3/97)` are all 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.

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>       >>
>       \layout {
>         \context {
>           \Score
>           proportionalNotationDuration = #(ly:make-moment 1/8)
>         }
>       }
>     }

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>       >>
>       \layout {
>         \context {
>           \Score
>           proportionalNotationDuration = #(ly:make-moment 1/16)
>         }
>       }
>     }

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>       >>
>       \layout {
>         \context {
>           \Score
>           proportionalNotationDuration = #(ly:make-moment 1/32)
>         }
>       }
>     }

Note that too large a reference duration – such as the eighth note, above – spaces music too tightly and can cause note head collisions. Also that proportional notation in general 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.

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>         \new RhythmicStaff {
>           \tuplet 9/8 { c'8 c' c' c' c' c' c' c' c' }
>         }
>       >>
>     }

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.

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>         \new RhythmicStaff {
>           \tuplet 9/8 { c'8 c' c' c' c' c' c' c' c' }
>         }
>       >>
>       \layout {
>         \context {
>           \Score
>           proportionalNotationDuration = #(ly:make-moment 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`.

>     \score {
>       <<
>         \new RhythmicStaff {
>           c'2 c'16 c' c' c' \tuplet 5/4 { c'16 c' c' c' c' }
>         }
>         \new RhythmicStaff {
>           \tuplet 9/8 { c'8 c' c' c' c' c' c' c' c' }
>         }
>       >>
>       \layout {
>         \context {
>           \Score
>           proportionalNotationDuration = #(ly:make-moment 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.

Note that the LilyPond’s proportional notation package expects that all proportional scores set the SpacingSpanner’s ’uniform-stretching attribute to ##t. Setting proportionalNotationDuration without also setting the SpacingSpanner’s ’uniform-stretching attribute to ##t will, for example, cause 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 \with block, in a Score \context block, or in note entry directly.

There is by default only one `SpacingSpanner` per `Score`. This means that, by default, `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. We do this with the command `\newSpacingSection`. See New spacing area, 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 is the same whether after a time signature, a key signature or a clef. `Separating_line_group_engraver` is responsible for this space. Removing `Separating_line_group_engraver` reduces this 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 these elements 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. But these scores are exceptional and most proportional scores 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:

>     \new Staff {
>       \set Score.proportionalNotationDuration = #(ly:make-moment 1/16)
>       c''8 c'' c'' \clef alto d' d'2
>     }

>     \new Staff {
>       \set Score.proportionalNotationDuration = #(ly:make-moment 1/16)
>       \override Score.SpacingSpanner.strict-note-spacing = ##t
>       c''8 c'' c'' \clef alto d' d'2
>     }

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 strict-note-spacing 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. These include:

- `\override SpacingSpanner.strict-grace-spacing = ##t`
- `\set tupletFullLength = ##t`
- `\override Beam.breakable = ##t`
- `\override Glissando.breakable = ##t`
- `\override TextSpanner.breakable = ##t`
- `\remove "Forbid_line_break_engraver" in the Voice context`

These settings space grace notes strictly, extend tuplet brackets to mark both rhythmic start- and stop-points, and allow spanning elements to break across systems and pages. See the respective parts of the manual for these related settings.

#### See also

Notation Reference: New spacing area.

Snippets: Spacing.

其他语言：deutsch, español, français, italiano, 日本語。
About automatic language selection.

#### LilyPond — Notation Reference v2.18.2 (稳定分支).