Am Freitag, den 26.06.2020, 15:01 +0200 schrieb Lukas-Fabian Moser: > Hi Urs, hi Moritz, > > > > thanks for the improvements to my code! (I tend to stop thinking > > > about it as soon as it works for my case, which always leaves > > > lots of > > > room for improvement.) > > > > > Seems to be the opposite of my approach. I'm always starting to > > think > > in terms of reusability and "packages" right away - leading to > > working > > code much later than would be good ;-) > When your default working mode is "I need this worksheet tomorrow by > 9 > o'clock", the approach of using the first sort-of viable solution > becomes much more tempting ;-). > > > > (2) There might also be cases where you have more that one row of > > > arabic > > > numbers to indicate other options. My first intention here would > > > be to have a > > > single layer for every key, that is used in the analysis. If > > > there’s an option > > > to hide the layer where it is not used. > > Each layer is a Lyrics or FiguredBass context, [...] > > That's exactly what occurred to me over lunch: Everything we talked > about concerning spacing just expresses the fact that scale degrees > and > bass figures should behave as if they were independent contexts (one > FiguredBass, one Lyrics). > > So let's scrap the idea of inserting scale degrees artificially into > bass figures where they do not belong!
Well, OK. But then let's take the opportunity to find a way to *encode* things together that belong together. One thing I've been missing for very long is an option (note: this is not a request for changing the default behaviour) to add lyrics or figures to other contexts. In many cases I would want to enter syllables (less likely) or bass figures or analysis symbols to a note instead of having to count skips in a separate context. If it would be possible to inject something in a separate context (similar to \change Staff) it might be interesting in this use case. One thing I'd might test is if the edition-engraver can inject markup in a Lyrics context. If so one could have an empty context that is automatically filled with very short spacer rests which could then serve as anchors for the edition-engrave. This "external" encoding is also somewhat un-intuitive, especially when the content of the music might change. But it could provide nice options for showing/hiding layers or elements. Urs > > Hence: > > \version "2.20.0" > > #(define (scale-degree degree) > (if (eqv? degree 0) > (markup #:null) > (markup #:circle #:small #:number (number->string > degree)))) > > #(define (bass-degree? obj) > "A bass degree is either a number between 1 and 7 or 0 (eqv. to > nothing)!" > (and (integer? obj) (> 8 obj) (< -1 obj))) > > #(define (event-chord? obj) > (and (ly:music? obj) (music-is-of-type? obj 'event-chord))) > > > #(define (figure-signature? obj) > "A figure signature is either an EventChord music or a duration." > (or > (event-chord? obj) > (ly:duration? obj))) > > duration-from-event-chord = > #(define-scheme-function (chord) (event-chord?) > (let ((els (ly:music-property chord 'elements))) > (ly:music-property (first els) 'duration))) > > scaledeg = > #(define-music-function (num signature) ((bass-degree? 0) figure- > signature?) > (let ((dur (if (ly:duration? signature) > signature > (duration-from-event-chord signature)))) > #{ > << > #(if (ly:music? signature) > signature > #{ s $signature #}) > \context Lyrics = "scaleDegrees" \lyricmode > { > \markup { #(scale-degree num) } $dur > } > >> > #})) > > > > << > \new Staff { > \time 3/4 > \clef bass > c4 d e f2 g4 as2^"or g sharp?" a4 b4 c'4 % Morgenlich leuchtend > ... > } > \figures \with { \override > VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = 1 } { > \scaledeg 1 4 > \scaledeg 2 <4 3>4 > \scaledeg 3 <6>4 > \scaledeg 4 <7>4 > \scaledeg 0 <6> > \scaledeg 5 4 > \scaledeg 6 <6>2 > \scaledeg 6 <6>4 > \scaledeg 7 <6 5>4 > \scaledeg 1 4 > } > \new Lyrics = "scaleDegrees" { \skip 1*8 } > >> > > > Of course this is just proof-of-concept: The Lyrics context should > be > created (and kept alive) automatically ... or, even better: it should > be > user-settable with an interface like: > > \figures { > > \inject-scaledegrees-into-context "scaleDegrees" > > ... > > } > > which would enable all sorts of vertical configuration. > > Best > Lukas >