Box specific bar numbers in Lilypond

Fri 05 November 2010 by Peter Ward

Just a bit of Lilypond / Scheme I wrote last night — if you want to have boxed bar numbers at certain bar numbers (which don't fit every nth bar - see the docs for that), you can use this code to do it:

\override Score.BarNumber #'break-visibility = #end-of-line-invisible
\override Score.BarNumber #'self-alignment-X = #0
\override Score.BarNumber #'font-size = #2
\override Score.BarNumber #'stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
\set Score.barNumberVisibility = #(lambda (x) (not (eq? (member x '(4 9 16 25)) #f)))

This will put boxed numbers at bars 4, 9, 16 and 25.


Comments