Paolo Prete <paolopr...@gmail.com> writes: >> On Wed, Sep 4, 2024 at 9:56 PM David Kastrup <d...@gnu.org> wrote: >> >>> Paolo Prete <paolopr...@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. >> > > I see but the problem remains.
That may be because you are not heeding any of my advice. > I would like to found a way to pass a more structured object to that > function, not only a string: > > %%%%%%%%%%%%%%%%%% > \version "2.24.1" > > floating-markup = #(define-scheme-function (parser location x y obj) > (number? number? scheme?) Still scheme? instead of markup? Still a scheme function instead of a markup command. > #{ > \markup \with-dimensions #'(0 . 0) #'(0 > . 0){ > \override #'(baseline-skip . 0) > \translate #(cons x y) > #obj > } > #}) > > > % GOOD > \floating-markup 15 -60 "some string" > > % ERROR > \floating-markup 15 -60 #{ \markup { \circle 1 } #} I made a number of points. Your "I see" only addressed a single one. To wit, you are still putting a Scheme expression instead of a LilyPond expression in a place only admitting LilyPond syntax. The straightforward way of calling this as-is would be \floating-markup 15 -60 \markup \circle #1 If you instead defined it as a markup command as suggested, you could call it _inside_ of markup as, say, \markup { ... \floating #15 #-60 \circle #1 ... } which would be the preferable way. -- David Kastrup