lilypond-user
[Top][All Lists]
Advanced

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

Re: Separate page numbering in separate book parts?


From: Nicolas Sceaux
Subject: Re: Separate page numbering in separate book parts?
Date: Thu, 4 Dec 2008 21:36:09 +0100

Le 4 déc. 08 à 12:52, Graham Percival a écrit :

On Thu, Dec 04, 2008 at 11:58:48AM +0100, Mats Bengtsson wrote:
With the new book parts feature, is it possible to restart the page
numbering for each book part.

Surprisingly,
 \paper{ first-page-number = #1 }
doesn't do this!


Indeed, first-page-number is only read for the first book part, then
it is set for the following ones to
 previous-book-part-last-page-number + 1.

It is possible to accomplish what you are asking by changing the page
header formatting markup, as is demonstrated in the following example.
Do you think that using this hack is enough? or should I change the code
so that first-page-number should be read, when defined, for all book
parts? (I have no idea what side effect that would cause, except
confusing \label:s and tables of contents)

nicolas

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#(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
  \fill-line {
    \null
    \on-the-fly #not-first-page \fromproperty #'header:instrument
    \on-the-fly #print-page-number-check-first \bookpart-page-number
  }

  evenHeaderMarkup = \markup
  \fill-line {
    \on-the-fly #print-page-number-check-first \bookpart-page-number
    \on-the-fly #not-first-page \fromproperty #'header:instrument
    \null
  }
}

\bookpart {
  \markup { first part 1 } \pageBreak
  \markup { first part 2 } \pageBreak
  \markup { first part 3 }
}
\bookpart {
  \markup { second part 1 } \pageBreak
  \markup { second part 2 } \pageBreak
  \markup { second part 3 }
}
\bookpart {
  \markup { third part 1 } \pageBreak
  \markup { third part 2 } \pageBreak
  \markup { third part 3 }
}






reply via email to

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