lilypond-user
[Top][All Lists]
Advanced

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

Re: define and define-markup-command


From: David Kastrup
Subject: Re: define and define-markup-command
Date: Tue, 22 Jan 2019 20:40:27 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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



reply via email to

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