\version "2.17.11" writeBook = #(define-void-function (parser location book paper layout file) (ly:book? list? ly:output-def? string?) ; set all given paper vars in book paper (for-each (lambda (p) (if (pair? p) (ly:output-def-set-variable! (ly:book-paper book) (car p)(cdr p)))) paper) (ly:book-process book #{ \paper {} #} layout file)) compileScore = #(define-void-function (parser location score) (ly:score?) (let ((book #{ \book { \include "test-include.ily" \score { $score } } #})) #{ \writeBook \book { $book } $'(()) \layout {} $(ly:parser-output-name parser) #})) %\include "test-include.ily" \compileScore \score { \relative c' { d g a b } }