lilypond-user
[Top][All Lists]
Advanced

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

Re: Re-using "\with" contexts


From: Alasdair McAndrew
Subject: Re: Re-using "\with" contexts
Date: Sat, 16 Jul 2022 15:23:47 +1000

Dear Lukas, Pierre, David,

Thank you all for your expert advice and examples.  It is indeed quite straightforward - when you know how!  I'll now be able to finish off my current piece, and start on the next one...

cheers,
Alasdair

On Sat, Jul 16, 2022 at 1:21 AM David Kastrup <dak@gnu.org> wrote:
Alasdair McAndrew <amca01@gmail.com> writes:

> Hello,
>
> There are examples of changing a staff context in the manual, for example at
>
> https://lilypond.org/doc/v2.21/Documentation/snippets/pitches#pitches-creating-custom-key-signatures
>
> Here a new staff is instantiated; with about 10 lines of "\with"  to change
> its appearance and behaviour.
>
> However, if I wish to use several such staves, I don't want to be copying
> the "\with" material into each one.  Is it possible to create a new context
> just from such a definition?  What I mean is something like
>
> myStaff = staff \with {
>     < lots of lines of definition >
> }
>
> so that I can simply create a new staff the way I want it with, for example
>
> \new myStaff {
>
> }
>
> All I want is an example.  There is some information about defining a new
> context, but in my case all I want is a tweaked version of a current
> context.

\layout {
  \context {
    \Staff
    \name "myStaff"
    < lots of lines of definition >
  }
  \inherit-acceptability myStaff Staff
}

--
David Kastrup


--
Alasdair McAndrew (he/him)
mob: 0432 854 858

https://numbersandshapes.net

reply via email to

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