bug-lilypond
[Top][All Lists]

## Re: DynamicText.extra-spacing-width in StaffGroups and similar

 From: Jean Abou Samra Subject: Re: DynamicText.extra-spacing-width in StaffGroups and similar Date: Sun, 19 Jun 2022 22:22:19 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

```Le 19/06/2022 à 22:04, Simon Albrecht a écrit :
```
```On 19/06/2022 19:17, Jean Abou Samra wrote:
```
For my own use now, it’s easy to override extra-spacing-width to infinitesimal for all Voice contexts.
```

You're welcome. Just curious: what do you mean by 'infinitesimal'?
'(+inf.0 . -inf.0)? That simply means to make the height entirely
```
empty.
```

```
That’s what I meant—didn’t want to type it out… did I misunderstand? I thought it’s an infinitely small interval, because '(0 . 0) would/might lead to some sort of computational problem… My programming knowledge is very superficial.
```

OK, let me try to explain:

As an interval, '(+inf.0 . -inf.0) is not “infinitely small”,
it's *completely* empty. It is the set of numbers that are
higher than +inf.0 (or equal) and lower than -inf.0 (or equal),
i.e. nothing. In contrast, '(0 . 0) is a single-point interval
containing just 0, which is the only number x such that
0 <= x <= 0.

In fact, any interval '(a . b) with a > b is empty. However,
LilyPond uses '(+inf.0 . -inf.0) as the conventional empty
interval because it is convenient for defining interval union
and intersection operations. For instance, the union of

'(a . b)

and

'(c . d)

is normally

'(<min of a and c> . <min of b and d>)

For example, if you unite

'(-1 . 0)

and

'(1 . 2)

that gives you

'(-1 . 2)

That's the general law ... except that it doesn't work if
there are empty intervals, for example

'(2 . 1)

and

'(-1 . -2)

where this would give

'(-1 . 1)

which is nonempty, whereas the two intervals being united
are empty. On the other hand, '(+inf.0 . -inf.0) works
nicely with this because the min of +inf.0 and x is
x for any x, and the max of -inf.0 and x is also x for
any x, so the union of any interval with '(+inf.0 . -inf.0)
is that interval. For this reason, everything that
needs an empty interval in LilyPond tries to use
'(+inf.0 . -inf.0).

That being said, extra-spacing-width is not really an interval.
The deal is that LilyPond computes the grob's X-extent,
then adds the car of extra-spacing-width to the extent's car
and the cdr of extra-spacing-width to the extent's cdr. Thus,
extra-spacing-width defines how to make the extent larger
or smaller compared to its default value. If you use
'(0 . 0), that just means to leave the extent as-is
(add 0 to each bound). If you use '(+inf.0 . -inf.0),
it leads to the final interval being the conventional
empty interval, '(+inf.0 . -inf.0), because +inf.0 added
to anything is +inf.0, and -inf.0 added to anything is
-inf.0. (Except in the case of +inf.0 + -inf.0 or
-inf.0 + +inf.0, which would give NaN, but these are
special-cased in the handling of extra-spacing-width so
that the resulting interval is still '(+inf.0 . -inf.0).)

Hope that's clearer?

Cheers,
Jean

```