Moving a Clef bellow notes in other Staff to save horizontal space?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Moving a Clef bellow notes in other Staff to save horizontal space?

Stefano Troncaro
Hello everyone! I've been searching but have been unable to figure out a solution to this one.

Given the attached image obtained by running the following snippet:
\version "2.19.83"
\language "english"

toL = { \change Staff = "LH" }
toR = { \change Staff = "RH" }

\new PianoStaff <<
  \new Staff = "RH" \relative {
    \time 2/4
    r4 \toL c'16 \toR e' d e |
    R2
  }
  \new Staff = "LH" \relative {
    r4 s |
    \clef F <g c,>4 r
  }
>>

\new PianoStaff <<
  \new Staff = "RH" \relative {
    \time 2/4
    r4 \toL c'16 \toR e' d e |
    R2
  }
  \new Staff = "LH" \relative {
    r4 s |
    <g' c,>4 r
  }
>>

As you can see in the first example the clef is increasing the distance between the last note of the measure and the barline. How can one move the clef to the left, a little bellow the notes in the upper staff, so that the measure takes the same amount of horizontal space as the second example?

Thank you in advance for you help,
Stéfano

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user

clef taking space.png (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Moving a Clef bellow notes in other Staff to save horizontal space?

Kieren MacMillan
Hi Stefano,

> I've been searching but have been unable to figure out a solution to this one.

How about something like:

    \once \override Staff.Clef.X-extent = #empty-interval
        \once \override Staff.Clef.X-offset = #-2.5
        \clef F <g c,>4 r

I tried \tweak versions, but couldn’t solve it that way, and couldn’t spend more time working on it.

Hope this helps!
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Moving a Clef bellow notes in other Staff to save horizontal space?

Stefano Troncaro
Hi Kieren, that's great! It works wonderfully.

I experimented a bit with your idea, the same result can be achieved with just \once \override Staff.Clef.X-extent = #'(.7 . 2.2)
It looks like by changing the first number of the pair one can be very precise about how much the Clef goes bellow the notes, while the other determines the distance between the Clef and the BarLine. Since X-extent is a pair it can't be offset, so I quickly made the following function to be able to offset it without having to give a number for the second value:

\version "2.19.83"
\language "english"

toL = { \change Staff = "LH" }
toR = { \change Staff = "RH" }

blb-offsetClefXExtentCar =
#(define-scheme-function (v) (number?)
   (lambda (grob)
     (let ((x-ext (ly:grob-property grob 'X-extent #f)))
       (ly:grob-set-property! grob 'X-extent (cons
                                              (+ (car x-ext) v)
                                              (cdr x-ext))))))

\new PianoStaff <<
  \new Staff = "RH" \relative {
    \time 2/4
    r4 \toL c'16 \toR e' d e |
    R2
  }
  \new Staff = "LH" \relative {
    r4 s |
    \once \override Staff.Clef.before-line-breaking = \blb-offsetClefXExtentCar 0.7
    \clef F <g c,>4 r
  }
>>

Thank you for your help!


El mié., 8 may. 2019 a las 21:26, Kieren MacMillan (<[hidden email]>) escribió:
Hi Stefano,

> I've been searching but have been unable to figure out a solution to this one.

How about something like:

    \once \override Staff.Clef.X-extent = #empty-interval
        \once \override Staff.Clef.X-offset = #-2.5
        \clef F <g c,>4 r

I tried \tweak versions, but couldn’t solve it that way, and couldn’t spend more time working on it.

Hope this helps!
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Moving a Clef bellow notes in other Staff to save horizontal space?

David Kastrup
Stefano Troncaro <[hidden email]> writes:

> Hi Kieren, that's great! It works wonderfully.
>
> I experimented a bit with your idea, the same result can be achieved with
> just \once \override Staff.Clef.X-extent = #'(.7 . 2.2)
> It looks like by changing the first number of the pair one can be very
> precise about how much the Clef goes bellow the notes, while the other
> determines the distance between the Clef and the BarLine. Since X-extent is
> a pair it can't be offset,

Come again?

    File: lilypond-notation.info,  Node: The offset command,  Next: Modifying alists,  Prev: set versus override,  Up: Modifying properties

    5.3.6 The ‘\offset’ command
    ---------------------------

    While it is possible to set grob properties to new values with the
    ‘\override’, ‘\tweak’, and ‘\overrideProperty’ commands, it is often
    more convenient to modify such properties relative to a default value.
    The ‘\offset’ command is available for this purpose.

       The syntax for ‘\offset’ is

         [-]\offset PROPERTY OFFSETS ITEM

[...]

    Properties which may be offset
    ..............................

[...]

       The following criteria determine whether a property can be modified
    with ‘\offset’:

[...]

       • The property takes a numerical value.  Numerical values include
         ‘number’, list of ‘number’s, ‘number-pair’, and ‘number-pair-list’.
         The pages at *note (lilypond-internals)All layout objects:: list
         the type of data characteristic to each property.  It is immaterial
         whether the default setting is a function.


--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Moving a Clef bellow notes in other Staff to save horizontal space?

Stefano Troncaro
Lol, that's what I get for dealing with this stuff before going to sleep. I realized of my mistake after turning off the computer and laughed at the situation. I never doubted that someone would point out my stupidity.

El jue., 9 may. 2019 a las 2:52, David Kastrup (<[hidden email]>) escribió:
Stefano Troncaro <[hidden email]> writes:

> Hi Kieren, that's great! It works wonderfully.
>
> I experimented a bit with your idea, the same result can be achieved with
> just \once \override Staff.Clef.X-extent = #'(.7 . 2.2)
> It looks like by changing the first number of the pair one can be very
> precise about how much the Clef goes bellow the notes, while the other
> determines the distance between the Clef and the BarLine. Since X-extent is
> a pair it can't be offset,

Come again?

    File: lilypond-notation.info,  Node: The offset command,  Next: Modifying alists,  Prev: set versus override,  Up: Modifying properties

    5.3.6 The ‘\offset’ command
    ---------------------------

    While it is possible to set grob properties to new values with the
    ‘\override’, ‘\tweak’, and ‘\overrideProperty’ commands, it is often
    more convenient to modify such properties relative to a default value.
    The ‘\offset’ command is available for this purpose.

       The syntax for ‘\offset’ is

         [-]\offset PROPERTY OFFSETS ITEM

[...]

    Properties which may be offset
    ..............................

[...]

       The following criteria determine whether a property can be modified
    with ‘\offset’:

[...]

       • The property takes a numerical value.  Numerical values include
         ‘number’, list of ‘number’s, ‘number-pair’, and ‘number-pair-list’.
         The pages at *note (lilypond-internals)All layout objects:: list
         the type of data characteristic to each property.  It is immaterial
         whether the default setting is a function.


--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user