Re: Re: conditional formatting
On Tue 05 Oct 2010, 20:51 Vicente Solsona wrote: > On Mon, 04 Oct 2010 23:11:01 +0200, Marten Visser > wrote: > >Dmytro's suggestion looks more promising, though I haven't been > >able to generate code that does the job so far. When I code Well, i guess that your checks was far to simple for your case; actually you need something like this: - i need staff, lyrics and chords: - then staff is "Staff", lyrics is "Lyrics", chords is "Chords" - i need lyrics and chords: - then staff is "Devnull", those two are the same - etc-etc If you have a "container" (StaffGroup) the task is even more complicated .-) (manual says that "Devnull" can not contain other contexts) Sorry, i've not tested _all_ this; actually, yes, there are other, much more simple ways. Sorry!! :-) > that looks very interesting and can be very useful if you find the way. Well, this may be useful in very rare cases, i think (when i "really-really want" to specify "result" in a command line or like this -- when i, for some other reason, want to deal with _the only_ "master" source file). -- 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. ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Re: conditional formatting
At 20:51 05/10/2010, you wrote: On Mon, 04 Oct 2010 23:11:01 +0200, Marten Visser wrote: Hi Vincente, thanks for the suggestion. However, I do not only want to delete a music expression (which can be tagged), but an entire staff, namely the tabStaff. I wouldn't know how to create code removing a staff by tagging it. you're right. I thought that what you requested could be done with tags because I once did something similar and there were tags involved. but I've looked in my file again and found an alternative and perhaps simpler way which you may find useful: the trick is to use two different \book sections; then Lilypond generates two pdfs in one move, so you don't need to specify any condition at all: %8<-- % % input file tst.ly generates tst.pdf for the piccolist and tst-1.pdf for the guitarist \version "2.12.3" piccolo = \relative c'' { c d e f } guitar = \relative c' { a b c d } staffPiccolo = \new Staff { \piccolo } staffGuitar = \new Staff { \guitar } staffTabGuitar = \new TabStaff { \guitar } \book { % creates tst.pdf for the piccolist << \staffPiccolo \staffGuitar >> } \book { % creates tst-1.pdf for the guitarist << \staffPiccolo \staffGuitar \staffTabGuitar >> } %8<-- I hope I've understood you better this time :) Dmytro's suggestion looks more promising, though I haven't been able to generate code that does the job so far. When I code that looks very interesting and can be very useful if you find the way. greetings, Vicente Thanks for this suggestion. Indeed I do want to generate both scores, so it looks like a perfect solution. :) --Marten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Re: conditional formatting
On Mon, 04 Oct 2010 23:11:01 +0200, Marten Visser wrote: Hi Vincente, thanks for the suggestion. However, I do not only want to delete a music expression (which can be tagged), but an entire staff, namely the tabStaff. I wouldn't know how to create code removing a staff by tagging it. you're right. I thought that what you requested could be done with tags because I once did something similar and there were tags involved. but I've looked in my file again and found an alternative and perhaps simpler way which you may find useful: the trick is to use two different \book sections; then Lilypond generates two pdfs in one move, so you don't need to specify any condition at all: %8<-- % % input file tst.ly generates tst.pdf for the piccolist and tst-1.pdf for the guitarist \version "2.12.3" piccolo = \relative c'' { c d e f } guitar = \relative c' { a b c d } staffPiccolo = \new Staff { \piccolo } staffGuitar = \new Staff { \guitar } staffTabGuitar = \new TabStaff { \guitar } \book { % creates tst.pdf for the piccolist << \staffPiccolo \staffGuitar >> } \book { % creates tst-1.pdf for the guitarist << \staffPiccolo \staffGuitar \staffTabGuitar >> } %8<-- I hope I've understood you better this time :) Dmytro's suggestion looks more promising, though I haven't been able to generate code that does the job so far. When I code that looks very interesting and can be very useful if you find the way. greetings, Vicente ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Re: Re: conditional formatting
At 11:08 05/10/2010, you wrote: On Mon 04 Oct 2010, 23:11 Marten Visser wrote: > Dmytro's suggestion looks more promising, though I haven't been able > to generate code that does the job so far. When I code > > == > \new Devnull > << > \TablatureNotes > >> > == > > I still get an empty tabStaff and two tabstaffs below it for both > voices in the \TablatureNotes. Replacing "Devnull" by "TabStaff", I > get one tabstaff with both voices combined. I guess Devnull is not a > manner to suppress printing the staff. Sorry, i've not tested this much. Which lilypond version do you use? That sample was tested (a bit,-) with 2.13.35, latest development so far. Well.. this works with 2.12 too, ive tried just now. First of all -- i'm not sure that this is the best (or even smart at all) way to do "this" (and i am still not sure that i understood what's needed,-) Anyway, please take a look -- this example produces ChoirStaff with two staves if makeFor equals 'choir and produces single staff with \lowerMelody if makeFor equals anything else. How far this from a required result? %--8<--- makeFor = #'choir #(define myContainer (if (eq? makeFor 'choir) "ChoirStaff" "Devnull")) #(define upperStaff (if (eq? makeFor 'choir) "Staff" "Devnull")) upperMelody = \relative c'' { c4 bes d c } lowerMelody = \relative c'' { a4 g bes a } \score { \new \myContainer << \new \upperStaff << \upperMelody >> \new Staff { \lowerMelody } >> } %--8<--- I'm just interesting .-) Playing with lilypond gives me a lot of fun and some experience, which can be used later, for my own needs. Or, if this is more convenient for you, could you post a small example --- what you've tried and it wasn't work as desired? Thanks. -- Dmytro O. Redchuk Bug Squad Hello again, I compiled your example, but it didn't compile without errors. I did get the results you got, however. I changed your code to obtain what I expected your code to produce: == %{ Example of variable stafftype with scheme funtions %} \version "2.13.32" makeFor = #'piano %makeFor = #'choir %#(define myContainer (if (eq? makeFor 'choir) % "ChoirStaff" % "Devnull")) myContainer = #(if (eq? makeFor 'choir) "ChoirStaff" "PianoStaff") %#(define upperStaff (if (eq? makeFor 'choir) %"Staff" %"Devnull")) upperStaff = #(if (eq? makeFor 'choir) "Staff" "Devnull") upperMelody = \relative c'' { c4 bes d c } lowerMelody = \relative c'' { a4 g bes a } \score { \new \myContainer << \new \upperStaff { \set Staff.instrumentName = \myContainer << \upperMelody >> } \new Staff { \lowerMelody } >> } == By setting the instrumentName to \myContainer I checked what was actually happening. In your example an unrecoverable error occurred. The above example is bug-free in the \version used. I'll try to work this to a code for omitting the tablature staff, and post it here. --Marten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Re: conditional formatting
On Mon 04 Oct 2010, 23:11 Marten Visser wrote: > Dmytro's suggestion looks more promising, though I haven't been able > to generate code that does the job so far. When I code > > == > \new Devnull > << > \TablatureNotes > >> > == > > I still get an empty tabStaff and two tabstaffs below it for both > voices in the \TablatureNotes. Replacing "Devnull" by "TabStaff", I > get one tabstaff with both voices combined. I guess Devnull is not a > manner to suppress printing the staff. Sorry, i've not tested this much. Which lilypond version do you use? That sample was tested (a bit,-) with 2.13.35, latest development so far. Well.. this works with 2.12 too, ive tried just now. First of all -- i'm not sure that this is the best (or even smart at all) way to do "this" (and i am still not sure that i understood what's needed,-) Anyway, please take a look -- this example produces ChoirStaff with two staves if makeFor equals 'choir and produces single staff with \lowerMelody if makeFor equals anything else. How far this from a required result? %--8<--- makeFor = #'choir #(define myContainer (if (eq? makeFor 'choir) "ChoirStaff" "Devnull")) #(define upperStaff (if (eq? makeFor 'choir) "Staff" "Devnull")) upperMelody = \relative c'' { c4 bes d c } lowerMelody = \relative c'' { a4 g bes a } \score { \new \myContainer << \new \upperStaff << \upperMelody >> \new Staff { \lowerMelody } >> } %--8<--- I'm just interesting .-) Playing with lilypond gives me a lot of fun and some experience, which can be used later, for my own needs. Or, if this is more convenient for you, could you post a small example --- what you've tried and it wasn't work as desired? Thanks. -- 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. ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Re: conditional formatting
At 21:22 04/10/2010, you wrote: On Mon, 04 Oct 2010 01:03:30 +0200, Marten Visser wrote: Hello again, 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 think you can do that with tags: http://lilypond.org/doc/v2.12/Documentation/user/lilypond/Different-editions-from-one-source scroll down to "Using tags". greetings, Vicente Hi Vincente, thanks for the suggestion. However, I do not only want to delete a music expression (which can be tagged), but an entire staff, namely the tabStaff. I wouldn't know how to create code removing a staff by tagging it. Dmytro's suggestion looks more promising, though I haven't been able to generate code that does the job so far. When I code == \new Devnull << \TablatureNotes >> == I still get an empty tabStaff and two tabstaffs below it for both voices in the \TablatureNotes. Replacing "Devnull" by "TabStaff", I get one tabstaff with both voices combined. I guess Devnull is not a manner to suppress printing the staff. Thanks anyway, Marten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user