2016-06-27 18:56 GMT+02:00 Pierre-Luc Gauthier <p.luc.gauth...@gmail.com>: > Greetings, > > Sorry about the late follow up (about 7 months later). > > The orchestra I work with came down to a halt for the summer and I now > have some time to set stuff up for the next season. > > Many thanks to you Urs and David; your explanations certainly helped > me understand more of what was going on especially about quasi-quotes. > > Here is what I got so far. > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > \version "2.19.44" > > \language "english" > > \header {title = "Such title."} > > scoreA = \score {\header {piece = "Piece A"} a'4} > > scoreB = \score {\header {piece = "Piece B"} b'4} > > scores = #(list scoreA scoreB) > > #(define bookGenerator > (define-void-function > ( > scoreList > bookSuffix > ;; header > paperBlock > layoutBlock > ) > (list? string? scheme? scheme?) ;; add scheme? here > (let* ( > (book (apply ly:make-book > paperBlock > #f ;; header > (reverse scoreList))) > ) > (ly:book-process book paperBlock layoutBlock bookSuffix)) > )) > > \bookGenerator > \scores > "violinI" > %\header {instrument = "Violin I"} > \paper {} > \layout {} > > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > It works fine and I am pretty excited about this > ¡¡¡So long, 500+ lines of inflexible and unmaintainable book definitions!!! > Well, my problem is with the header. > I have not found a way to pass a header to the function ly:make-book. > I found #f to make the function compile... which obviously is not much > of a suitable header. > > How can I pass a header (and the global header) to ly:make-book?
Below two different codings which you may find helpful (1) %%%%%%%%%%%%%%%%%%%%%%%%%%%%% \version "2.19.44" \language "english" bookGenerator = #(define-void-function (scoreList bookSuffix) (list? string?) (let* ((book (apply ly:make-book $defaultpaper $defaultheader (reverse scoreList)))) (ly:book-process book $defaultpaper $defaultlayout bookSuffix))) %%%% book-header %% referenced as $defaultheader %% needs to be defined before new settings are done \header { title = "Such title." } %% header-settings added via scheme: %% settings stored in an alist: my-header-entries = #'((subtitle . "SUBTITLE") (dedication . "DEDICATION") (composer . "MYSELF")) %% apply them: #(for-each (lambda (e) (module-define! $defaultheader (car e) (cdr e))) my-header-entries) %% print header-settings to terminal %#(pretty-print (ly:module->alist $defaultheader)) %%%% book-layout %% referenced as $defaultlayout \layout { \context { \Staff \override TimeSignature.color = #green } } %%%% book-paper %% referenced as $defaultpaper \paper { ragged-right = ##f } %% score-definitions with scoreheader-settings scoreA = \score { \header { piece = "Piece A" } a'4 } scoreB = \score { \header { piece = "Piece B" } b'4 } scores = #(list scoreA scoreB) %% print the book: \bookGenerator \scores "violinI" (2) %%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% you can do a lot with those powerful functions, here another method %% `add-score` is a nice function as well \version "2.19.44" \language "english" scoreA = \score { \header { piece = "Piece A" } a'4 } scoreB = \score { \header { piece = "Piece B" } b'4 } \paper { ragged-right = ##f } \header { title = "Such title two." } \layout { \context { \Staff \override TimeSignature.color = #green } } bk = \book {} %% not really needed in this situation : #(ly:book-set-header! bk $defaultheader) %% you could use this in a book-generating function: #(for-each add-score (list scoreA scoreB)) \bookOutputName "violinI" > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > > A few side questions, > > Also, How can I make my function be more "indentable" by using, for > example, curly braces e.g. \bookGenerator { stuff } ? No idea what you mean. > > Why do I have to pass a paperBlock to ly:make-book AND to ly:book-process ? > Is there a way to only have one? > Doesn't the ly:make-book already contains the paperBlock ? ly:make-book creates the book. Now you could add this and that ... After you finished your work on the probably modified book you need to print it with ly:book-process > OT discussion; Frescobaldi can not, currently, get a hold of those PDF > generated with lower level commands > As this [1] comment stated, the LilyPond output could be a fail-safe > way to track down every generated PDFs instead of reverse engineering > the generated filenames as it is (I think) currently the case. Can't say anything here, I don't use Frescobaldi > > [1] https://github.com/wbsoft/frescobaldi/issues/546#issuecomment-155148714 > > > -- > Pierre-Luc Gauthier > > _______________________________________________ > lilypond-user mailing list > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user