[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: Feature sponsor request for \paper block
From:       "Rick Hansen (aka RickH)" <passport () windcrestsoftware ! com>
Date:       2006-09-29 3:32:03
Message-ID: 6558857.post () talk ! nabble ! com
[Download RAW message or body]


Daniel,

Your solution worked great except for the case where the first page is also
the last page (1 page scores), so I added another condition:  (on 1 page
scores the footers were overprinting twice for both first and last on same
page).  I'm reposting this here because it's such a useful solution that
others may want to check it out.


%EXAMPLE BEGIN

\version "2.9.16"
varModifiedTimeString = "changed:"
% NOTE: first-page and last-page are defined in ly/titling-init.ly

#(define (not-first-and-not-last-page layout props arg)
   (if
      (not
          (or
             (= (chain-assoc-get 'page:page-number props -1)
                (ly:output-def-lookup layout 'first-page-number)
             )
             (chain-assoc-get 'page:last? props #f)
          )
      )
      (interpret-markup layout props arg)
      empty-stencil
   )
)

#(define (first-and-last-page layout props arg)
   (if
       (and
          (= (chain-assoc-get 'page:page-number props -1)
             (ly:output-def-lookup layout 'first-page-number)
          )
          (chain-assoc-get 'page:last? props #f)
       )
      (interpret-markup layout props arg)
      empty-stencil
   )
)

\paper {

   oddFooterMarkup = \markup {
      \on-the-fly #first-and-last-page {
         \fill-line {
            { \hspace #0 }
            { \teeny "first-and-last-page" }
            { \bold \fromproperty #'page:page-number-string }
         }
      }
      \on-the-fly #first-page {
         \fill-line {
            { \hspace #0 }
            { \teeny "first-page" }
            { \bold \fromproperty #'page:page-number-string }
         }
      }
      \on-the-fly #last-page {
         \fill-line {
            { \tiny \sans \varModifiedTimeString }
            { \bold \fromproperty #'page:page-number-string }
         }
      }
      \on-the-fly #not-first-and-not-last-page {
         \fill-line {
            { \hspace #0 }
            { \bold \fromproperty #'page:page-number-string }
         }
      }
   }

   evenFooterMarkup = \markup {
      \on-the-fly #first-and-last-page {
         \fill-line {
            { \bold \fromproperty #'page:page-number-string }
            { \teeny "first-and-last-page" }
            { \hspace #0 }
         }
      }
      \on-the-fly #first-page {
         \fill-line {
            { \bold \fromproperty #'page:page-number-string }
            { \teeny "first-page" }
            { \hspace #0 }
         }
      }
      \on-the-fly #last-page {
         \fill-line {
            { \bold \fromproperty #'page:page-number-string }
            { \tiny \sans \varModifiedTimeString }
         }
      }
      \on-the-fly #not-first-and-not-last-page {
         \fill-line {
            { \bold \fromproperty #'page:page-number-string }
            { \hspace #0 }
         }
      }
   }

  system-count = 100
}

   \header {
      	tagline = " "
   }

\score {
  R1*100
%  R1
}



%EXAMPLE END





Daniel Johnson-2 wrote:
> 
> Hmm. realized I'd forgotten to CC the list.
> 
> > How hard/costly would it be to add 4 more properties? called:
> > 
> > firstHeaderMarkup
> > firstFooterMarkup
> > lastHeaderMarkup
> > lastFooterMarkup
> > 
> 
> %%% BEGIN LILYPOND CODE %%%
> 
> \version "2.9.16"
> 
> % NOTE: first-page and last-page are defined in ly/titling-init.ly
> 
> #(define (not-first-or-last-page layout props arg)
> (if (not (or (= (chain-assoc-get 'page:page-number props -1)
> (ly:output-def-lookup layout 'first-page-number))
> (chain-assoc-get 'page:last? props #f)))
> (interpret-markup layout props arg)
> empty-stencil))
> 
> \paper {
> oddHeaderMarkup = \markup {
> \on-the-fly #first-page {
> \fill-line { "This is the first page" }
> }
> \on-the-fly #last-page {
> \fill-line { "This is the last page" }
> }
> \on-the-fly #not-first-or-last-page {
> \fill-line { "" "This is a middle page" }
> }
> }
> evenHeaderMarkup = \markup {
> \on-the-fly #first-page {
> \fill-line { "This is the first page" }
> }
> \on-the-fly #last-page {
> \fill-line { "This is the last page" }
> }
> \on-the-fly #not-first-or-last-page {
> \left-align { "This is a middle page" }
> }
> }
> system-count = 100
> }
> 
> \score {
> R1*100
> }
> 
> 
> 
> _______________________________________________
> lilypond-user mailing list
> lilypond-user@gnu.org
> http://lists.gnu.org/mailman/listinfo/lilypond-user
> 
> 

-- 
View this message in context: \
http://www.nabble.com/Feature-sponsor-request-for-%5Cpaper-block-tf2351903.html#a6558857
 Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic