lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating new context: 3 Questions


From: Paul Morris
Subject: Re: Creating new context: 3 Questions
Date: Wed, 25 Mar 2015 07:47:43 -0700 (MST)

Hi Robert,


Robert Schmaus wrote
> My second question is: In the manual, there's the \consists command.
> Afaics, there is no \remove command. It was my impression that the \alias
> command specifies a "frame of reference" to which content can be added and
> (??) removed. So that I could simply choose the best context for what I
> want and customize that.
> Am I right in that or are new contexts always empty per se, and I can only
> *add* things?

So \alias doesn't do what you think it does.  All that \alias does is allow
commands that work in one context to work in another context.  It would be
clearer if it were named something like "\accept-commands-like" instead of
"\alias".  It doesn't affect the content of your new context or whether your
new context is accepted within other contexts.

The example in the manual doesn't show what you're trying to do, which is to
create a clone or copy of an existing context and modify it.  So see this
snippet which gives an example of copying and modifying the staff context:
http://lsr.di.unimi.it/LSR/Item?id=882

You'll see that the context block includes \Staff:

\layout {
  \context {
    \Staff
    % give the custom staff a name of your choice
    \name MyCustomStaff
    % tell LilyPond that commands that work on a standard
    % Staff context should also work with this custom context
    \alias Staff
    ...

Including \Staff here is what "copies" the contents and settings of the
staff context into the new context.  (The snippet could be more explicit
about this with a comment explaining that.)  This also means that there's no
need for \type "Engraver_group" since that is taken care of by \Staff.  

See below, which should get you going.  Note that you also had some typos
that were causing problems ("RhytmicLine").  I'm not sure why \remove is not
working as one would expect...

Cheers,
-Paul


%%%%%%%%%%%%%%%%%%%%%%%

\version "2.18.2"

\score{
  <<
    \new RhythmicLine {  c4. r8 c4. r8 }
    \new Staff \new Voice { c4 d e f }
  >>
}

scale = #-3

\layout {
  \context {
    \RhythmicStaff
    \name RhythmicLine
    \alias RhythmicStaff
    % \type "Engraver_group"
    
    \override TupletNumber.font-size = \scale
    \override Stem.font-size = \scale
    \override Flag.font-size = \scale
    \override NoteHead.font-size = \scale
    \override Rest.font-size = \scale

    \override NoteHead.style = #'slash
    \consists Pitch_squash_engraver
    squashedPosition = #0

    \stemUp
    \override VerticalAxisGroup.staff-staff-spacing =
    #'((basic-distance . 0) (minimum-distance . 2) (padding . 1))

    \remove Clef_engraver
    \remove Staff_symbol_engraver
    \remove Time_signature_engraver
    \remove Accidental_engraver

    %{
    \consists "Pitch_squash_engraver"
    squashedPosition = #0

    \consists "Rhythmic_column_engraver"
    \consists "Note_heads_engraver"
    \override NoteHead.style = #'slash
    \consists "Stem_engraver"
    \consists "Beam_engraver"

    \hide BarLine
    %}
  }
  \context { \Staff \accepts "RhythmicLine" }
}




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Creating-new-context-3-Questions-tp173645p173652.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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