On 15/07/11 10:20, Matthew Collett wrote:
titling-init.ly contains the following definitions:
#(define (first-page layout props arg)
(if (book-first-page? layout props)
(interpret-markup layout props arg)
empty-stencil))
#(define (last-page layout props arg)
(if (book-last-page? layout props)
(interpret-markup layout props arg)
empty-stencil))
#(define (not-first-page layout props arg)
(if (not (book-first-page? layout props))
(interpret-markup layout props arg)
empty-stencil))
Given these, it would seem to be trivial to complete the set by defining
#(define (not-last-page layout props arg)
(if (not (book-last-page? layout props))
(interpret-markup layout props arg)
empty-stencil))
However, any attempt to _use_ this results in 'ERROR: Unbound variable:
book-last-page?'. This is extremely Schemely puzzling, since in exactly the
same context 'last-page' works fine, even though it references the same
putatively AWOL variable. For example,
\paper {
oddHeaderMarkup = \markup { \fill-line {
\null
\fromproperty #'page:page-number-string
{
\on-the-fly #not-last-page { "More ..." }
\on-the-fly #last-page { "No more." }
}
}}
evenHeaderMarkup = \oddHeaderMarkup
}
\markup{}
\pageBreak
\markup{}
works as expected with the 'not-last-page' line commented out. What is really
going on here, and how can I get 'not-last-page' to work?
This works for me:
\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)))
oddHeaderMarkup = \markup \fill-line { " " }
evenHeaderMarkup = \markup \fill-line { " " }
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 = \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
} }
}
Nick
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user