Hi Paul,

On Mon, Apr 9, 2012 at 4:47 PM, Nick Payne <nick.pa...@internode.on.net>wrote:

>  On 10/04/12 06:56, Paul Morris wrote:
>
> Thomas Morley wrote:
>
> Am 9. April 2012 03:25 schrieb Paul Morris <p...@paulwmorris.com> 
> <p...@paulwmorris.com>:
>
>  Hello,  Is there a way to manually move some of the notes in a chord to the
> opposite side of the stem, overriding the default placement?
>
> I have looked through the docs and did not find a simple way to do this (the
> NoteColumn #'force-hshift property only works with notes in different
> voices, and trying to \override NoteHead #'X-offset  within a chord just
> returned an error).  The best thing I came up with was this 
> snippet:http://lsr.dsi.unimi.it/LSR/Item?id=505
>
> Following its example I was able to get the results I needed by doing this:
>
>
> shiftR = {
>   \once \override Stem #'X-offset = #.6
>   \once \override NoteHead #'X-offset = #.6
> }
>
> <c' e' g' >4
> << { <c' e'> } \\ { \voiceThree \shiftR g' } >>
>
> <d' f' a'>
> << { d' } \\ { \voiceThree  \shiftR < f' a'> } >>
>
>
> See attached screenshot.  But it seems like there should be a way to do this
> without having to introduce another voice?
>
>  Use a tweak.
>
> Perhaps:
>
> \version "2.14.2"
>
> horOff =
> #(define-music-function (parser location x-off music) (number? ly:music?)
>          (set! (ly:music-property music 'tweaks)
>       (acons 'extra-offset (cons x-off 0)
>          (ly:music-property music 'tweaks)))
>    music)
>
> %shiftR = {
> %  \once \override Stem #'X-offset = #.6
> %  \once \override NoteHead #'X-offset = #.6
> %}
>
> {
> <c' e' \horOff #1.2 g' >4
> %<< { <c' e'> } \\ { \voiceThree \shiftR g' } >>
>
> <d' \horOff #1.2 f' \horOff #1.2 a'>
> %<< { d' } \\ { \voiceThree  \shiftR < f' a'> } >>
> }
>
> HTH,
>   Harm
>
>
> Thank you!  This works, but unfortunately (like the Hydra's heads) it
> introduces two other problems, one with horizontal spacing collisions and
> one with ledger lines.
>
> 1. Because the spacing engine does not take into account this low-level
> tweak, the tweaked notes sometimes collide with bar/measure lines and
> sometimes with other adjacent notes.  Is there a way to use Scheme toalso 
> increase the horizontal space given to the chord?  (I am still a
> beginner at Scheme.)
>
>
> Can't help with the second problem, but for the first you could add
> additional horizontal space to either the barline or stem to increase their
> separation:
>
> \version "2.15.36"
>
> barspace = #(define-music-function (parser location extent) (pair?) #{
>     \once \override Staff.BarLine #'extra-spacing-width = #extent
> #})
>
> stemspace = #(define-music-function (parser location extent) (pair?) #{
>     \once \override Staff.Stem #'X-extent = #extent
> #})
>
> \relative c'' {
>     c2 c c c \barspace #'(0 . 2)
>     c c
>     \stemspace #'(-2 . 0) c c
> }
>
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
This seems to do the trick as far as horizontal spacing is concerned:

\version "2.15.36"

#(define ((shift offsets) grob)
  (let ((note-heads (ly:grob-array->list (ly:grob-object grob
'note-heads))))
    (map
      (lambda (p q) (set! (ly:grob-property p 'X-offset) q))
      note-heads offsets)))

displaceHeads =
#(define-music-function (parser location offsets) (list?)
  #{
    \once \override NoteColumn #'before-line-breaking = #(shift offsets)
  #}
)

{
  \displaceHeads #'(0 1.2 0)
  <c' e' g'>4
  \displaceHeads #'(0 1.2 1.2)
  <d' f' a'>
}

Hope this helps!

-David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to