|
From: | Paolo Cantamessa |
Subject: | Re: define and define-markup-command |
Date: | Tue, 22 Jan 2019 22:03:52 +0100 |
Paolo Cantamessa <address@hidden> writes:
> Hello guys,
> I need to undesrtand how work "define" and "define-markup-command".
>
> This work: --------------------------------------------------------
> #(define (testA txt mus y-offset)
> #{\markup \vcenter {
> #txt
> \column {
> \null
> \vspace #1
> \score {
> { $mus }
> \layout {
> indent = 0
> \override Score.Clef.space-alist.time-signature = #'(extra-space
> . 0.5)
> \override Score.TimeSignature.space-alist.first-note =
> #'(extra-space . 0)
> }
> }
> \vspace #(1+ y-offset)
> \null
> }
> \hspace #.5
> } #})
>
> \relative c'' {
> \set Staff.instrumentName = #(testA "Strumento" #{ c''4 #} -.01)
> c4 d e f
> }
Scheme function, used in a Scheme _expression_.
> ------------------------------------------------------------------------
>
> This doesn't work:
> #(define-markup-command (testB props layout txt mus y-offset)(markup?
> ly:music? number?)
> (interpret-markup props layout #{
Ugh ugh ugh. It's "layout props", not "props layout". Likely does not
make a difference in this case since your use is also the wrong way
round, but it is pretty awful.
> \markup \vcenter {
> #txt
> \column {
> \null
> \vspace #1
> \score {
> { $mus }
> \layout {
> indent = 0
> \override Score.Clef.space-alist.time-signature =
> #'(extra-space . 0.5)
> \override Score.TimeSignature.space-alist.first-note =
> #'(extra-space . 0)
> }
> }
> \vspace #(1+ y-offset)
> \null
> }
> \hspace #.5
> } #}))
>
>
> \relative c'' {
> \set Staff.instrumentName = ""%\markup \testB "Strumento" { c''4 } #-.01
> c4 d e f
> }
Problem here is that markup arguments are parsed in markup mode.
Version 21.0 will contain an experimental feature where { c''4 } is
actually being parsed in music mode. The current 2.19.82 (and the
upcoming 2.20) will not contain such a feature. So you'd need to write
##{ c''4 #} instead, making this again a Scheme mode argument.
--
David Kastrup
[Prev in Thread] | Current Thread | [Next in Thread] |