On 2020-04-07 1:55 pm, Paolo Prete wrote:
Look at this example (again: messy code that could be improved, and I
gently ask Harm and/or Aaron to have a check if they can):
For starters, I would seek to eliminate the global variable, instead
preferring state to be tied to the context in some way. Using a custom
context property would enable this approach to support simultaneous
pedal markings on grouped staves. As it is now, such multiple usage
would corrupt the shared global.
Alternately, this alignment work seems like a better job for an engraver
that (semi-)automatically determines which pedal markings need to be
vertically aligned with one another. For instance, the logic could be
based on the duration between the end pedal and start pedal. If too
much time has elapsed, the pedal markings are considered distinct and
are not aligned. In this way, the typical usage pattern of
\sustainOn/Off is unchanged, not requiring any new commands. That said,
I could see value in adding a \pedalAlignBreak of some form, to support
cases where the engraver's logic would group markings that need to be
kept apart.
----
Side note: Your use of \partcombine seems unnecessary when << >> exists:
%%%%
\version "2.20.0"
alfa = { b'4 g'8 a' fis'2 }
bravo = { s4*3\sustainOn s4\sustainOff }
<<
\new Staff { \partcombine \alfa \bravo }
\new Staff { << \alfa \bravo >> }
%%%%
-- Aaron Hill