Thanks.  That might work as an interim solution.

But there’s got to be a way to access these properties, right?  Or is the \book 
(\bookpart, \score) context just not available?

David F.


> On Apr 26, 2025, at 9:42 AM, Timothy Lanfear <[email protected]> wrote:
> 
> On 24/04/2025 04:29, David F. wrote:
>> Would it be possible to extend the markupWithHeaders function (from LSR 467: 
>> http://lsr.di.unimi.it/LSR/Item?id=467) so that it included headers from the 
>> \book level?  The comments have a TODO to add the \score level headers.  
>> What would it take to add headers from \book and \bookpart and \score?
>> 
> Perhaps a solution is to pass the additional headers into the 
> markupWithHeaders function. Some of the code in LSR467 is copied from the 
> LilyPond source code, which I have replaced with a call to the LP function. 
> Make sure myHeaders is defined before songInfo.
> 
> \version "2.24"
> \language "english"
> 
> %% http://lsr.di.unimi.it/LSR/Item?id=467
> 
> 
> #(define-markup-command (markupWithHeader layout props markup extraheader) 
> (markup? module?)
>     "Interpret the given markup with the header fields added to the props.
>     This way, one can re-use the same functions (using fromproperty
>     #'header:field) in the header block and as top-level markup."
>     (let* (
>             ;; TODO: If we are inside a score, add the score's local header 
> block, too!
>             ;; Currently, I only use the global header block, stored in 
> $defaultheader
>             (scopes (list $defaultheader extraheader))
>             (prefixed-alist (headers-property-alist-chain scopes))
>             (props (append prefixed-alist
>                     props
>                     (layout-extract-page-properties layout))))
>         (interpret-markup layout props markup)))
> 
> \header {} %% \markupWithHeader blows up if no top level \header is defined
> 
> myHeaders = \header {
>     title = "My Title"
>     subtitle = "My Subtitle"
>     subsubtitle = "My Subsubtitle"
>     composer = "The Wiz"
> }
> 
> songInfo = \markup \markupWithHeader
>   \column { \line { "TITLE:" \fromproperty #'header:title } }
>   \myHeaders
> 
> \book {
>     \myHeaders
>     \score {
>         \new Staff \fixed c'' { c1 }
>         \layout {}
>     }
>     \songInfo
> }
> 
> 
> -- 
> Timothy Lanfear, Bristol, UK.

Reply via email to