# Aligning cross-staff stems when the same pitch is involved with Lilypond

I am engraving a bit for piano, where there is a chord spanning cross staff (played with the left hand). One of the pitches of the chord also appears on the right hand, and that messes up my engraving, where the stems no longer align :

There are two cross-staff stems, the left one (red) is the one I'm unhappy with, and the right one (violet) is an example of what it should look like. The image is the result of the following lilybin; the code is :

``````\version "2.18.0"

rightHand = \relative c'' {
\clef "treble"
<< { g4 f4 f2} \\ \crossStaff {s4 <c f>2 <c f>4} >>
}

leftHand = \relative c {
\clef "bass"
\stemDown {r4 a'2 a4}
}

\score {
\new PianoStaff
<<
\new Staff = "upper" \rightHand
\new Staff = "lower" \leftHand
>>
\layout {
\context {
\PianoStaff
\consists #Span_stem_engraver
}
}
}
``````

Ideally, I want something that looks like :

That is, the chord must be displayed as such and appear after the right hand f4 pitch.

One solution would be to insert `\once \override NoteColumn.force-hshift = -1.5` immediately before that first `<c f>2`:

But as you see, this still comes out looking a bit strange; a sight reader may well get something wrong if they're suddenly confronted with this. You may thus want to tweak some other notes.

Or, depending on the score, I may recommend putting the left hand chords all in the bass clef. You'd have ledger lines, but the notation would be far clearer.

• I agree putting left hand chords in the bass would be correct. Notating them in the right hand really does imply that they should be played in the right hand. It's ambiguous as it is. Extra ledger lines totally fine.
– user70304
Jun 21, 2020 at 0:35
• As for the placement of the left hand chord, you're both probably right (especially seeing as one of you teaches music at university level). Here however, I'm trying to reproduce an historical score, and I'd like to keep the notation as faithful as possible. Also, I'm quite used to it, and I'm the one who's gonna play that score, so I reckon the best notation (for my personal use) is the one I'm the most comfortable with. Jun 22, 2020 at 15:35
• @Richard thanks for your answer. I tried to tweak with the `hshift` for a specific configuration (one that match my historical score); but to no avail. So I edited my question accordingly (to specify said configuration). Jun 22, 2020 at 15:37

This answer gave hints as to how to modify my score, but even with attempted tweaks, I couldn't get what I want from it. So I set out to finding another solution, which is the following :

``````\version "2.18.0"

rightHand = \relative c'' {
\clef "treble"
<< { g4 f4 f2} \\ \crossStaff {s4 <c f>2 <c f>4} >>
}

leftHand = \relative c {
\clef "bass"
\stemDown {r4 <<a'2 \new Voice{\voiceOne \once \hideNotes a4 }>> a4}
}

\score {
\new PianoStaff
<<
\new Staff = "upper" \rightHand
\new Staff = "lower" \leftHand
>>
\layout {
\context {
\PianoStaff
\consists #Span_stem_engraver
}
}
}
``````

The result is as follows :

which is what I was looking for.

Snippet available here on lilybin. The trick is to add an invisible voice.

My problem now, is that I had the idea for that from the lilypond snippet repository, and I have no idea why it works :(

I still posted an answer, because it technically answer my question. But I'd like as well to know why. Someone does ?