lilypond-user
[Top][All Lists]
Advanced

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

RE: Problem with conditionals in \layout


From: John Schlomann
Subject: RE: Problem with conditionals in \layout
Date: Sun, 3 Dec 2017 13:09:54 -0600

Thank you, David. I still get an error, though a different one. Is my 
understanding correct that I need to upgrade to 2.19 for this to work?

John

> -----Original Message-----
> From: David Kastrup [mailto:address@hidden
> Sent: Saturday, December 02, 2017 2:55 AM
> To: Carl Sorensen
> Cc: John Schlomann; address@hidden
> Subject: Re: Problem with conditionals in \layout
> 
> Carl Sorensen <address@hidden> writes:
> 
> > From: John Schlomann <address@hidden>
> > Date: Friday, December 1, 2017 at 1:02 PM
> > To: <address@hidden>
> > Subject: Problem with conditionals in layout
> >
> > I’m have a problem including conditionals in a \layout block. The following
> code results in error, “syntax error, unexpected OUTPUT_DEF_IDENTIFIER”.
> >
> > The problem is that you are nesting layout blocks with this code,
> > which is not allowed.
> 
> The problem rather is that the layout blocks are defined by copying
> $defaultlayout at the time he makes his definitions.  It would make more
> sense to define this kind of stuff with define-scheme-function, like
> 
> > According to the Notation Reference 4.2.1 you can have multiple layout
> > blocks as top-level expressions, and they will all apply.  So move
> > your variables \conditional* above the \score{} block:
> >
> >
> > \version "2.18.2"
> >
> >
> >
> > #(define conditionalTimeSignature
> >
> >   (if #t
> >
> >    #{
> >
> >      \layout { \context { \Staff \remove "Time_signature_engraver" } }
> >
> >    #}
> >
> >   )
> >
> > )
> 
> conditionalTimeSignature =
> (define-scheme-function (layout location) ()
>   (if #t
>     #{ \layout \context { \Staff \remove "Time_signature_engraver" } #}))
> 
> Though it probably can be called at top level only in some 2.19 version.  At
> any rate, calling \layout { ... } will derive from the current layout 
> definition, so
> if you use that, you have to store it in some kind of function in order to 
> have
> it executed only at the time of use.
> 
> --
> David Kastrup




reply via email to

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