I see but the problem remains. 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?)
                                  #{
                                    \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 } #}

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.
>
> --
> David Kastrup
>

Reply via email to