On 1/21/10 1:13 PM, "Pascal Obry" <pas...@obry.net> wrote:

> James,
> 
> Thanks for the quick reply.
> 
>> First of all, hello. Welcome. I encourage everyone to read the Learning
>> Manual once completely through before doing anything.
> 
> I've gone through the manual already. But I've not found an answer to my
> problem.
> 
>> To your question, you've included the fret diagram in the Notes
>> variable. Everything in the Notes variable will be included when it is
>> compiled. Essentially, your score is this:
>> 
>> \score {
>> <<
>>    \new Staff {
>>       d ^ \markup \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;" g b
>>    }
>> 
>>    \new TabStaff {
>>       d ^ \markup \fret-diagram-terse #"x;x;o;2-2;3-3;1-1;" g b
>>    }
>>>> 
>> }
> 
> Agreed. I understand that (I'm computer scientist:).
> 
>> If you look at it like this, you can see that you've duplicated the fret
>> diagram.
>> 
>> The easiest solution is so put your fret diagrams in a different
>> variable, and include that variable only where you want it. i.e.,
>> 
>> Diagrams = { s4 ^ \markup \fret-diagram-terse #"x;x;o;2-2;3-3;1-1 }
>> 
>> \score { <<\new Staff \Notes \new Staff <<\Diagrams \Notes >> >> }
> 
> Right, but the piece I'm writing is large and I just have few fret
> diagrams to include. So it seemed easier to me to insert the fret
> diagrams inside the note flow.
> 
> I was wondering if a macro wont be usable here. I've seen something like
> this generated by tuxguitar:
> 
> <<
> TrackAVoiceAMusic = #(define-music-function (parser location inTab)
> (boolean?)
> #{
>    \tempo 4=120
>    \clef #(if $inTab "tab" "treble_8")
>>> 
> 
> When TrackAVoiceAMusic is inserted into a Staff the clef is set to treble_8:
> 
>    TrackAVoiceAMusic ##f
> 
> and when inside a tab it is set to tab:
> 
>    TrackAVoiceAMusic ##t
> 
> Is something like this usable to insert or not a markup?

Yes, this could be done.

The return value from your music function would be a markup if the context
were a TabStaff, and it would be void music otherwise.

The challenge is to figure out how to get the context type inside the music
function.  I don't know of a Scheme function to do that.  You might be able
to pass the context as an argument to the music function with \applyContext

You can read about Void functions in the 2.13 docs Extending Lilypond
section 2.1.5.

You can read about displaying music as equivalent scheme code using the
displayMusic command in 2.13 docs Extending LilyPond 1.3.1.

You can read about applyContext in 2.13 docs, Extending LilyPond 2.3.

That's where I'd go to try to start to figure this problem out; but somebody
else may have a better suggestion for you.

As an entirely different approach, you might tag the markup with a
TabStaffOnly tag, and then only keep the TabStaffOnly tagged music in the
tab staff.  You can read about tagged music in the Noation Reference 3.3.2
Different editions from one source.

HTH,

Carl





> 
> Thanks,
> Pascal.
> 
> --
> 
> --|------------------------------------------------------
> --| Pascal Obry                           Team-Ada Member
> --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
> --|------------------------------------------------------
> --|    http://www.obry.net  -  http://v2p.fr.eu.org
> --| "The best way to travel is by means of imagination"
> --|
> --| gpg --keyserver keys.gnupg.net --recv-key F949BD3B
> 
> 
> 
> 



_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to