lilypond-user
[Top][All Lists]
Advanced

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

Re: Multiple variables in one scope


From: Samuel Speer
Subject: Re: Multiple variables in one scope
Date: Sat, 12 Jul 2014 16:24:26 -0600

Thank you for that solution! I appreciate the help.
Samuel.

On Sat, Jul 12, 2014 at 10:36 AM, David Kastrup <address@hidden> wrote:
> Samuel Speer <address@hidden> writes:
>
>> I've been trying to create several choral scores using the same
>> template, but sometimes I need to change just a small part of the
>> template, so I end up copying the original and naming it style_two.ily
>> or style_piecename.ily etc. For example, in one piece I need to shrink
>> the PianoStaff and reduce the basic-distance for a 'rehearsal piano'
>> sort of look, and in another I need a full sized PianoStaff for a real
>> keyboard accompaniment.
>>
>> To simplify the process, I've been trying to split up the 'style' into
>> chunks (i.e. margins, paper size, ragged or not, fonts, vertical
>> spacing, etc. in the paper block; lyric tweaks, pianostaff shrinking
>> for rehearsal piano, etc in the layout block), but it seems I can't
>> combine the chunks into one scope.
>
> Correct.
>
>> When I try to compile the snippet below, I get
>>
>> error: syntax error, unexpected OUTPUT_DEF_IDENTIFIER
>>   \choralOctavoMargins
>>
>> %%%%%%%
>> \version "2.18.2"
>>
>> choralOctavoDimensions = \paper { paper-height = 10.5\in }
>> choralOctavoMargins = \paper { top-margin = 0.5\in }
>
> If you take a look at either of those variables afterwards, they are a
> full paper variable with all the settings in $defaultpaper, with only a
> single setting changed compared with the default.
>
> Basically you would need a three-way merge/diff on those variables while
> referencing $defaultpaper for comparison.
>
> You can do something like
> choralOctavoMargins =
> #(define-void-function (parser location) ()
>                        (module-set! (current-module) 'top-margin
>                               (* 0.5 (module-ref (current-module) 'in))))
>
> in order to do an incremental change like that.  But it might possibly
> make sense to put your various settings into separate files and include
> those.
>
> Something like
>
> \include octavodim.ly
> \include octavomarg.ly
>
> with each of the respective files being, indeed, something like
> \paper { paper-height = 10.5\in }
>
> and so on.  In that usage, they redefine $defaultpaper rather than
> deriving a separate paper variable from it.
>
> --
> David Kastrup



-- 
Samuel Speer
address@hidden



reply via email to

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