|
From: | Aaron Hill |
Subject: | Re: Concatenating markup fragments in a function |
Date: | Tue, 17 Sep 2019 05:36:52 -0700 |
User-agent: | Roundcube Webmail/1.3.8 |
On 2019-09-17 4:43 am, Andrew Bernard wrote:
Now what I would like to do is modify this to be able to say, in the same vein as the single name function above, for example: <c' e' gis'> ^\markup \note-names-multiple #'(("C" . \natural) ("E" . \natural) ("G" . \sharp))
What you have above is going to be a little problematic as the \natural and \sharp appearing in the list will not be treated as markup. Here's a new strategy:
%%%% \version "2.19.83" #(define-markup-command (note-names layout props note-name accidental) (markup? markup?) "Provide note name for clarity." (interpret-markup layout props #{ \markup { \override #'(font-name . "Latin Modern Sans Demi Cond") \concat { \fontsize #-1 \vcenter #note-name \hspace #.2 \fontsize #-4 #accidental } } #})) #(define-markup-command (note-names-multiple layout props args) (markup-list?) "Provide multiple note names for clarity." (define (paired lst) (if (null? lst) '() (cons (cons (first lst) (second lst)) (paired (cddr lst))))) (interpret-markup layout props #{ \markup \concat { $@(map (lambda (x) #{ \markup \note-names $(car x) $(cdr x) #}) (paired args)) } #} )) { <c' e' gis'>^\markup \note-names-multiple { "C" \natural "E" \natural "G" \sharp }
} %%%%This new markup command expects a markup-list? that contains an even number of items, which are the arguments to your existing \note-names command. It then uses \concat to smoosh together the items.
-- Aaron Hill
[Prev in Thread] | Current Thread | [Next in Thread] |