[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Adding to header using module-define! and alist with markups
From: |
Nate Whetsell |
Subject: |
Adding to header using module-define! and alist with markups |
Date: |
Thu, 2 Dec 2021 06:10:16 -0500 |
I’m trying to programmatically add items to score headers from an alist. This
works when an item consists of just a string. I can’t seem to get this to work
when an item is a markup, no matter how the markup is entered. Is there some
way to store markups in an alist, and then use those markups in a header?
Below is an example illustrating the issue I’m having. Any help would be
greatly appreciated!
Thanks,
Nate
```
\version "2.22.0"
\paper {
scoreTitleMarkup = \markup {
\column {
\fromproperty #'header:piece
\justify-field #'header:instruction
}
}
}
#(define instructions '(
; Using a LilyPond code block does not work.
(1 . #{
\markup {
"Does not work"
\score {
\new Staff { c'1 }
\layout { ragged-right = ##t indent = 0 }
}
}
#})
; Using the Scheme form of a markup expression does not work.
(2 . (markup #:line (#:simple "Does not work")))
; Using a string works.
(3 . "Works")))
\book {
#(do ((study-number 1 (1+ study-number)))
((> study-number 3))
(let ((header (make-module)))
(module-define! header 'piece (number->string study-number))
(let* (
(instruction (assoc study-number instructions))
(score (scorify-music #{ { c'1 } #})))
(begin
(if instruction (module-define! header 'instruction (cdr
instruction)))
(ly:score-set-header! score header)
(add-score score)))))
}
```
- Adding to header using module-define! and alist with markups,
Nate Whetsell <=