Hi Lukas,

> One can write a function that chooses the right format of the page number 
> depending on where we are in the score. In the following solution , one has 
> to define (beforehand) how many pages are to be considered "introduction", 
> but I think this is not too nasty.

Interesting approach! Thanks for posting.

Here’s the equivalent — well, almost — using bookpart-page-number:

%%%  SNIPPET BEGINS
\version "2.19.80"

#(define-markup-command (bookpart-page-number layout props) ()
    (let ((first-page-number (ly:output-def-lookup layout 'first-page-number))
          (page-number (chain-assoc-get 'page:page-number props 0)))
      (interpret-markup layout props (format "~a" (1+ (- page-number
first-page-number))))))

\paper {
  oddHeaderMarkup = \markup \null
  evenHeaderMarkup = \markup \null
  oddFooterMarkup = \markup { \fill-line { \bookpart-page-number } }
  evenFooterMarkup = \oddFooterMarkup
}

\book {
  \bookpart {
    \paper {
      page-number-type = #'roman-lower  %%  doesn’t currently work
    }
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } }
  }
  \bookpart {
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } }
  }
}
%%%  SNIPPET ENDS

Evidently, the choice of page number formatting (e.g., roman) doesn’t work, 
because the bookpart-page-number function assumes/hardcodes the format… but 
otherwise, I prefer this solution, as it is (to my eye) a more natural way of 
coding book parts [with individual numbering].

I’m going to take the challenge to up my Scheme-fu, by trying to tackle the 
improvement of the bookpart-page-number function to handle different formatting 
as giving in \paper variables.

Related: Lily’s entire page-numbering system needs a re-look, so that 
multi-part, multi-format, maybe-number-reset-but-maybe-not documents can be 
handled elegantly and with minimal user coding (such as additional functions 
like yours and mine).

Cheers,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: i...@kierenmacmillan.info


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to