\version "2.21.0" % Define all the music first start = \relative { \repeat volta 10 { c'4 d e f } } endA = \relative { g'2 a4 b c1 } endB = \relative { g'2 f4 d c1 } music = #(define-music-function () () #{ \start \end \bar "|." #}) % book template mybookdef = " \book{ \bookOutputSuffix \bookName \paper{ system-count = \mysyscount } \score { \unfoldRepeats \repList { \music } \layout{ } } } " mybook = #(define-scheme-function () () (ly:parser-include-string #{ \mybookdef #})) % "none" is not a valid 1st argument to \unfoldRepeats, % but the default action (ignore \unfoldRepeats) is what we want ;-) repList = none bookName = "A" end = \endA mysyscount = 1 \mybook bookName = "B" end = \endB mysyscount = 1 \mybook repList = volta bookName = "C" end = \endA mysyscount = 2 \mybook bookName = "D" end = \endB mysyscount = 3 \mybook