Jump to content

Measure-centered bar numbers: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
For film scores, a common convention is to center bar numbers within their measure. This is achieved through setting the <code>centerBarNumbers</code> context property to true. When this is used, the type of the bar number grobs is <code>CenteredBarNumber</code> rather than <code>BarNumber</code>.
For film scores, a common convention is to center bar numbers within their measure. This is achieved through setting the <code>centerBarNumbers</code> context property to <code>#t</code>. When this is used, the type of the bar number grobs is <code>CenteredBarNumber</code> rather than <code>BarNumber</code>.


This example demonstrates a number of settings: the centered bar numbers are boxed and placed below the staves.
This example demonstrates a number of settings: the centered bar numbers are boxed and placed below the staves.


<lilypond version="2.24.0">
<lilypond version="2.24">
\layout {
\layout {
   \context {
   \context {
Line 34: Line 34:
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 09:02, 8 December 2025

For film scores, a common convention is to center bar numbers within their measure. This is achieved through setting the centerBarNumbers context property to #t. When this is used, the type of the bar number grobs is CenteredBarNumber rather than BarNumber.

This example demonstrates a number of settings: the centered bar numbers are boxed and placed below the staves.

\version "2.24"

\layout {
  \context {
    \Score
    centerBarNumbers = ##t
    barNumberVisibility = #all-bar-numbers-visible
    \override CenteredBarNumber.stencil
      = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
    \override CenteredBarNumberLineSpanner.direction = #DOWN
  }
}

\new StaffGroup <<
  \new Staff \relative c' {
    d4-. f8( e d4) bes'-> |
    d,-. f8( e d4) cis'-> |
    g-. f8( d e4) g-> |
    a,1-> |
  }
  \new Staff \relative c {
    \clef bass
    d4 f8 e d2~ |
    4 f8 e d2~ |
    4 4 2 |
    a1 |
  }
>>