I'm attempting to write a markup command that, in addition to other
formatting, strips a trailing # or b character off the end of the text
argument and replaces it with the appropriate accidental markup. I think
I'm super-close but stuck on the proper syntax for passing a markup list to
the concat. Here's what I've got so far:
#(define-markup-command (page-header layout props text) (markup?)
"Page header style including optional trailing accidental"
(let* (
(last-char (string-ref text (1- (string-length text))))
(prefix (substring text 0 (1- (string-length text))))
)
(interpret-markup layout props
(markup #:override '(font-name . "Avenir Heavy") #:fontsize 5
(make-concat-markup (cond
((char=? last-char #\#) (list prefix #:hspace 0.2
#:fontsize -2.5 #:raise 0.6 #:sharp))
((char=? last-char #\b) (list prefix #:hspace 0.2
#:fontsize -2.5 #:raise 0.6 #:flat))
(else (list text))
))
)
)
)
)
\markup \page-header "Key of Bb"
This works in the no-accidental case but otherwise generates an error like
this:
fatal error: make-concat-markup: Invalid argument in position 1. Expect:
markup list, found: ("Key of B" #:hspace 0.2 #:fontsize -2.5 #:raise 0.6
#:flat).
Being new to scheme, I've tried various syntactical tweaks which all result
in different error messages. (Also I welcome any advice on alternate
approaches.)
Thanks,
Alec