Hi again,

I have the problem that I (seem to) have to "merge" an unknown number of
\layout {} blocks.

I create several such block independently in different included files
(e.g. one for part generation and one global for the edition project as
a whole). And as everthing is working within one Scheme function and the
actual engraving is done with ly:book-process I can't write the \layout
blocks as top-level expressions.

I thought I'm clever and use the #@ construct to output them as a list
but (of course) this results in *two* layout blocks being present in the
\score block - and consequently the score being printed twice.

I think the attached example is a correct reduction of my actual set-up
to a MWE.

AFAICS I need one out of two solutions:

  * "merging" several \layout {} blocks so there is only one left in the
    \score block
  * somehow apply \layout blocks independently as top-level expressions,
    but from within a Scheme function.

Any ideas?

Best
Urs

\version "2.19.47"

engrave =
#(define-void-function ()()
   (let*
    ; Create two layout definitions, independently from each other
    ((layoutOne
      #{
        \layout {
          \context {
            \Staff {
              \override TimeSignature.color = #blue
            }
          }
        }
      #})
     (layoutTwo
      #{
        \layout {
          \context {
            \Voice {
              \override NoteHead.color = #red
            }
          }
        }
      #})

     (layouts (list layoutOne layoutTwo)))

    (ly:book-process
     #{
       \book {
         \score {
           \new Staff { c' }
%           \layout {}
           #@layouts
         }

       }
     #}
     #{ \paper {} #}  ; non-functional, placeholder
     #{ \layout {} #} ; non-functional, placeholder
     (ly:parser-output-name))))

\engrave

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to