lilypond-user
[Top][All Lists]
Advanced

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

Re: Start showing page numbers on pages greater than "X"


From: Nick Payne
Subject: Re: Start showing page numbers on pages greater than "X"
Date: Sun, 16 Mar 2014 18:02:10 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 16/03/14 03:19, Paul Morris wrote:
Hi all,  Recently I ran into the problem of having more than one page of
prefatory material (a cover page and a table of contents), and I wanted to
start showing page numbers on the first page of music (starting with 1).  

Below is the solution I came up with, by borrowing and modifying a function
from the LilyPond source code, shown with a version of the example in the
docs here:
http://lilypond.org/doc/v2.18/Documentation/notation/custom-titles-headers-and-footers#custom-layout-for-headers-and-footers

Is this the best way to do this?  If so would it make sense to add it to the
LSR or possibly add the "on-page-greater-than" function to LilyPond?

-Paul


\version "2.18.0"

% modified version of "on-page" from "titling-init.ly" in LilyPond source
#(define ((on-page-greater-than nmbr) layout props arg)
   (if (> (chain-assoc-get 'page:page-number props -1) nmbr)
       (interpret-markup layout props arg)
       empty-stencil))

\book {
  \paper {
    print-page-number = ##t
    print-first-page-number = ##t
    first-page-number = -1
    oddHeaderMarkup = \markup \null
    evenHeaderMarkup = \markup \null
    oddFooterMarkup = \markup {
      \fill-line {
        \on-the-fly #(on-page-greater-than 0)
        \fromproperty #'page:page-number-string
      }
    }
    evenFooterMarkup = \oddFooterMarkup
  }
  \markup "A prefatory page (cover page)"
  \pageBreak
  \markup "Another prefatory page (table of contents)"
  \pageBreak
  \markup "First page with a page number"
  \score {
    \new Staff { s1 \break s1 \break s1 }
  }
}

I've been using something very similar:

\paper {

#(define (print-positive-page-number layout props arg)

(if (> (chain-assoc-get 'page:page-number props -1) 0)

(create-page-number-stencil layout props arg)

empty-stencil))


%% cf. ly/titling-init.ly

#(define (not-last-page layout props arg)

(if (and (chain-assoc-get 'page:is-bookpart-last-page props #f)

(chain-assoc-get 'page:is-last-bookpart props #f))

empty-stencil

(interpret-markup layout props arg)))


  first-page-number = -1

print-first-page-number = ##f

oddHeaderMarkup = \markup \null

evenHeaderMarkup = \markup \null

oddFooterMarkup = \markup \fill-line {

\column {

\fontsize #-1

\on-the-fly #not-first-page \on-the-fly #not-last-page \on-the-fly #print-positive-page-number

\fromproperty #'page:page-number-string \on-the-fly #last-page \fromproperty #'header:tagline

}

}

evenFooterMarkup = \oddFooterMarkup

}




reply via email to

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