[Top][All Lists]

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

Re: Altering page numbers

From: Lukas-Fabian Moser
Subject: Re: Altering page numbers
Date: Sat, 12 Jan 2019 19:05:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

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 "address@hidden" 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.


reply via email to

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