Hi David,

I have several pages of introductory and performance notes in the score
I am currently working on, followed by about 150 pages of score.  I
should like to have the pages before the actual score numbered in lower
case Roman numerals, followed by the score pages numbered in Arabic
numerals starting at 1.  But I cannot find any way to do this.

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.

\version "2.19"

introductionLengh = 3

#(define-markup-command (makePageNumber layout props) ()
   (let* ((page (chain-assoc-get 'page:page-number props -1))
          (romanize? (< page 1))
          (effective-page (if romanize? (+ page introductionLengh) page))
          (effective-page-string (if romanize?
                                     (if (positive? effective-page) ; needed for 2.21 for some reason                                          (string-downcase (fancy-format #f "~@r" effective-page))
                                         "")
                                     (number->string effective-page)
                                     )))
     (interpret-markup layout props effective-page-string)))

\book {
  \paper {
    first-page-number = #(- 1 introductionLengh)
    print-page-number = ##t
    print-first-page-number = ##t
    oddHeaderMarkup = \markup \null
    evenHeaderMarkup = \markup \null
    oddFooterMarkup = \markup { \fill-line { \makePageNumber } }
    evenFooterMarkup = \oddFooterMarkup
  }
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
  \score { \new Staff { s1 } } \pageBreak
}


Probably the coding style is not good because I bypass using \fromproperty etc. which I do not quite understand. But at least it works ;-). But I expect this is the reason I need an extra check for 2.21 - here the function is sometimes called with an effective page number of 0, causing an error when trying to turn this into a Roman number.

Best
Lukas


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

Reply via email to