lilypond-devel
[Top][All Lists]
Advanced

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

targeting specific context ID's from within \layout?


From: Mark Polesky
Subject: targeting specific context ID's from within \layout?
Date: Mon, 20 Sep 2010 22:35:16 -0700 (PDT)

% Feel free to compile the whole message...
%
% Is there a way to target a specific context (eg. one of
% several Staff contexts) from within the \layout block?
% Here's one case (of many) where I think this would be
% useful:

\version "2.13.34"

%% music for the individual parts:
violin = { c''1 }
cello = { \clef bass c1 }
pianoRH = { c''1 }
pianoLH = { \clef bass c1 }

%% the full score:
fullScore = <<
  \new Staff = "violin staff" { \violin }
  \new Staff = "cello staff"  { \cello }
  \new PianoStaff = "piano staves" <<
    \new Staff = "piano RH staff" { \pianoRH }
    \new Staff = "piano LH staff" { \pianoLH }
  >>
>>

%% now some layout styles:
smallStaff = \with {
  fontSize = #-3
  \override StaffSymbol #'staff-space = #(magstep -3)
  \override StaffSymbol #'thickness = #(magstep -3)
}

layoutStyleA = \layout {
  \context {
    \Staff
    \smallStaff
  }
}

% Okay, so this is already possible---a score with totally
% separate content and style:

\score {
  \fullScore
  \layout {
    \layoutStyleA
  }
}

% but I'd like to be able to target individual contexts from
% within the \layout block:

%{

layoutStyleB = \layout {
  \context {
    \Staff = "violin staff"
    \smallStaff
  }
  \context {
    \Staff = "cello staff"
    \smallStaff
  }
}

\score {
  \fullScore
  \layout {
    \layoutStyleB
  }
}

%}

% Yes, I know I can use individual \with blocks within my
% fullScore definition that refer to generic variables that
% I can define differently in other files for use with
% \include:

%{

\include "style_a.ily"
%\include "style_b.ily"

<<
  \new Staff = "violin staff"
    \with { \violinStyles } { \violin }
  \new Staff = "cello staff"
    \with { \celloStyles } { \cello }
  % etc...
>>

%}

% But it seems that being able to target contexts by their
% specific ID name would be a lot more flexible (or at least
% easier), especially when a lot of different instruments
% are involved.  This would keep the musical content of the
% \score block cleaner; that is to say, content and style
% would be truly separate, which I think is a good thing.
% Is there a way?
%
% Thanks.
% - Mark


      



reply via email to

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