\version "2.14.00"



\paper {
	scoreTitleMarkup = \markup { \column {
		\on-the-fly #print-all-headers { \bookTitleMarkup \hspace #1 }
		\fill-line {
			\fromproperty #'header:opus
			\tiny \fromproperty #'header:piece
		}
		}
	}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



#(define-markup-command (consider-page-num layout props label arg)
  (symbol? markup?)
  (let* ((stencil (interpret-markup layout props arg))
	 (x-ext (ly:stencil-extent stencil X))
	 (y-ext (ly:stencil-extent stencil Y)))
    (ly:make-stencil
     `(delay-stencil-evaluation
       ,(delay (ly:stencil-expr
		 (let* ((table (ly:output-def-lookup layout 'label-page-table))
		        (page-number (if (list? table)
		                         (assoc-get label table)
					 #f)))
		   (interpret-markup layout props
		     (if (even? page-number)
			 (markup arg)
			 (markup #:fill-line ("" arg))))))))
     x-ext
     y-ext)))
     

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
     
\book {
  \score { 
    \new Staff { \label #'a \repeat unfold 100 c'1 }
    \header {
      opus = \markup { \consider-page-num #'a "hymn-1" }
      piece = \markup { \null \halign #27 "Te Deum" }
    }
  }

  \score {
    \new Staff { \label #'b \repeat unfold 100 c'1 }
    \header {
      opus = \markup { \consider-page-num #'b "hymn-2" }
      piece = \markup { \null \halign #57 "Aria" }
    }
  }
  
  \score {
    \new Staff { \label #'c \repeat unfold 100 c'1 }
    \header {
      opus = \markup { \consider-page-num #'c "hymn-3" }
      piece = \markup { \null \halign #38 "Messe" }
    }
  }
  
  \score {
    \new Staff { \label #'d c'1 }
    \header {
      opus = \markup { \consider-page-num #'d "hymn-4" }
      piece = \markup { \null \halign #55 "Solo" }
    }
  }
  
  \score {
    \new Staff { \label #'e \repeat unfold 100 c'1 }
    \header {
      opus = \markup { \consider-page-num #'e "hymn-5" }
      piece = \markup { \null \halign #21.5 "Magnificat" }
    }
  }
  
  \score {
    \new Staff { \label #'f c'1 }
    \header {
      opus = \markup { \consider-page-num #'f "hymn-6" }
      piece = \markup { \null \halign #38 "Agnus" }
    }
  }
}

