lilypond-user
[Top][All Lists]
Advanced

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

Fwd: How to use ^markup in a scheme function?


From: Frédéric Chiasson
Subject: Fwd: How to use ^markup in a scheme function?
Date: Fri, 15 Dec 2006 15:52:19 -0500



---------- Forwarded message ----------
From: Mats Bengtsson <address@hidden>
Date: 15 déc. 2006 15:31
Subject: Re: How to use ^markup in a scheme function?
To: Frédéric Chiasson <address@hidden>


I'm certainly not any expert in Scheme coding for LilyPond. Please
always keep the discussion on the mailing list, for the
benefit of yourself since you get access to the collected
expertise on the list and for the benefit of others who experience
similar problems.

   /Mats


Quoting Frédéric Chiasson <address@hidden>:

> Thanks, at last I understood how to do it?
>
> One problem left, I copied the code displayed for "\once \override
> TextScript #'extra-offset = #$xy" to put it in the code of the Slash
> function. The code is compiled without errors, but there is no offset
> produced. Why? Do I use the right prefixes for xy?
>
> Also it is possible to use both LilyPond and Scheme code like this?
> (define-music-function (variables)
> #{
>    LilyPond code
> #}
> (Scheme code))
>
> Thanks for all the help,
>
> Fred
>
> P.S. The code for the function :
>
> Slash = #(define-music-function (parser location xy note)
>            (pair? ly:music?)
>            "Return a note with a slash at offset (x . y)"
>            (make-music 'ContextSpeccedMusic 'context-type 'Bottom 'element
>                  (make-music 'OverrideProperty 'pop-first #t
>                'grob-property-path (list (quote extra-offset))
>                'grob-value
> 'xy
>            'once #t 'symbol 'TextScript))
>            (let ((new-note (ly:music-deep-copy note)))
>                (set! (ly:music-property new-note 'elements)
>                      (cons (make-music 'TextScriptEvent
>                              'direction 1 'text
>                                    (markup #:line
>                                    (#:musicglyph " flags.ugrace")))
>                              (ly:music-property new-note 'elements)))
>                new-note))
>
>
>
> \version "2.11.1"
>
> \relative {
> \Slash #'(1.2 . -3.2) c4
> }
>
>
> 2006/12/15, Mats Bengtsson <address@hidden>:
>>
>> The reason is exactly the same as the reason that you cannot do
>> mynote = c
>> \score{{\mynote ^"text" }}
>> See the section on "Adding articulation to notes (example)" for more
>> information on how to solve the problem.
>>
>>    /Mats
>>
>> Frédéric Chiasson wrote:
>> > Hi,
>> >
>> > I tried to program a function to put a slash at a given offset on a
>> > note, but the line with the ^\markup doesn't work.
>> >
>> > Here is the code :
>> >
>> > Slash = #(define-music-function (parser location xy note)
>> >             (pair? ly:music?)
>> >             #{
>> >                 \once \override TextScript #'extra-offset = #$xy
>> >                 $note ^\markup{\musicglyph #"flags.ugrace"}
>> >             #})
>> >
>> >
>> > \version " 2.11.1"
>> >
>> > \relative {
>> >  \Slash #'(1.1 . -3.2) c4
>> > }
>> >
>> >
>> > Here are the errors :
>> >
>> > <string>:3:45: ERREUR : syntax error, unexpected '^'
>> >                 \lilyvartmpd
>> >                                              ^\markup{\musicglyph #"
>> > flags.ugrace"}
>> > <string>:3:54: ERREUR : cha^ine d''echappement inconnue (Unknown
>> > escape string): << \musicglyph >>
>> >                 \lilyvartmpd ^\markup{
>> >                                                       \musicglyph #"
>> > flags.ugrace"}
>> >
>> > Thanks,
>> >
>> > Frédéric
>> >
>> > ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > lilypond-user mailing list
>> > address@hidden
>> > http://lists.gnu.org/mailman/listinfo/lilypond-user
>> >
>>
>> --
>> =============================================
>>         Mats Bengtsson
>>         Signal Processing
>>         Signals, Sensors and Systems
>>         Royal Institute of Technology
>>         SE-100 44  STOCKHOLM
>>         Sweden
>>         Phone: (+46) 8 790 8463
>>         Fax:   (+46) 8 790 7260
>>         Email: address@hidden
>>         WWW: http://www.s3.kth.se/~mabe
>> =============================================
>>
>>
>




reply via email to

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