Hi Joe,
Am 28.08.22 um 01:11 schrieb Joseph Srednicki:
I looked at the Lilypond documentation and snippet library but did not
find an answer to the question that I am asking in this message.
I am typesetting my personal performer's edition of Bach's Schmüke
Dich (BWV 654). The first 34 measures are repeated with an alternate
ending. (I am using a two-volta repeat.)
For only the repeated first section, is there a mechanism for
displaying the bar number for volta 1 followed by the bar number for
volta 2 in parentheses?
For example, measure 7 of the volta 1 is measure 41 of volta 2.
In this situation, I would like the bar number to appear as: 7 (41)
I am attaching a PNG image showing what I would like to do.
I am currently displaying bar numbers at the beginning of ever line
except the first.
If this topic is covered in the snippets or Lilypond mail archive and
I missed it, please refer me to the appropriate section.
Thanks for any help that anyone is willing to provide.
This is not very elegant (as it is almost no automatic involved), but it
does what I think you want to achieve:
\version "2.22"
barNumberWithOffset =
#(define-scheme-function (offset) (integer?)
(lambda (barnum measure-pos alt-number context)
(let ((default
(robust-bar-number-function barnum measure-pos alt-number
context)))
(if (zero? offset)
default
(format #f "~a (~a)" default (+ barnum offset))))))
increaseBarNumber =
#(define-music-function (offset) (integer?)
#{
\context Timing {
\applyContext
#(lambda (ctx)
(ly:context-set-property!
ctx
'currentBarNumber
(+ (ly:context-property ctx 'currentBarNumber) offset)))
}
#})
\relative {
\override Score.BarNumber.break-visibility = #end-of-line-invisible %
for diagnostics
\override Score.BarNumber.self-alignment-X = #LEFT % for positioning
\set Score.barNumberFormatter = \barNumberWithOffset 20
\repeat volta 2 {
\repeat unfold 20 {
c'4 d e d
}
}
\increaseBarNumber 20
\set Score.barNumberFormatter = \barNumberWithOffset 0
\repeat unfold 20 {
c'4 d e d
}
}
Lukas