Jump to content

Printing bar numbers at regular intervals: 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:
By setting the <code>barNumberVisibility</code> property, bar numbers can be printed at regular intervals. Here the bar numbers are printed every two measures except at the end of the line.
By setting the <code>barNumberVisibility</code> property, bar numbers can be printed at regular intervals. Here the bar numbers are printed every two measures except at the end of the line.


<lilypond version="2.24.0" full>
<lilypond version="2.24">
\relative c' {
\relative c' {
   \override Score.BarNumber.break-visibility = #end-of-line-invisible
   \override Score.BarNumber.break-visibility = #end-of-line-invisible
Line 11: Line 11:
   c1 | c | c | c | c
   c1 | c | c | c | c
}
}
\paper { tagline = ##f }
</lilypond>
</lilypond>


[[Category:Rhythms]]
[[Category:Rhythms]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]

Latest revision as of 15:36, 30 November 2025

By setting the barNumberVisibility property, bar numbers can be printed at regular intervals. Here the bar numbers are printed every two measures except at the end of the line.

\version "2.24"

\relative c' {
  \override Score.BarNumber.break-visibility = #end-of-line-invisible
  \set Score.currentBarNumber = 11
  % Print a bar number every second measure
  \set Score.barNumberVisibility = #(every-nth-bar-number-visible 2)
  c1 | c | c | c | c
  \break
  c1 | c | c | c | c
}