Q:

Horizontal position of grace notes in LilyPond

I am trying to recreate this sort of grace note alignment in lilypond. As it stands, what I have is this:

This is the code I have:

\grace {bes16~ c'~ f'~} <bes c' f' bes'>4\lv

\grace {cis,16~ gis,~ fis~} <cis, gis, fis>4\lv

I have tried to apply \override NoteColumn #'force-hshift to the notes in the grace bracket, and to the grace bracket itself, but this doesn't move it. I also know that I could put all of the notes inside one grace bracket but this wouldn't get me the ties between the different voices in the different staves. Any ideas?

A:

You just need to skip a 3/16 in the upper staff, i. e. change
\grace {bes16~ c'~ f'~} <bes c' f' bes'>4\lv

to
\grace {s8. bes16~ c'~ f'~} <bes c' f' bes'>4\lv

and similarly skip 3/16 in the lower staff like this
\grace {cis,16~ gis,~ fis~ s8.} <cis, gis, fis>4\lv

The reason is that the grace notes take "grace note time", which is effectively zero, but it is used to synchronize grace notes in different voices. (Lilypond sometimes mentions this in some warnings etc., e. g. it can say that an error happened at 3/4+1/8G in bar XY.) By doing this, both grace note constructs take 6/16 of "grace time", and the spacer rests shift the notes accordingly.
Here's a lilybin if you want to see it in action.
If you wanted to recreate that slur over all 6 of the grace notes as well, then it's more interesting and I'm not sure what to do. I would probably "hack it" by making a phrasing slur over the three grace notes in the lower staff and then hacking it with \shape to put the other end into the top staff.

(By the way, what's that piece? It looks like it could be some Villa-Lobos...)

