lilypond-devel
[Top][All Lists]
Advanced

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

Re: Allow music with layout instructions in output definitions. (issue 5


From: David Kastrup
Subject: Re: Allow music with layout instructions in output definitions. (issue 5701049)
Date: Tue, 28 Feb 2012 09:27:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Janek Warchoł <address@hidden> writes:

> On Tue, Feb 28, 2012 at 2:36 AM,  <address@hidden> wrote:
>>> \score {
>>>   \new Staff { b b }
>>>   \layout { \override NoteHead #'color = #red }
>>> }
>>
>> Totally elusive bug that also afflicted \settingsFrom.  Fixed
>
> i confirm that it works for me.  Thanks!
>
>>> I even hoped that something like this will be possible:
>>> \score { <<
>>>     \new Voice { b b }
>>>     \new Voice = "aa" { b b }
>>>   >>
>>>   \layout { \override aa.NoteHead #'color = #red }
>>> }
>>
>> It is nonsense since aa is not the type but the id of a context and
>> can't be meddled with in a layout definition.
>
> ok...
> Out of curiosity, would this be possible to add in a reasonable way or
> is it totally wrong?

Totally wrong.

> From a users' perspective, it would be great to have such overrides in
> \layout, because then i'd have 3 separate and independent areas of my
> file: - music in variables or \include files - style decisions in
> \layout block.  - score structure that doesn't contain any of the
> above and can be freely changed.

You can use context modifications for that.

>> Try \new Voice = "aa" \with { \settingsFrom \override NoteHead #'color
>> #red } { ...
>> instead.
>
> It doesn't work:
>
> \score {
>     \new Voice \with { \settingsFrom \override NoteHead #'color = #red } { b 
> b }
>   }
>
> produces
>
> ../bah.ly:2:37: error: syntax error, unexpected \override
>     \new Voice \with { \settingsFrom
>                                      \override NoteHead #'color = #red } { b 
> b }

Ah yes.  Because \settingsFrom has an optional argument, and so the
music argument must be some delimited form if the optional argument is
left out.  At one point of time, this aggravation will go, but I will
need to boil down the grammar a bit more before I can manage that.

> If i add a pair of curly braces, i.e.
> \score {
>   \new Voice \with { \settingsFrom { \override NoteHead #'color = #red
> } } { b b }
>   }
>
> then it compiles, but the override isn't applied.

Well, I _did_ write "Totally elusive bug that also afflicted
\settingsFrom.  Fixed."

So it is to be expected that you need to update to the very latest git
commit first.

Contextmodifications can be placed in variables, so you can write

aasettings = \with { ... }


and later use

\new Voice = aa \aasettings { ... }

or

\new Voice = aa \with \aasettings { ... }

-- 
David Kastrup



reply via email to

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