Re: Function operating on header
On 2020-03-12 11:49 am, Noeck wrote: 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 } It may be your intention, but markup->string strips out formatting. For markup that is just simple text, you would not notice any loss. But it is best to keep markup as markup in order to preserve formatting. You never know when your simple text today needs to become more complex later. Next, why use strings and string-append at all? \markup already supports the ability to concatenate multiple arguments into one. A simple markup list (i.e. #{ \markup { one two three } #}) joins items using word-space to separate them. If no spacing is desired, use \concat. Anything more complex should really be done with custom markup functions, so as to preserve the formatting and flexibility of markup over pure text. Finally, \fromproperty is important as it defers the evaluation of the property. Using \title would give you the current value whereas \fromproperty #'header:title can accommodate changes to the property. Consider the following: \version "2.20.0" \header { title = "Title" subtitle = \markup { Sub \title } subsubtitle = \markup { Subsub \fromproperty #'header:title } } \header { title = "Title (changed)" } \markup { Lorem ipsum dolor sit amet } In the above, the subtitle does not reflect the change to the title. In general, you should prefer to use \fromproperty so that the order of defining properties does not matter. However, if you can ensure properties are set properly, there should be nothing wrong with using \title directly. -- Aaron Hill
Re: Function operating on header
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))) >> >>
Re: Function operating on header
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))) -- Francisco Vila, Ph.D. - Badajoz (Spain) paconet.org , lilypond.es
Re: 2.20.0 doc tarball location
It's here: http://lilypond.org/all.html Il giorno gio 12 mar 2020 alle 23:20, Andrew Bernard ha scritto: I am accustomed to downloading the complete doc tarball for releases. I am unable to see where this has gone to with the 2.20.0 release on the lilypond website. Can anybody help me out? It's eluding my vision. Andrew
2.20.0 doc tarball location
I am accustomed to downloading the complete doc tarball for releases. I am unable to see where this has gone to with the 2.20.0 release on the lilypond website. Can anybody help me out? It's eluding my vision. Andrew