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?

I’d like the following MWE to print “TITLE: My Title" below the score.

Thanks!

David F.

=======
\version "2.24"
\language "english"

%% http://lsr.di.unimi.it/LSR/Item?id=467

#(define-markup-command (markupWithHeader layout props markup) (markup?)
    "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))
            (alists (map ly:module->alist scopes))
            (prefixed-alist
                (map (lambda (alist)
                        (map (lambda (entry)
                                (cons
                                    (string->symbol (string-append "header:" 
(symbol->string (car entry))))
                                    (cdr entry)))
                            alist))
                    alists))
            (props (append prefixed-alist
                    props
                    (layout-extract-page-properties layout))))
        (interpret-markup layout props markup)))

songInfo = \markup \markupWithHeader \column {
    \line { "TITLE:" \fromproperty #'header:title }
}

\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"
}

\book {
    \myHeaders
    \score {
        \new Staff \fixed c'' { c1 }
        \layout {}
    }
    \songInfo
}

Reply via email to