lilypond-user
[Top][All Lists]
Advanced

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

Re: Question about Scheme's syntax


From: David Kastrup
Subject: Re: Question about Scheme's syntax
Date: Wed, 04 Sep 2024 21:56:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Paolo Prete <paolopr976@gmail.com> writes:

> Hello,
>
> Given:
>
> floating-markup = #(define-scheme-function (parser location x y obj)
> (number? number? scheme?)
>                                   #{
>                                     \markup \with-dimensions #'(0 . 0) #'(0
> . 0){
>                                       \override #'(baseline-skip . 0)
>                                       \translate #(cons x y)
>                                       #obj
>                                     }
>                                   #})

That makes no sense at all.  Obviously #obj cannot be anything but a
markup here but you declare it as scheme? which just asks for obscure
runtime errors.  Then there is no point in not using a markup command
here in the first place.

>
> I can invoke it with:
>
> \floating-markup 15 -60 "some string"
>
> But how can I pass to the same function the following expression: { \circle
> 5 } as #obj?

{ \circle 5 } is not a LilyPond expression.  It is a fragment of markup.
You can turn it into a LilyPond expression by writing

\markup { \circle 5 }

in which case you'll get out an actual markup.  Outside of markup,
\circle is not defined.

> Something like (pseudo-syntax) :
>
> \floating-markup 15 -60 #{ \circle 5 #}

#{ ... #} is a Scheme construct, not a LilyPond expression.  It is used
for using LilyPond syntax inside of a Scheme expression.

If you want to use it (in Scheme!) for writing in markup syntax, again
you need to enter markup mode by writing

#{ \markup ... #}

in a Scheme expression.  If you are in LilyPond entry mode, you can just
write \markup ... instead.

-- 
David Kastrup



reply via email to

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