Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Okay ... got the answer to the first comment of mine ... "the rest in the second measure is visible in the bass clef in the original picture ... but you mentioned in the beginning of the answer that it should stay in the treble clef - did you mean the other way around?" ... the answer is that logically - the rest ACTUALLY IS for the treble hand, but for unknown/stylistic reasons - the original author has put it in the bass clef.
Also, in measure four, the original shows just one R1 in the bass clef - does that belong to RH or LH? In the picture that you posted - there are two R2s - one in between the two staves, and one in the bass clef. Logically - what you have posted seems correct, is the fourth measure of the original picture incorrect? Okay - this one is answered by Richard's comment on the question, I think.
thank you! ... one question - the rest in the second measure is visible in the bass clef in the original picture ... but you mentioned in the beginning of the answer that it should stay in the treble clef - did you mean the other way around?
Thank you for the detailed answer - Lot to learn in this post - I see that lilypond uses a form of Scheme. It'd be very helpful if you please add a paragraph commenting and summarizing what the code snippets are doing - for those unfamiliar with lisp-like languages. Also, where should the Beat_Counter_Engraver definition be placed so that it can be used in all my .ly files - this is about extending the standard lilypond scheme libraries, so could be a separate question ...