lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scheme function that conditionally sets several variables in \paper?


From: Thomas Morley
Subject: Re: scheme function that conditionally sets several variables in \paper?
Date: Sun, 16 Nov 2014 17:14:21 +0100

2014-11-16 16:31 GMT+01:00 Paul Morris <address@hidden>:
> Thomas Morley-2 wrote
>> Hi Paul,
>>
>> maybe something at the lines of:
>>
>> my-paper-settings =
>>  #'((system-system-spacing . (padding . 10))
>>     ;(score-system-spacing . (padding . 0))
>>     ;(markup-system-spacing . (padding . 0))
>>     ;(score-markup-spacing . (padding . 0))
>>     ;(markup-markup-spacing . (padding . 0))
>>     (top-system-spacing . (padding . 10))
>>     ;(top-markup-spacing . (padding . 0))
>>     (ragged-last-bottom . #f)
>>     (last-bottom-spacing . (padding . 10))
>>     )
>>
>> foo =
>> #(define-scheme-function (parser location lst)(list?)
>>   (let* ((paper (ly:parser-lookup parser '$defaultpaper)))
>>     (for-each
>>       (lambda (x)
>>         (ly:output-def-set-variable!
>>           paper
>>           (car x)
>>           (if (pair? (cdr x))
>>               (list (cdr x))
>>               (cdr x))))
>>       lst)))
>>
>> \foo \my-paper-settings
>>
>> % 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 { }
>> }
>
> Thanks Harm!
>
> Looks like this will do the trick. I had looked at the various
> ly:output-def... functions, but I was not sure how to get the output
> definition (i.e. paper or layout).  So it's good you know how to do that.
>
> For future reference, how did you figure out how to do this:
>
>   (ly:parser-lookup parser '$defaultpaper)
>
> Did you look at the source code, or somewhere in the documentation, or the
> LSR?  I didn't find anything on these output definitions in the internals
> reference.  It looks like the following will work for layout:
>
>   (ly:parser-lookup parser '$defaultlayout)
>
> Thanks again!
> -Paul

Hi Paul,

I looked in the source:
lily-library.scm
paper.scm

Though, I'm not an expert with this.
For example, have a look at 'paper-variable' from lily-library.scm.
You'll find a local 'get-papers'-variable, seems there is probably
something more to think of.
It's beyond my current depth, though.

Cheers,
  Harm



reply via email to

[Prev in Thread] Current Thread [Next in Thread]