lilypond-user
[Top][All Lists]
Advanced

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

force bookparts to end on even pages


From: Shevek
Subject: force bookparts to end on even pages
Date: Sun, 22 Jan 2012 16:20:46 -0800 (PST)

I'm creating instrumental parts in a single file using a separate bookpart
for each part. This entails restarting page numbering for each bookpart, and
omitting the instrument and page number from the first page of each
bookpart. I've assembled a snippet that does those things, based on
http://old.nabble.com/book-and-instrument-td31711660.html and
http://old.nabble.com/Separate-page-numbering-in-separate-book-parts--td20831772.html.
The only thing missing now is to make sure that each bookpart starts on an
odd page. I'd like to do this by automatically inserting blank pages. My
guess is the solution has something to do with
http://lilypond.org/doc/v2.14/Documentation/notation/other-_005cpaper-variables#_005cpaper-variables-for-page-breaking,
but there aren't any examples mentioned in the documentation. I'd appreciate
some guidance.

\version "2.14.0"

#(define (not-part-first-page layout props arg)
         (if (not (= (chain-assoc-get 'page:page-number props -1)
                 (ly:output-def-lookup layout 'first-page-number)))
             (interpret-markup layout props arg)
               empty-stencil))
               
#(define (print-page-number-check-part-first layout props arg)
    (if (or (not (= (chain-assoc-get 'page:page-number props -1)
              (ly:output-def-lookup layout 'first-page-number)))
                (eq? (ly:output-def-lookup layout 'print-first-page-number)
#t))
                    (create-page-number-stencil layout props arg)
                      empty-stencil))

#(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-part-first-page \fromproperty #'header:instrument
    \on-the-fly #not-part-first-page \on-the-fly
#print-page-number-check-first \bookpart-page-number
  }
  
  evenHeaderMarkup = \markup
  \fill-line {
    \on-the-fly #not-part-first-page \on-the-fly
#print-page-number-check-first \bookpart-page-number
    \on-the-fly #not-part-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 }
} 
-- 
View this message in context: 
http://old.nabble.com/force-bookparts-to-end-on-even-pages-tp33185483p33185483.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

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