Urs Liska <u...@openlilylib.org> writes:

> Hi,
>
> I have this construct in a function that creates a combined time signature:
>
>    (grob-interpret-markup grob
>      (markup #:override '(baseline-skip . 0) #:number
>        (#:line ((#:column (numOne denOne))
>                 (#:column (numTwo denTwo))))))
>
> It creates two columns from the four given arguments, but I want to be
> able to create an arbitrary number of columns.
>
> I see that #:line gets a list of (#:column ()) entries.
> But I'm lost with the #: part. What does that mean?

That's the markup macro.  It is documented in the Extending Guide.  More
or less.

> And how can I generate such a list with an arbitrary number of
> columns?

You can't actually do it in time since the whole point of a macro is
that it operates on its elements _before_ they are evaluated.

So the Extending Guide says:

Known issues and warnings
.........................

The markup-list argument of commands such as ‘#:line’, ‘#:center’, and
‘#:column’ cannot be a variable or the result of a function call.

     (markup #:line (function-that-returns-markups))

is invalid.  One should use the ‘make-line-markup’,
‘make-center-markup’, or ‘make-column-markup’ functions instead,

     (markup (make-line-markup (function-that-returns-markups)))


So let's fiddle this in another way:

{
  \once\override Staff.TimeSignature.stencil =
  #(lambda (grob)
    (grob-interpret-markup grob
         (markup #:override '(baseline-skip . 0) #:number
	  (make-line-markup
	   (map (lambda (x)
		 (make-column-markup (map number->string x)))
	    '((3 8) (4 8) (5 8)))))))
  \time 4/4 c1
}
Of course, we can just abandon hope regarding the markup macro and do
this as

{
  \once\override Staff.TimeSignature.stencil =
  #(lambda (grob)
    (grob-interpret-markup grob
     #{ \markup \override #'(baseline-skip . 0)
        \number
           #(map (lambda (x) #{ \markup \column #(map number->string x) #})
	   '((3 8) (4 8) (5 8)))
     #}))
  \time 4/4 c1
}
-- 
David Kastrup
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to