On Wed, 2025-11-19 at 13:33 +0100, Xavier Scheuer wrote:
> On Wed, 19 Nov 2025 at 13:18, Richard Shann <[email protected]>
> wrote:
> > 
> > On Wed, 2025-11-12 at 15:33 +0000, Richard Shann wrote:
> > > In this example, after a key signature change there seems to be
> > > unnecessary extra space:
> > 
> > I have tried to make no space at all with this:
> > 
> > \version "2.25.18"
> > {
> >          g'1
> >         \override KeySignature.extra-spacing-width = #'(+inf.0 . -
> > inf.0) \key f \major a''
> > }
> > 
> > but that has no effect. So I still can't place the note a'' at the
> > same
> > distance from the key change as it would be from the barline if the
> > key
> > change wasn't there. Help!
> 
> Hello,
> 
> I am not sure what you are trying to achieve.
well, as indicated by the little black squares I've put onto this
screenshot of the typeset of my MWE, the distance between the first
note and the time signature is greater than the distance between the
second note and the clef change, for no apparent reason.


> Anyway, you need to use \override Staff.KeySignature because
> the Key_engraver is part of the Staff context.
> I would have used \override Staff.KeySignature.extra-spacing-width =
> #'(0 . 0)
> You can also have a look at the settings of \override
> Staff.KeySignature.space-alist
> \override Staff.KeySignature.space-alist = #'((ambitus extra-space .
> 1.15)
>   (key-cancellation extra-space . 0.3)
>   (time-signature extra-space . 1.15)
>   (signum-repetitionis extra-space . 1.1)
>   (staff-bar extra-space . 1.1)
>   (cue-clef extra-space . 0.5)
>   (optional-material-end-bracket extra-space . 1.0)
>   (optional-material-start-bracket extra-space . 1.0)
>   (right-edge extra-space . 0.5)
>   (first-note shrink-space . 0))
> https://lilypond.org/doc/v2.25/Documentation/internals/keysignature
> 
> Finally if you want the key signature to take no horizontal space at
> all, then probably use
> \override Staff.KeySignature.X-extent = #'(0 . 0)

Trying your suggestion:

\version "2.25.18"
{
         g'1
   
   %   \once\override Staff.KeySignature.X-extent = #'(0 . 0)
        \key f \major  a'' a''
}
{
         g'1
   
        \once\override Staff.KeySignature.X-extent = #'(0 . 0)
        \key f \major  a'' a''
}

indeed moves the a'' closer to the key change, though not as close as
the extra a'' I've added comes to the barline it follows. 
But I don't understand what "take no space at all" means - it would
seem natural that it should take the space needed to draw it and then
that a gap similar to those before the other two notes should follow.

With my thanks for you helpful reply

Richard


> 
> Kind regards,
> Xavier
> 

Reply via email to