# In LilyPond (piano staff) how can I type two eighth notes for different hands?

In LilyPond, while writing a piano staff, how can I type two eighth notes, so that one is played with the left and the other with the right hand?

Example. I want to produce this highlighted separation:

In order not to complicate the example by adding additional spacing until LilyPond prefers to pick a kneed beam on its own, I am using a voicing change to get this, moving from "first voice" settings in the lower staff to "fourth voice" setting in the higher. Usually \voiceOne/\voiceTwo (can be implied by << ... \\ ... >>) should be used for the outermost voices in a staff, but since the voice from the staff below is likely only an occasional visitor, I am giving it the \voiceFour treatment. If the resulting arrangement is not satisfactory, one might temporarily adjust the lower voice of the upper staff to \voiceFour instead and return it afterwards (except that in this minimal example there is no separate history afterwards) to \voiceTwo.

global = { \key e \minor \time 2/4 }
{
<<
\new Staff = "high"
{ \global
\new Voice {
<< { e''8 b' } \\ <e' b'>4 >>
r4
}
}
\new Staff = "low" \with { \clef bass }
{ \global
\new Voice { \voiceOne g8
\change Staff = "high" \voiceFour
b
\change Staff = "low" \oneVoice
r4
}
}
>>
}

You use multiple voices. Here is a small example which semi-manually puts beams in the second of two voices in a << {first voice} \\ {second voice} >> construct as the autobeamer does not work across skips or rests.

\relative
{
\key e\major
\time 3/4
<<
\repeat unfold 24 { s16 e'' } \\
<<
\repeat unfold 2
{ gis s e s dis s e s fis s e s e s gis s fis s gis s a s fis s }
\repeat unfold 12 { s[ s s s] }
>>
>>
}

• Thanks for your help (+1). I actually was thinking of writing it in two separated staffs (piano, with bass + treble keys). I edited the question adding the required form. – c.p. Apr 20 '15 at 5:52