In my (MuseScore) sheets have a lot of custom bar number indicators, like this:
which help me quickly glance over the length of the sections. The bar count can also be above a bar containing notes:
Unfortunately, I'm having a hard time figuring out how to do this in Lilypond. I'm pretty sure this is possible but figuring out how-exactly is a bit of a pain.
When an empty-chord mark is used in a bar with notes, then the markup is displayed above the next note and not in the middle. So, as a workaround I could just use that but this is more of a challenge to understand how to use Lilypond to get what is needed.
Currently I'm trying to achieve this with Text Spanners, as I would like the number in parentheses to be centered above a bar.
All the examples override the text at the left and right edges of a spanner. I've also seen the
span-text in some functions but am not sure how to use them.
I've also seen
\textSpannerUp commands but have no idea how they are to be used.
Edit: The automatic bar numbers are positioned correctly when
\set Score.centerBarNumbers = ##t is used. Meaning it is certainly doable.
The code is here but I don't know Scheme that well. :(