+\version "2.12.0"
\header {
+ texidoc = "Instrument names are removed when the staves are
+killed off.
- texidoc = "@code{PianoStaff.instrument} and
-@code{PianoStaff.instr} are removed when the staves are killed off.
-
-In this example, the 2nd staff (marked by the barnumber 2) disappears
-as does the instrument name. "
-
+In this example, the second staff (marked by the bar number 2)
+disappears, as does the instrument name."
}
-
-\version "2.12.0"
- \new PianoStaff <<
- \new Staff {
- \override Staff.VerticalAxisGroup #'remove-empty = ##t
- \set PianoStaff.instrumentName ="up"
- \set PianoStaff.shortInstrumentName ="u"
- c'1\break R
- }
- >>
+\new PianoStaff <<
+ \new Staff {
+ \override Staff.VerticalAxisGroup #'remove-empty = ##t
+ \set PianoStaff.instrumentName = #"up"
+ \set PianoStaff.shortInstrumentName = #"u"
+ c'1\break R
+ }
+>>
(if (and (pair? live-elts)
(interval-sane? (ly:grob-extent grob system Y)))
- (let get-extent ((lst live-elts))
- (if (pair? lst)
- (let ((axis-group (car lst)))
-
- (if (and (ly:spanner? axis-group)
- (equal? (ly:spanner-bound axis-group LEFT)
- left-bound))
- (set! extent (add-point extent
- (ly:grob-relative-coordinate
- axis-group system Y))))
- (get-extent (cdr lst))))))
+ (begin
+ (let get-extent ((lst live-elts))
+ (if (pair? lst)
+ (let ((axis-group (car lst)))
+
+ (if (and (ly:spanner? axis-group)
+ (equal? (ly:spanner-bound axis-group LEFT)
+ left-bound))
+ (set! extent (add-point extent
+ (ly:grob-relative-coordinate
+ axis-group system Y))))
+ (get-extent (cdr lst)))))
+ (+
+ (ly:self-alignment-interface::y-aligned-on-self grob)
+ (interval-center extent)))
+ ;; no live axis group(s) for this instrument name -> remove from system
+ (ly:grob-suicide! grob))))
- (+
- (ly:self-alignment-interface::y-aligned-on-self grob)
- (interval-center extent))))