lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Altering page numbers


From: Kieren MacMillan
Subject: Re: Altering page numbers
Date: Sat, 12 Jan 2019 13:36:49 -0500

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: address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]