\version "2.19.82"
%{
To follow up after playing around with this,
there are a few things that might be useful to point out.
I wonder if such an example should be included in the docs?
One is that the grouping symbol is only printed when there is a note/rest on the beat.
For dotted halfs in compound time, for example, only one beat is shown.
This is easy enough to fix by paralleling in some spacers that show all the beats.
But is there a setting that would do this automatically?
The other thing is that they are not printed on the same y axis.
This can be consisted [sic] by moving them to their own staff.
But then, you need to adjust the staff spacing to get them close enough.
%}
#(define triangle->vertical-line-stencil
(lambda (grob)
(let* ((style (ly:grob-property grob 'style))
(thickness (ly:grob-property grob 'thickness))
(staff-line-thick (ly:staff-symbol-line-thickness grob))
(thick (* thickness staff-line-thick))
(height (ly:grob-property grob 'height)))
(if (eq? style 'triangle)
(make-line-stencil
thick ;width
;; 0.5 is my choice, probably catch NoteColumn and take half of
;; its extent
0.5 ;startx
0 ;starty
0.5 ;endx
height ;endy
)
ly:measure-grouping::print))))
global = {
\time 15/8
\set Timing.beatStructure = 3,3,3,3,3
s1*15/8
}
beatPattern = \relative c' {
\override Staff.MeasureGrouping.stencil = #triangle->vertical-line-stencil
s4. s s s s
}
music = \relative c' {
c8 ( e g ) c8 ( e g ) c8 ( e g ) g,2.
}
% This one successfully uses the #triangle->vertical-line-stencil
% But it doesn't show all beats
% And the grouping marks are not on the same vertical line
\score {
<<
\new Staff {
<<
\global
\override Staff.MeasureGrouping.stencil = #triangle->vertical-line-stencil
\music
>>
}
>>
\layout {
\context {
\Staff
\consists "Measure_grouping_engraver"
}
}
}
% Showing all beats by including a spacer subdivision
% Getting consistent vertical alignment by including the grouper on a new rhythmic staff
% But the beat symbols are too far away.
\score {
<<
\new RhythmicStaff {
<<
\global
\beatPattern
>>
}
\new Staff {
<<
\global
\music
>>
}
>>
\layout {
\context {
\RhythmicStaff
\remove "Time_signature_engraver"
\remove "Clef_engraver"
\override BarLine.transparent = ##t
\override StaffSymbol.line-count = #0
\consists "Measure_grouping_engraver"
}
}
}
% Showing all beats by including a spacer subdivision
% Getting consistent vertical alignment by including the grouper on a new rhythmic staff
% And then moving it closer to the music staff by setting staff-staff-spacing.
\score {
<<
\new RhythmicStaff \with {
\override VerticalAxisGroup.staff-staff-spacing.basic-distance = #4
} {
<<
\global
\beatPattern
>>
}
\new Staff {
<<
\global
\music
>>
}
>>
\layout {
\context {
\RhythmicStaff
\remove "Time_signature_engraver"
\remove "Clef_engraver"
\override BarLine.transparent = ##t
\override StaffSymbol.line-count = #0
\consists "Measure_grouping_engraver"
}
}
}
or at least mentioning the behavior about long notes, and vertical alignment.