lilypond-user
[Top][All Lists]
Advanced

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

Re: Display score title differently on odd or even pages


From: lilypond
Subject: Re: Display score title differently on odd or even pages
Date: Thu, 1 Mar 2012 22:48:02 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Mar 01, 2012 at 10:22:32PM -0700, Jay Anderson wrote:
> Is it possible to check whether the page is odd or even in creating
> the score title markup. I'm setting a group of hymns and I'd like the
> hymn number on the outside of the page.

Does it have to be in the title?  I use the following markup
to have my footers contain the page number on alternating sides
of the page.  I believe a similar technique could be employed
with Header markup.  On my lead sheets, page 1 (which I define as
a left page) does not have a page number, but succeeding pages
get numbered with even pages having the page number in the bottom
right, and odd pages numbered in the bottom left.  Sorry to make
noise if you really do want to use the Title markup and not
'Header'.

If so, perhaps someone with the right coding prowess can create
some new "\on-the-fly" #odd-page and #even-page primitives as
you originally sought.

Jim


  oddFooterMarkup = \markup \magnify #0.5 {
    \fill-line {
      \on-the-fly #first-page {
          \null
          \null
          \override #'(font-family . sans) \today
        } % first-page
    } % fill-line
    \fill-line {
      \on-the-fly #not-first-page {
        \override #'(font-family . sans) \fromproperty #'page:page-number-string
        \override #'(font-family . sans) \fromproperty #'header:title
        \override #'(font-family . sans) \today
      }
    } % fill-line
  } % oddFooterMarkup

  evenFooterMarkup = \markup \magnify #0.5 {
      \fill-line {
        \override #'(font-family . sans) \today
        \override #'(font-family . sans) \fromproperty #'header:title
        \override #'(font-family . sans) \fromproperty #'page:page-number-string
      }
  } % evenFooterMarkup



> Looking at titling-init.ly it gets two different page properties
> page:page-number and page:page-number-string. Here's a test:
> 
> \version "2.15.30"
> 
> #(define-markup-command (print-page layout props) ()
>   (let ((page (chain-assoc-get 'page:page-number-string props "xxx")))
>     (interpret-markup layout props #{ \markup { $page } #})))
> 
> \paper
> {
>   oddHeaderMarkup = \markup { \print-page }
>   oddFooterMarkup = \markup { \print-page }
>   scoreTitleMarkup = \markup { \line {"title" \print-page } }
> }
> 
> \score { \new Staff \relative c' { c1 } }
> \pageBreak
> \score { \new Staff \relative c' { c1 } }
> \pageBreak
> \score { \new Staff \relative c' { c1 } }
> 
> Unfortunately this returns the passed in default instead of the page
> number for the title. Is there another way to do this? Or is the page
> number known too late to do something like this?
> 
> -----Jay
> 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user



reply via email to

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