Cross-staff chord in score with multiple voices in Lilypond

Assume I need to reproduce the following piano music. Notice the middle "voice" spans both staves. How would I accomplish this using Lilypond?

(I am aware of a hack involving adjusting the stem length, but I would prefer solutions that will not break if the distance between staves were to change.)

How's this?

\version "2.19.45"

global = {
\key c \major
\time 4/4
}

right = \relative c'' {
\global

<<
{
\override NoteColumn.force-hshift = -0.5 <d f>8 q q q %% remove the override to see the difference!
}
\\
{
\crossStaff { \stemUp g,2 }
}
>>
}

left = \relative c' {
\global

<<
{
\crossStaff { b2 }
}
\\
{
<g, d'>4 q
}
>>
}

\score {
\new PianoStaff <<
\new Staff = "right" \right
\new Staff = "left" { \clef bass \left }
>>
\layout {
\context {
\PianoStaff
\consists #Span_stem_engraver
}}
}


This gives precisely:

Basically, you just need to include the Span_stem_engraver context and then provide the cross-staff pitches within \crossStaff brackets.

You'll notice that I inserted \override NoteColumn.force-hshift = -0.5 before the opening <d f> eighth notes in the right hand; without this, the right hand stems conflict:

• Thanks, including the Span_stem_engraver context is critical. That was the missing bit I needed in order to get \crossStaff to work. – Gooseberry Aug 5 '16 at 19:07
• The 2.18.2 release of LilyPond fails to respect the NoteColumn.force-hshift tweak, so stems will still conflict. However, this example works just fine in the given dev version, 2.19.45. – Gooseberry Aug 5 '16 at 19:11