[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defining 'not-last-page'
From: |
Nick Payne |
Subject: |
Re: Defining 'not-last-page' |
Date: |
Fri, 15 Jul 2011 14:28:28 +1000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 |
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