Hiding staves with rests only (for some/all voices)

If you have a choir score, or an orchestral score, where some voices are quiet for a long time, you might want to hide staves containing nothing (or only multi-measure rests). By default, lilypond will show all staves, even if they only contain rests. To change this into what is sometimes called a "French Score" style, simply add the \RemoveEmptyStaffContext variable, in a \context block, to your \layout.

The first system would still show all staves for all voices. To force this setting to also apply to the first system of a score, set #'remove-first of VerticalAxisGroup to ##t.

If only one staff is displayed, the choir or the StaffGroup bracket would also be hidden, so you will probably need to set #'collapse-height of SystemStartBracket to #1 (or anything smaller than 5).

If you have some voices where you still want to display all (even empty) staves, you need to set the remove-empty property of the VerticalAxisGroup to true for that one staff only. You can do this in the \with section of the staff (in this example, the alto staff will never erase empty lines, while the soprano staff will).