Greetings all, Is there currently a way to get the scheme function below (a minimal example) to do what it's trying to do, namely return a paper block with several parts that are conditionally added or omitted?
I have tried various combinations of # and $ for introducing the scheme expressions, and read about nesting \paper inside of \paper here: http://lilypond.1069038.n5.nabble.com/Conditionally-setting-variables-in-paper-section-td149984.html#a150005 Maybe there's a way to dynamically create the paper block in scheme and return that? I didn't find anything on how to do that (and \displayMusic only works on music), so it seems this is unexplored territory at the frontiers of what's possible, or maybe I'm just missing something. Background: this is for my "scale vertical spacing" code in openlilylib[1] and it would be nice to only change the variables that need changing. It currently works, but by setting the whole group of paper variables, some are just set to the defaults rather than new/scaled values. [1] https://github.com/PaulMorris/openlilylib/blob/vert-scaling-refactor/notation-snippets/scale-vertical-spacing/definitions.ily Thanks, -Paul %% SNIPPET %% \version "2.19.13" myPaperFunction = #(define-scheme-function (parser location arg) (list?) #{ \paper { $(if (assq-ref arg 'system-system) #{ \paper { system-system-spacing = #(assq-ref arg 'system-system) } #}) $(if (assq-ref arg 'score-system) #{ \paper { score-system-spacing = #(assq-ref arg 'score-system) } #}) $(if (assq-ref arg 'markup-system) #{ \paper { markup-system-spacing = #(assq-ref arg 'markup-system) } #}) $(if (assq-ref arg 'score-markup) #{ \paper { score-markup-spacing = #(assq-ref arg 'score-markup) } #}) $(if (assq-ref arg 'markup-markup) #{ \paper { markup-markup-spacing = #(assq-ref arg 'markup-markup) } #}) $(if (assq-ref arg 'top-system) #{ \paper { top-system-spacing = #(assq-ref arg 'top-system) } #}) $(if (assq-ref arg 'top-markup) #{ \paper { top-markup-spacing = #(assq-ref arg 'top-markup) } #}) $(if (assq-ref arg 'last-bottom) #{ \paper { last-bottom-spacing = #(assq-ref arg 'last-bottom) } #}) } #}) \myPaperFunction #'((system-system . 2) (score-system . 1.5) ;; (markup-system . 2) ;; (score-markup . 2) ;; (markup-markup . 2) (top-system . 2) (top-markup . 3) (last-bottom . 2)) % EXAMPLE MUSIC global = { \key c \major \time 4/4 } somenotes = \repeat unfold 48 { c8[ c] } chordNames = \chordmode { \global \repeat unfold 12 { c1:m } } melody = \relative c'' { \global \somenotes } verse = \lyricmode { \repeat unfold 48 { la la } } right = \relative c'' { \global \somenotes } left = \relative c' { \global \somenotes } \score { << << \new ChordNames \chordNames \new Staff { \melody } \addlyrics { \verse } >> \new PianoStaff << \new Staff = "right" { \right } \new Staff = "left" { \clef bass \left } >> >> \layout { } } -- View this message in context: http://lilypond.1069038.n5.nabble.com/scheme-function-that-conditionally-sets-several-variables-in-paper-tp168580.html Sent from the User mailing list archive at Nabble.com. _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
