lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Key signature and key cancellation need to be aligned


From: David Sumbler
Subject: Re: Key signature and key cancellation need to be aligned
Date: Wed, 28 Jan 2015 18:00:53 +0000

> 2015-01-27 12:56 GMT+01:00 David Sumbler <address@hidden>:
> > I use Staff.printKeyCancellation = ##f in my score.
> >
> > At one point the key changes from C major (concert) to C minor.  As the
> > piece is for a standard saxophone quartet, this means that 2 of the
> > instruments change from D major (notated) to D minor, and the other 2
> > change from A major to A minor.
> >
> > A minor, of course, is the "open" key with no sharps or flats, and,
> > notwithstanding the negation of printKeyCancellation, Lilypond correctly
> > prints a key cancellation at this point on the 2 staves that require it.
> >
> > The other 2 parts, in which the key changes from 2 sharps to 1 flat,
> > correctly do not get a key cancellation.
> >
> > So far, so good.
> >
> > The problem is that the actual key signatures on the 2 staves that have
> > them are not vertically aligned with the key cancellations on the other
> > 2 staves.  Instead, they are printed after the key cancellations.  In
> > other words, each of the 2 key signatures is printed as if there were an
> > invisible key cancellation preceding it on the stave.  This looks wrong,
> > and I should like them to appear above and below the actual key
> > cancellations on the other 2 staves.
> >
> > I have experimented with changing KeySignature.X-offset (which had no
> > effect) and KeySignature.extra-offset.  The latter works, but
> > unfortunately the position of the time signature and music which follow
> > remain unchanged, so that there is now an unnecessary gap after the key
> > signatures/cancellations.
> >
> > How can I get the effect I want, and get Lilypond to take account of the
> > change in the position of the key signatures?
> >
> > David
> 
> 
> Hi David,
> 
> how about a minimal example?
> 
> -Harm

Here we are, then: the following illustrates the problem.

\version "2.18.0"
\language "english"

\new StaffGroup <<
    \new Staff \relative c'' {
        \transposition bf
        \time 3/4
        \key d \major
        a2 r4 |
        \key d \minor
        \time 2/4
        R2 |
    }
    \new Staff \relative c'' {
        \transposition ef
        \time 3/4
        \key a \major
        gs2 r4 |
        \key a \minor
        \time 2/4
        R2 |
    }
>>

\layout {
    \context {
        \Staff printKeyCancellation = ##f
    }
}

I have had 2 very interesting responses to my query, one from Thomas
Morley and one (off-list) from Kevin Barry.  Both had slight problems
with them, and experimenting with them has once again helped
considerably in improving my understanding of the workings of Lilypond.

Thomas suggested adding

    \once \override Score.KeyCancellation.space-alist.key-signature = 
#'(extra-space . -2.4)
    \once \override Score.KeySignature.space-alist.time-signature = 
#'(extra-space . 2.6)

The only problem was this was that, although it solved the problem in the score,
it introduced a problem in the parts for the instruments with an actual
key signature.  I could get around this by using tags, of course.

Kevin's suggestion, which, after modification, was the one I ultimately
used, was to omit '\key a \minor' and to add:

    \override Staff.KeyCancellation.stencil = ##f
    \set Staff.keySignature = #`((10 . ,NATURAL) (7 . ,NATURAL) (11 . ,NATURAL))

This worked well, except that the dummy key signature with natural
signs then appeared on every subsequent line.  My final solution is:

    \override Staff.KeyCancellation.stencil = ##f
    \override Staff.KeySignature.break-visibility = #all-invisible
    \set Staff.keySignature = #`((10 . ,NATURAL) (7 . ,NATURAL) (11 . ,NATURAL))

Then, immediately before the next key change:

    \revert Staff.KeySignature.break-visibility

Thank you both for your help.

David




reply via email to

[Prev in Thread] Current Thread [Next in Thread]