Patrick Martin wrote:
For example, in this picture, 22 follows directly on from the end of 21,
and 23 from 22, etc. Or would this need to be implemented some other way?
Are you a Tetris fan?
Pseudoindent could help with the horizontal aspect.
https://lsr.di.unimi.it/LSR/Item?id=1098
You would choose an initial left-indent and a final right-indent for
each piece, and apply these manually.
Then get the appropriate vertical neighbours to overlap, without
involving enclosing StaffGroups and such. I have no concrete
suggestions for that, but Aaron demonstrated \markup \overlay for a
similar case here:
https://lists.gnu.org/archive/html/lilypond-user/2021-08/msg00115.html
Cheers,
Robin