Am Sa., 2. Nov. 2019 um 09:41 Uhr schrieb Malte Meyn <lilyp...@maltemeyn.de>: > > Hi list, > > what am I (or what is LilyPond) doing wrong here? > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > \version "2.19.83" > > bla = { \repeat unfold 100 e'4 } > git = { > \set TabStaff.keepAliveInterfaces = #'() > R1*10 > \repeat unfold 60 c'4 > } > > << > \new Staff \bla > \new Staff \with { \RemoveAllEmptyStaves } \git > \new TabStaff \with { \RemoveAllEmptyStaves } \git > >> > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > A stub for the first TabStaff is printed (clef and short staff lines). If I > • don’t \set TabStaff.keepAliveInterfaces or > • \set Staff.keepAliveInterfaces = #'() too > the TabStaff is hidden as expected. Seems like the \set TabStaff… partly > revives the TabStaff from being hidden. But why does the \set Staff… > have an effect at all? > > Cheers, > Malte >
Hi Malte, you initiate TabStaff last, thus there is no TabStaff at the time \set TabStaff is read (in Staff). So LilyPond creates a TabStaff herself. (1) You could use that autogenerated TabStaff. Though, because then the TabStaff is already there a \with comes too late, so you need to go for score-layout. Makes for: bla = { \repeat unfold 100 e'4 f'1} git = { \set TabStaff.keepAliveInterfaces = #'() R1*10 \repeat unfold 60 c'4 \break \unset TabStaff.keepAliveInterfaces d'1 } \score { << \new Staff \bla \new Staff \with { \RemoveAllEmptyStaves } \git \context TabStaff \git >> \layout { \context { \TabStaff \RemoveAllEmptyStaves } } } Though, fiddling with autogenerated contexts is not really nice... (2) You could initiate the TabStaff before Staff and align it properly. Makes for: bla = { \repeat unfold 100 e'4 f'1} git = { \set TabStaff.keepAliveInterfaces = #'() R1*10 \repeat unfold 60 c'4 \break \unset TabStaff.keepAliveInterfaces d'1 } << \new Staff \bla \new TabStaff = "tab" \with { \RemoveAllEmptyStaves } \git \new Staff \with { alignAboveContext = "tab" \RemoveAllEmptyStaves } \git >> Though, speaking only for me, I don't like this ordering and it feels very much like a workaround. Well, it _is_ a workaround ;) I'd go for: (3) _Limit_ the \set TabStaff to this context. Makes for: %% A simple \set TabStaff applied right at the start of some music will %% probably causesome spurious TabStaff, because the meant TabStaff is %% probably not (fully) initiated at that timestep. %% Thus better make sure the \set is limited to TabStaff %% Lateron it would not be a problem. removeTabStaff = \applyContext #(lambda (ctx) (if (eq? (ly:context-name ctx) 'TabStaff) (ly:context-set-property! ctx 'keepAliveInterfaces '()))) %% Unset keepAliveInterfaces in TabStaff (now the settings from Score apply) unsetRemoveTabStaff = \unset TabStaff.keepAliveInterfaces bla = { \repeat unfold 100 e'4 f'1} git = { \removeTabStaff R1*10 \repeat unfold 60 c'4 \break \unsetRemoveTabStaff d'1 } << \new Staff \bla \new Staff \with { \RemoveAllEmptyStaves } \git \new TabStaff \with { \RemoveAllEmptyStaves }\git >> HTH, Harm