lilypond

How to place a rest between to notes in different voices


I have this basic three-voices snippet.

\score {
<<
    \new Staff {
        \key a \major \time 3/8
        \clef "G_8" 
        {
            <<
            { e'4 r16 cis'' }
            \\
            { a,4. }
            \\
            { r8 <a cis'> <a cis'> }
            >>
        }
    }
>>
}

The problem that i encounter is that the rest of the third voice (at the 13th line), is rendered on top of all the other notes, which makes unclear what voice it should be part of.

screenshot of the result with the rest on top

What I want to achieve is to get the rest to render between the two notes at the beginning (the A and the E), and I couldn't manage to do it with any of the \stemUp, \stemDown and \stemNeutral commands.


Solution

  • An approach you can take is to use the command \rest, which allows you to specify a 'note position' for the rest. E.g., if you type a'4\rest, you will create a quarter-note rest at the staff position of an A4. In your case, I think a g8\rest works well. I believe this solution is a bit more solid than using offset tweaks, since those are relative to where your rest is and changing the music can change the rest position, while the command \rest creates an absolute position.

    \score {
    <<
        \new Staff {
            \key a \major \time 3/8
            \clef "G_8" 
            {
                <<
                { e'4 r16 cis'' }
                \\
                { a,4. }
                \\
                { g8\rest <a cis'> <a cis'> }
                >>
            }
        }
    >>
    }