Great Paul! Thanks for this. I wish I knew Scheme enough to do this myself, but I've not learned it and for someone who doesn't know Scheme, it looks really strange and the learning curve looks steep.
Best, -Arle On 2012 Dec 11, at 22:00 , Paul Morris <p...@paulwmorris.com> wrote: > Hi Arle, > > Below is a revised version that lets you just enter 1 and -1 to indicate your > offsets. It then multiplies that by 1.251178 to get the precise offset > amount. You could enter a slightly larger amount (like 1.1) for whole notes > and adjust to taste. This basically lets you work in units of "one standard > note head width". > > It also uses ly:grob-translate-axis! rather than setting the X-offset > property of the NoteHead grob. This accomplishes the same thing and avoids > potential problems where setting the X-offset for NoteHead grobs in chords > may not work in certain cases. Thanks to Harm/Thomas Morley for this tip.[1] > > Cheers, > -Paul > > [1] http://lists.gnu.org/archive/html/bug-lilypond/2012-12/msg00017.html > > > > %% BEGIN SNIPPET > > #(define ((shift offsets) grob) > (let ((note-heads (ly:grob-array->list (ly:grob-object grob 'note-heads)))) > (for-each > (lambda (p q) (ly:grob-translate-axis! p (* q 1.251178) X)) > note-heads offsets))) > > displaceHeads = > #(define-music-function (parser location offsets) (list?) > #{ > \once \override NoteColumn #'before-line-breaking = #(shift offsets) > #} > ) > > theMusic = { > \displaceHeads #'(0 0 1) > <c' e' g' >4 > > \displaceHeads #'(0 1 1) > <d' f' a'> > > \displaceHeads #'(0 1 1) > <d' f' a'> > > \displaceHeads #'(0 0 1) > < c' e' g'> > > \displaceHeads #'(-1 -1 0) > < c'' e'' g''> > > \displaceHeads #'(-1 -1 0) > < c''' e''' g'''> > > \displaceHeads #'(0 0 1) > < c e g> > > \displaceHeads #'(0 -1 0) > < c'' e'' g''> > > \displaceHeads #'(0 0 -1) > < c'' e'' g''> > } > > \new Staff { > \theMusic > } > > > > On Dec 11, 2012, at 3:15 PM, Arle Lommel <fene...@gmail.com> wrote: > >> Brilliant, Paul. It isn't as easy as I'd hoped, but this works and is really >> minimally difficult for me to use. I used 1.25 and -1.25 as values and it is >> certainly close enough that I can't complain. This helps a *lot*. >> >> Best regards, >> >> Arle >> >> On 2012 Dec 11, at 21:05 , Paul Morris wrote: >> >>> Hi Arle, >>> >>> On Dec 11, 2012, at 2:37 PM, Arle Lommel <fene...@gmail.com> wrote: >>> >>>> I've been looking for how to tweak the direction of noteheads within >>>> chords. I've got a few instances where Lilypond’s default isn't as clear >>>> as when I flip the direction of some of the noteheads. I've searched the >>>> repository and tried various tweaks using direction, but nothing seems to >>>> matter. I'm sure it's easy, but I can't find it. >>>> >>>> As a minimal example, consider this chord: >>>> >>>> <e fis ais cis>4 >>>> >>>> The default is to have the e face left and the other heads face right, but >>>> in the piece I am reproducing the e faces right and the fis faces left. >>>> Doing it this way, as per the old engraver, increases the white space >>>> between the noteheads and increases legibility. >>>> >>>> Any guidance on how to achieve this? If there is an easy way, I would >>>> suggest adding it to the LSR as well, since this is a basic sort of tweak >>>> that others must surely need, but which doesn't seem to be easy to find. >>> >>> I had trouble figuring this out earlier this year and David Nalesnik helped >>> me out with the code below.[1] I have had it on my list to add it to the >>> LSR (while giving proper credit to David N.), as it is something that is >>> not easy to figure out on your own. >>> >>> (I think the fully accurate horizontal offsets should be 1.251178 and >>> -1.251178 rather than 1.3 or -1.3 for regular sized noteheads. They would >>> be a little larger for whole note note heads, but I don't know those values >>> at the moment.) >>> >>> Let me know if you have questions about how it works. >>> >>> HTH, >>> -Paul >>> >>> >>> #(define ((shift offsets) grob) >>> (let ((note-heads (ly:grob-array->list (ly:grob-object grob 'note-heads)))) >>> (for-each >>> (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) >>> #} >>> ) >>> >>> theMusic = { >>> \displaceHeads #'(0 0 1.3) >>> <c' e' g' >4 >>> >>> \displaceHeads #'(0 1.3 1.3) >>> <d' f' a'> >>> >>> \displaceHeads #'(0 1.3 1.3) >>> <d' f' a'> >>> >>> \displaceHeads #'(0 0 1.3) >>> < c' e' g'> >>> >>> \displaceHeads #'(-1.3 -1.3 0) >>> < c'' e'' g''> >>> >>> \displaceHeads #'(-1.3 -1.3 0) >>> < c''' e''' g'''> >>> >>> \displaceHeads #'(0 0 1.3) >>> < c e g> >>> >>> \displaceHeads #'(0 -1.3 0) >>> < c'' e'' g''> >>> >>> \displaceHeads #'(0 0 -1.3) >>> < c'' e'' g''> >>> } >>> >>> \new Staff { >>> \theMusic >>> } >>> >>> [1] http://lists.gnu.org/archive/html/lilypond-user/2012-12/msg00186.html >> > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user