Re: Altering page numbers
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 wrote: > Am Sa., 12. Jan. 2019 um 20:44 Uhr schrieb 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. =) > > 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 > lilypond-user@gnu.org > https://lists.gnu.org/mailman/listinfo/lilypond-user > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
Am Sa., 12. Jan. 2019 um 20:44 Uhr schrieb 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. =) 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 lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
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: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
Am Sa., 12. Jan. 2019 um 19:37 Uhr schrieb Kieren MacMillan : > %%% 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 lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
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: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
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 lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
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: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
-Original Message- From: Kieren MacMillan To: da...@aeolia.co.uk CC: Lilypond-User Mailing List 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 lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Altering page numbers
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: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user