lilypond-user
[Top][All Lists]
Advanced

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

Re: conditional formatting


From: Dmytro O. Redchuk
Subject: Re: conditional formatting
Date: Mon, 4 Oct 2010 09:37:05 +0300
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon 04 Oct 2010, 01:03 Marten Visser wrote:
> Hello again,
Hi!

> Typesetting my masterpiece :D, I ran into the following problem:
> I have a piece for piccolo and guitar. If I typeset the music for
> guitar, I'd like to have a tablature staff in addition to the notes,
> but If I typset for piccolo, I'd like to omit the tablature. Since
> the music is the same in either case, I prefer to have one file
> where I can make a definition at the very beginning of the document
> like

I am not sure that i understood you, sorry .)

Just take a look, maybe this helps (i've tried this right now, and,
surprisingly enough, this works.-):

%--------------- 8<------------------------
makeFor = #'choir

#(define myStaff (if (eq? makeFor 'piano)
                     "PianoStaff"
                     "ChoirStaff"))

\score {
  \new \myStaff <<
    \new Staff {
      c''
    }
    \new Staff {
      c'
    }
  >>
}
%----------------8<------------------------

This would require more "if" checks in your case, i guess. I it would work for
you at all.

Like this, you may, for example,
  #(define lowerStaff (if (....)  "Devnull" "TabStaff")
and then use it.

Maybe this helps.

ps. Anyway, Lilypond is great, thanks to everyone who makes it even better.

> =======================
> % Outcomment whichever one is inappropriate
> TypesetForInstrument = "Piccolo"
> TypesetForInstrument = "Guitar"
> =======================
> 
> Then, in the score-block, I'd like to typeset the TABStaff based on
> the value of the \TypesetForInstrument variable. I know scheme has a
> conditional 'if', but could somebody please provide me with a
> working example of how to implement the scheme conditional?
> 
> My guess is, the code should look something like:
> 
> =======================
> if (eq TypesetForInstrument #"Piccolo")
> #{ \new TabStaff
>       <<
>               ... (score for tablature)
>       >>
> #}
> #{ % nothing to do if not guitar
> #}
> =======================

-- 
  Dmytro O. Redchuk
  Bug Squad

  Be careful! These are some commonly used abbreviations:
   • LM -- Learning Manual
   • NR -- Notation Reference
   • IR -- Internal Reference

  Look at LilyPond’s documentation to find more.



reply via email to

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