lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Function operating on header


From: Noeck
Subject: Re: Function operating on header
Date: Thu, 12 Mar 2020 19:49:25 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Thanks Francisco! That's great news!

It also works across separate header blocks and even from within
included files. And it is easier to turn it into a string than for the
\fromproperty mechanism. So this works for me:


\header {
  title = "my title"
  composer = "will be replaced"
}

% can also be included via \include
\header {
  composer = \markup { Composer of \italic
    #(string-append "»" (markup->string title) "«") }
    % instead of string-append, I can now work with the string
}
% end of include

{ b }

Cheers,
Joram


Am 12.03.20 um 17:42 schrieb Francisco Vila:
> This shows that header fields behave just like plain markups and can be
> used inside other markups:
>
> \header {
>   title="The title"
>   composer=\markup{Composer of \italic\title }
> }
>   { b }
>
>
> On 7/3/20 18:50, Timothy Lanfear wrote:
>> On 07/03/2020 14:52, Noeck wrote:
>>>> Thank you, Timothy,
>>>>
>>>> this is how far I got already. It is probably a step in the right
>>>> direction. But there are two issues with it:
>>>>
>>>> 1) I would like to use some Scheme code on the fields (with if etc),
>>>>     so I need the 'header:author as a string and #(markup->string …)
>>>>     did not work.
>>>> 2) Can this be put in a command which I can move to a separate file?
>>>>     Like \evaluateHeaders
>>>>
>>>> Cheers,
>>>> Joram
>>
>> Ok, so here is an example of a function to create a bookpart
>> consisting of a single blank page by clearing all the header
>> variables. It should give some clues about how to construct a header
>> in Scheme,
>>
>>
>> \version "2.19.80"
>>
>> % Print a blank page
>> blankpage = #(define-void-function () ()
>>   (let ((bookpart #{ \bookpart { \paper { page-count = 1
>> print-page-number = ##f } \markup \null } #})
>>         (header   (make-module))
>>         (props    '(dedication title subtitle subsubtitle instrument
>>                     poet composer meter arranger opus piece copyright)))
>>     (for-each (lambda (prop) (module-define! header prop #f)) props)
>>     (ly:book-set-header! bookpart header)
>>     (ly:book-add-bookpart! $current-book bookpart)))
>>
>>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]