Jump to content

Alternative bar numbering: Difference between revisions

From LilyPond wiki
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series
Tags: Mobile edit Mobile web edit
No edit summary
Line 35: Line 35:
[[Category:Editorial annotations]]
[[Category:Editorial annotations]]
[[Category:Staff notation]]
[[Category:Staff notation]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]][[Category:Snippet]]

Revision as of 22:47, 21 November 2025

Two alternative methods for bar numbering can be set, especially for when using repeated music.

\version "2.24"

music = \relative c' {
  \repeat volta 3 {
    c4 d e f |
    \alternative {
      \volta 1 { c4 d e f | c2 d \break }
      \volta 2 { f4 g a b | f4 g a b | f2 a | \break }
      \volta 3 { c4 d e f | c2 d } } }
  c1 \bar "|."
}

\markup "default"
{
  \music
}

\markup \typewriter "'numbers"
{
  \set Score.alternativeNumberingStyle = #'numbers
  \music
}

\markup \typewriter "'numbers-with-letters"
{
  \set Score.alternativeNumberingStyle = #'numbers-with-letters
  \music
}

\paper { tagline = ##f }