lilypond-user
[Top][All Lists]
Advanced

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

Re: Getting a function to accept a string or a markup


From: Lukas-Fabian Moser
Subject: Re: Getting a function to accept a string or a markup
Date: Sat, 11 May 2024 18:39:23 +0200
User-agent: Mozilla Thunderbird

Hi Vaughan,

Am 10.05.24 um 07:44 schrieb Vaughan McAlley:
Hi,

I have a text spanner function that shows a player that they are
playing in simultaneous rhythm with one or more other players. I
adapted it from code I used for indicating colouration in renaissance
music. It works fine, but if it begins on the last note of a line, and
the attached string is long, it can extend right to the edge of the
page (see picture attached).

What would be good is to be able to say

\sim \markup \left-column { "Vln 1," "Vln 2" }

if needed. Otherwise I could have it require a markup and get it to
concatenate within the function, but my Scheme skills are not up to
this...

Strings _are_ markups! So basically, it suffices to change the function
signature to:

#(define-music-function (annotation) (markup?)

This function still accepts strings! But when you call it with an actual
non-string markup, it fails because of

(string-append mySimBeginning annotation)

since such a markup can't be handled by string functions like
string-append. So simply replace this by the corresponding scheme macro
to concatenate markups:

#:concat (mySimBeginning annotation)

Lukas




reply via email to

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