Altering page numbers

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Altering page numbers

David Sumbler
Judging from all the searching I have done I think that the answer to
the following question is "no": is there a way to override automatic
page-numbering after the first page?

I have several pages of introductory and performance notes in the score
I am currently working on, followed by about 150 pages of score.  I
should like to have the pages before the actual score numbered in lower
case Roman numerals, followed by the score pages numbered in Arabic
numerals starting at 1.  But I cannot find any way to do this.

At the moment it seems as if I have 2 alternatives: I can either leave
the introductory pages unnumbered and set first-page-number = #-7 (or
whatever value would give me page 1 on the first page of actual score);
or I can split the book into 2 separate files, one for the cover and
introduction and the other for the score itself.

Is there any way of achieving the result I want whilst keeping the
whole book in one actual \book block and hence one output file?

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Kieren MacMillan
Hi David,

> Judging from all the searching I have done I think that the answer to
> the following question is "no": is there a way to override automatic
> page-numbering after the first page?

In the last fifteen years, I’ve learned never to bet against Lilypond…  ;)

> I have several pages of introductory and performance notes in the score
> I am currently working on, followed by about 150 pages of score.  I
> should like to have the pages before the actual score numbered in lower
> case Roman numerals, followed by the score pages numbered in Arabic
> numerals starting at 1.  But I cannot find any way to do this.

Just in case you’re interested in my [not-just-Lilypond] workflow: I find it easiest, best, and superior (in terms of output) to build the front matter and end matter in LaTeX (with its own page numbering), and then simply insert the Lilypond score (with its own page numbering) as a PDF at the correct spot.

> Is there any way of achieving the result I want whilst keeping the
> whole book in one actual \book block and hence one output file?

Use multiple bookpart sections?  =)

Cheers,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

David Sumbler

-----Original Message-----
From: Kieren MacMillan <[hidden email]>
To: [hidden email]
CC: Lilypond-User Mailing List <[hidden email]>
Subject: Re: Altering page numbers
Date: Sat, 12 Jan 2019 10:38:55 -0500

Hi David,

> Judging from all the searching I have done I think that the answer to
> the following question is "no": is there a way to override automatic
> page-numbering after the first page?

In the last fifteen years, I’ve learned never to bet against
Lilypond…  ;)

> I have several pages of introductory and performance notes in the
> score
> I am currently working on, followed by about 150 pages of score.  I
> should like to have the pages before the actual score numbered in
> lower
> case Roman numerals, followed by the score pages numbered in Arabic
> numerals starting at 1.  But I cannot find any way to do this.

Just in case you’re interested in my [not-just-Lilypond] workflow: I
find it easiest, best, and superior (in terms of output) to build the
front matter and end matter in LaTeX (with its own page numbering), and
then simply insert the Lilypond score (with its own page numbering) as
a PDF at the correct spot.

> Is there any way of achieving the result I want whilst keeping the
> whole book in one actual \book block and hence one output file?

Use multiple bookpart sections?  =)

Cheers,
Kieren.
________________________________

Well, I tried that, but adding
  \paper { first-page-number = #1 }
inside or just before a \bookpart doesn't work.

David


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Kieren MacMillan
Hi David,

> Well, I tried that, but adding
>  \paper { first-page-number = #1 }
> inside or just before a \bookpart doesn't work.

Are you using bookpart-page-number in your header/footer/markup?

Cheers,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Lukas-Fabian Moser
In reply to this post by David Sumbler
Hi David,

> I have several pages of introductory and performance notes in the score
> I am currently working on, followed by about 150 pages of score.  I
> should like to have the pages before the actual score numbered in lower
> case Roman numerals, followed by the score pages numbered in Arabic
> numerals starting at 1.  But I cannot find any way to do this.

One can write a function that chooses the right format of the page
number depending on where we are in the score. In the following solution
, one has to define (beforehand) how many pages are to be considered
"introduction", but I think this is not too nasty.

\version "2.19"

introductionLengh = 3

#(define-markup-command (makePageNumber layout props) ()
    (let* ((page (chain-assoc-get 'page:page-number props -1))
           (romanize? (< page 1))
           (effective-page (if romanize? (+ page introductionLengh) page))
           (effective-page-string (if romanize?
                                      (if (positive? effective-page) ;
needed for 2.21 for some reason
                                          (string-downcase (fancy-format
#f "~@r" effective-page))
                                          "")
                                      (number->string effective-page)
                                      )))
      (interpret-markup layout props effective-page-string)))

\book {
   \paper {
     first-page-number = #(- 1 introductionLengh)
     print-page-number = ##t
     print-first-page-number = ##t
     oddHeaderMarkup = \markup \null
     evenHeaderMarkup = \markup \null
     oddFooterMarkup = \markup { \fill-line { \makePageNumber } }
     evenFooterMarkup = \oddFooterMarkup
   }
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
   \score { \new Staff { s1 } } \pageBreak
}


Probably the coding style is not good because I bypass using
\fromproperty etc. which I do not quite understand. But at least it
works ;-). But I expect this is the reason I need an extra check for
2.21 - here the function is sometimes called with an effective page
number of 0, causing an error when trying to turn this into a Roman number.

Best
Lukas


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Kieren MacMillan
Hi Lukas,

> One can write a function that chooses the right format of the page number depending on where we are in the score. In the following solution , one has to define (beforehand) how many pages are to be considered "introduction", but I think this is not too nasty.

Interesting approach! Thanks for posting.

Here’s the equivalent — well, almost — using bookpart-page-number:

%%%  SNIPPET BEGINS
\version "2.19.80"

#(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 \null
  evenHeaderMarkup = \markup \null
  oddFooterMarkup = \markup { \fill-line { \bookpart-page-number } }
  evenFooterMarkup = \oddFooterMarkup
}

\book {
  \bookpart {
    \paper {
      page-number-type = #'roman-lower  %%  doesn’t currently work
    }
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } }
  }
  \bookpart {
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } } \pageBreak
    \score { \new Staff { s1 } }
  }
}
%%%  SNIPPET ENDS

Evidently, the choice of page number formatting (e.g., roman) doesn’t work, because the bookpart-page-number function assumes/hardcodes the format… but otherwise, I prefer this solution, as it is (to my eye) a more natural way of coding book parts [with individual numbering].

I’m going to take the challenge to up my Scheme-fu, by trying to tackle the improvement of the bookpart-page-number function to handle different formatting as giving in \paper variables.

Related: Lily’s entire page-numbering system needs a re-look, so that multi-part, multi-format, maybe-number-reset-but-maybe-not documents can be handled elegantly and with minimal user coding (such as additional functions like yours and mine).

Cheers,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Thomas Morley-2
Am Sa., 12. Jan. 2019 um 19:37 Uhr schrieb Kieren MacMillan
<[hidden email]>:

> %%%  SNIPPET BEGINS
> \version "2.19.80"
>
> #(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))))))
[...]

> Evidently, the choice of page number formatting (e.g., roman) doesn’t work, because the bookpart-page-number function assumes/hardcodes the format…

You could go for:

#(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
        (number-format
          (ly:output-def-lookup layout 'page-number-type)
          (1+ (- page-number first-page-number))))))

> but otherwise, I prefer this solution, as it is (to my eye) a more natural way of coding book parts [with individual numbering].

Agreed

>
> I’m going to take the challenge to up my Scheme-fu, by trying to tackle the improvement of the bookpart-page-number function to handle different formatting as giving in \paper variables.
>
> Related: Lily’s entire page-numbering system needs a re-look, so that multi-part, multi-format, maybe-number-reset-but-maybe-not documents can be handled elegantly and with minimal user coding (such as additional functions like yours and mine).

Though, what about the table-of-content?
Right now I've not a good idea what should be printed if several
bookparts have equal page-numbers.

Cheers,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Kieren MacMillan
Hi Harm,

> You could go for:
>
> #(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
>        (number-format
>          (ly:output-def-lookup layout 'page-number-type)
>          (1+ (- page-number first-page-number))))))

Thanks! I’ll study your solution as part of my Scheme education.  =)

> Though, what about the table-of-content?
> Right now I've not a good idea what should be printed if several
> bookparts have equal page-numbers.

That’s almost more of an editorial choice than a technical one, no? If for some reason I want the score for my Opera In Three Acts to have per-act page numbers, then I will end up with a TOC that looks something like

  Act One
    Aria 1      I-1
    Aria 2      I-22

Act Two
   Aria 3      II-1
   Aria 4      II-9

etc.

The Dover reprints of Bach works often include per-sub-collection numbering alongside the main page numbering, e.g.

    1 [1], 2 [2], … 25 [25], 26 [1], 27 [2], … 124 [99], 125 [1], 126 [2], …

In musical theatre scores, it’s also useful to have double numbering (e.g.,
    page-number-within-entire-score [page-number-within-this-song]

As long as there are switches/parameters/properties that allow the user to choose, format, and select/print the various numbers/elements they want — including bookpart labels, like the "I" and "II" in my fictional opera example — I would consider Lilypond’s job done.

Cheers,
Kieren.
________________________________

Kieren MacMillan, composer
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Thomas Morley-2
Am Sa., 12. Jan. 2019 um 20:44 Uhr schrieb Kieren MacMillan
<[hidden email]>:

>
> Hi Harm,
>
> > You could go for:
> >
> > #(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
> >        (number-format
> >          (ly:output-def-lookup layout 'page-number-type)
> >          (1+ (- page-number first-page-number))))))
>
> Thanks! I’ll study your solution as part of my Scheme education.  =)

Not much scheme here...
You need to know LilyPond's 'number-format'-procedure exists at all.
And how to get 'page-number-type, but that's a minor problem (some as
for 'first-page-number).

>
> > Though, what about the table-of-content?
> > Right now I've not a good idea what should be printed if several
> > bookparts have equal page-numbers.
>
> That’s almost more of an editorial choice than a technical one, no? If for some reason I want the score for my Opera In Three Acts to have per-act page numbers, then I will end up with a TOC that looks something like
>
>   Act One
>     Aria 1      I-1
>     Aria 2      I-22
>
> Act Two
>    Aria 3      II-1
>    Aria 4      II-9
>
> etc.
>
> The Dover reprints of Bach works often include per-sub-collection numbering alongside the main page numbering, e.g.
>
>     1 [1], 2 [2], … 25 [25], 26 [1], 27 [2], … 124 [99], 125 [1], 126 [2], …
>
> In musical theatre scores, it’s also useful to have double numbering (e.g.,
>     page-number-within-entire-score [page-number-within-this-song]

Well, I'll think about the problem...

Thanks,
  Harm

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Altering page numbers

Hwaen Ch'uqi
Greetings David,

I may be wading into this discussion a bit late, but the following
links should address exactly what you initialy asked. They are
somewhat dated, but the solution still works for me using 2.19.82.
Many thanks to David Nalesnik for his work on this.

http://lists.gnu.org/archive/html/lilypond-user/2012-08/msg00665.html

http://lists.gnu.org/archive/html/lilypond-user/2014-01/msg00878.html

Hwaen Ch'uqi


On 1/12/19, Thomas Morley <[hidden email]> wrote:

> Am Sa., 12. Jan. 2019 um 20:44 Uhr schrieb Kieren MacMillan
> <[hidden email]>:
>>
>> Hi Harm,
>>
>> > You could go for:
>> >
>> > #(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
>> >        (number-format
>> >          (ly:output-def-lookup layout 'page-number-type)
>> >          (1+ (- page-number first-page-number))))))
>>
>> Thanks! I’ll study your solution as part of my Scheme education.  =)
>
> Not much scheme here...
> You need to know LilyPond's 'number-format'-procedure exists at all.
> And how to get 'page-number-type, but that's a minor problem (some as
> for 'first-page-number).
>
>>
>> > Though, what about the table-of-content?
>> > Right now I've not a good idea what should be printed if several
>> > bookparts have equal page-numbers.
>>
>> That’s almost more of an editorial choice than a technical one, no? If for
>> some reason I want the score for my Opera In Three Acts to have per-act
>> page numbers, then I will end up with a TOC that looks something like
>>
>>   Act One
>>     Aria 1      I-1
>>     Aria 2      I-22
>>
>> Act Two
>>    Aria 3      II-1
>>    Aria 4      II-9
>>
>> etc.
>>
>> The Dover reprints of Bach works often include per-sub-collection
>> numbering alongside the main page numbering, e.g.
>>
>>     1 [1], 2 [2], … 25 [25], 26 [1], 27 [2], … 124 [99], 125 [1], 126 [2],
>> …
>>
>> In musical theatre scores, it’s also useful to have double numbering
>> (e.g.,
>>     page-number-within-entire-score [page-number-within-this-song]
>
> Well, I'll think about the problem...
>
> Thanks,
>   Harm
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user