lilypond-user
[Top][All Lists]
Advanced

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

Re: conditional formatting


From: Marten Visser
Subject: Re: conditional formatting
Date: Tue, 05 Oct 2010 23:52:06 +0200

At 19:03 05/10/2010, you wrote:
I can't really use Scheme (other than find and replace), so maybe this doesn't solve what you need, but what about creating separate variables with the staves that you want and simply commenting an appropriate \score ? i.e.,
\version "2.12.3"

piccolo = \relative a' { a c' a e' e c a e }

instrument = { a, c' a e' e c' a e'}

instrumentTab = {
  a,4\5 c'\2 a\3 e'\1
  e\4 c'\2 a\3 e'\1
}

withTabs = \new StaffGroup <<
   \new Staff \instrument
   \new TabStaff \with { instrumentName = lute } \instrumentTab
>>

withoutTabs = \new StaffGroup <<
   \new Staff \with { instrumentName = piccolo } \piccolo
   \new Staff \with { instrumentName = lute } \instrument
>>

%\score { \withTabs }
\score { \withoutTabs }

Hi, thanks for thinking with me. This indeed is a solution. The preceding discussion focusses on the use of Devnull as a solution, but indeed you may define two different contents for the \score block.

Scheming along, the example in the previous posts may be changed as below. Select the apropriate makeFor to obtain the desired output. When guitar is selected, a tabstaff will be displayed in addition.

Problem solved, thanks frogs!
(apart from what seems to be a bug when you put tablature into a Devnull)

--Marten

=======================
%{
Example of optional TabStaff with scheme functions and variable \score block
%}

\version "2.13.32"

makeFor = #'choir
makeFor = #'piano
%makeFor = #'guitar

myContainer =
        #(if (eq? makeFor 'choir)       "ChoirStaff" "PianoStaff")


upperMelody = \relative c'' {
  c4 bes d c
}

lowerMelody = \relative c' {
  a4 g bes a
}

Tablature = \simultaneous { % Combine both voices for Tablature
        \override TabStaff.Stem #'transparent = ##t % Makes stems transparent
        \override TabStaff.Beam #'transparent = ##t % Makes beams transparent
        << \context TabVoice=TabVoiceA { \upperMelody} >>
        << \context TabVoice=TabVoiceB { \lowerMelody} >>
        }

OptionalTabStaff =
        #(if (eq? makeFor 'guitar)
        #{ \new TabStaff << \Tablature >> #}
        #{ #})


\score {
  <<
        \new \myContainer <<
        \new Staff
        {
                \set Staff.instrumentName = #(symbol->string makeFor)
                <<
            \upperMelody
                >>
                }
          \new Staff {
          \lowerMelody
            }
        >>
                \OptionalTabStaff
        >>
}
=======================





reply via email to

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