lilypond-user
[Top][All Lists]
Advanced

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

Re: Re-using "\with" contexts


From: David Kastrup
Subject: Re: Re-using "\with" contexts
Date: Fri, 15 Jul 2022 17:21:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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



reply via email to

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