Re: [SPAM] Re: Multiple place number skip ranges
2016-05-07 21:58 GMT+02:00 Thomas Morley: >>> http://lsr.di.unimi.it/LSR/Item?u=1=1036 > I'll let it unapproved for few more days in case somebody comes up > with further suggestions. > > Thanks a lot for review., > Harm Approved. Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: [SPAM] Re: Multiple place number skip ranges
2016-05-07 15:17 GMT+02:00 David Nalesnik: > Hi Harm, > > On Sat, May 7, 2016 at 5:52 AM, Thomas Morley > wrote: >> 2016-05-07 10:53 GMT+02:00 Peter Gentry : >> >>> Could I sugeest that the range data is input in the individual music file >>> rather than the procedure so that the procedure remains >>> unchanged for any arrangement of page ranges. It should be a minor addition >>> that would make the snippet much more usuable as one of >>> the staple includes. >>> >>> >> Hi Peter, >> >> not sure what you mean, could you elaborate more detailed? >> >> Anyway, I reworked it >> http://lsr.di.unimi.it/LSR/Item?u=1=1036 >> > > > Looks great! The comments below make some grammatical corrections. > Thanks for doing this! > > %%% > > #(define-markup-command (use-page-number-ranges layout props)() > "Reads @code{'page-number-ranges} from @var{layout} and transforms it into a > flat list of integers. Prints a number-string taken from this list for > page-numbering. > The values are referenced by the actual page-number. If all elements of this > list are consumed, additional pages are numbered consecutive. > > > consecutive --> consecutively > > > An empty list will cause default page-numbers. Same for non-list settings or > unsetting of @code{'page-number-ranges} > > > An empty list will cause default page-numbers, as will non-list settings > or > unsetting of @code{'page-number-ranges} > > > Limitations: > - doesn't work for roman page-numbers. > - only integer page-numbers are supported" > > (define (page-numbers ranges) > ;; get a flat, unfolded list from a list containing ranges of integers. > ;; p.e. '((1) (3 5) (7 10)) -> '(1 3 4 5 7 8 9 10) > (append-map > (lambda (e) > (if (every integer? e) > (iota (- (last e) (1- (car e))) (car e) 1) > (ly:error "All elements needs to be integers: ~a" e))) > > > needs --> need > > > ranges)) > > > [snip] > > %% > > Best, > David All done as suggested. I'll let it unapproved for few more days in case somebody comes up with further suggestions. Thanks a lot for review., Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: [SPAM] Re: [SPAM] Re: Multiple place number skip ranges
[involving the group again] On Sat, May 7, 2016 at 8:24 AM, Peter Gentrywrote: > Yes I meant input the page number data as data to the procedure rather than > in the procedure it self > I think it's better to read the settings from the \paper variable as Harm does here. The \paper block is where the user sets other page-number variables. Also, I think it's useful to show that new variables can be added there (which never occurred to me). > > > On 7 May 2016 14:17:30 BST, David Nalesnik wrote: >> >> Hi Harm, >> >> On Sat, May 7, 2016 at 5:52 AM, Thomas Morley >> wrote: >>> >>> 2016-05-07 10:53 GMT+02:00 Peter Gentry : >>> Could I sugeest that the range data is input in the individual music file rather than the procedure so that the procedure remains unchanged for any arrangement of page ranges. It should be a minor addition that would make the snippet much more usuable as one of the staple includes. >>> >>> >>> >>> Hi Peter, >>> >>> not sure what you mean, could you elaborate more detailed? >>> >>> Anyway, I reworked it >>> http://lsr.di.unimi.it/LSR/Item?u=1=1036 >> >> >> >> >> Looks great! The comments below make some grammatical corrections. >> Thanks for doing this! >> >> %%% >> >> #(define-markup-command (use-page-number-ranges layout props)() >> "Reads @code{'page-number-ranges} from @var{layout} and transforms it >> into a >> flat list of integers. Prints a number-string taken from this list for >> page-numbering. >> The values are referenced by the actual page-number. If all elements of >> this >> list are consumed, additional pages are numbered consecutive. >> >> >> consecutive --> consecutively >> >> >> An empty list will cause default page-numbers. Same for non-list settings >> or >> unsetting of @code{'page-number-ranges} >> >> >> An empty list will cause default page-numbers, as will non-list >> settings or >> unsetting of >> @code{'page-number-ranges} >> >> >> Limitations: >> - doesn't work for roman page-numbers. >> - only integer page-numbers are supported" >> >> (define (page-numbers ranges) >> ;; get a flat, unfolded list from a list containing ranges of >> integers. >> ;; p.e. '((1) (3 5) (7 10)) -> '(1 3 4 5 7 8 9 10) >> (append-map >> (lambda (e) >> (if (every integer? e) >> (iota (- (last e) (1- (car e))) (car e) 1) >> (ly:error "All elements needs to be integers: ~a" e))) >> >> >> needs --> need >> >> >> ranges)) >> >> >> [snip] >> >> %% >> >> Best, >> David > > > -- > Sent from my Android device with K-9 Mail. Please excuse my brevity. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: [SPAM] Re: Multiple place number skip ranges
Hi Harm, On Sat, May 7, 2016 at 5:52 AM, Thomas Morleywrote: > 2016-05-07 10:53 GMT+02:00 Peter Gentry : > >> Could I sugeest that the range data is input in the individual music file >> rather than the procedure so that the procedure remains >> unchanged for any arrangement of page ranges. It should be a minor addition >> that would make the snippet much more usuable as one of >> the staple includes. >> >> > Hi Peter, > > not sure what you mean, could you elaborate more detailed? > > Anyway, I reworked it > http://lsr.di.unimi.it/LSR/Item?u=1=1036 > Looks great! The comments below make some grammatical corrections. Thanks for doing this! %%% #(define-markup-command (use-page-number-ranges layout props)() "Reads @code{'page-number-ranges} from @var{layout} and transforms it into a flat list of integers. Prints a number-string taken from this list for page-numbering. The values are referenced by the actual page-number. If all elements of this list are consumed, additional pages are numbered consecutive. consecutive --> consecutively An empty list will cause default page-numbers. Same for non-list settings or unsetting of @code{'page-number-ranges} An empty list will cause default page-numbers, as will non-list settings or unsetting of @code{'page-number-ranges} Limitations: - doesn't work for roman page-numbers. - only integer page-numbers are supported" (define (page-numbers ranges) ;; get a flat, unfolded list from a list containing ranges of integers. ;; p.e. '((1) (3 5) (7 10)) -> '(1 3 4 5 7 8 9 10) (append-map (lambda (e) (if (every integer? e) (iota (- (last e) (1- (car e))) (car e) 1) (ly:error "All elements needs to be integers: ~a" e))) needs --> need ranges)) [snip] %% Best, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: [SPAM] Re: Multiple place number skip ranges
2016-05-07 10:53 GMT+02:00 Peter Gentry: > Could I sugeest that the range data is input in the individual music file > rather than the procedure so that the procedure remains > unchanged for any arrangement of page ranges. It should be a minor addition > that would make the snippet much more usuable as one of > the staple includes. > > Hi Peter, not sure what you mean, could you elaborate more detailed? Anyway, I reworked it http://lsr.di.unimi.it/LSR/Item?u=1=1036 Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
Sorry for empty mail. Misclicked :( 2016-05-06 23:53 GMT+02:00 Thomas Morley: > 2016-05-06 2:46 GMT+02:00 Andrew Bernard : >> Hi David and Harm, >> >> Thank you both for your outstanding work on this topic. David’s final cut >> works perfectly for my needs, and your code Thomas is also highly >> illuminating. >> >> I feel sure others will use this. A good candidate for an LSR snippet? It's now http://lsr.di.unimi.it/LSR/Item?u=1=1036 with some minor changes, currently unapproved. Please have a look at wordings, grammer, etc. Any improvement is highly appreciated. I was tempted to tag it "docs", though I doubt we want a 16-pages snippet ... >> Thomas, your my-nmbrs procedure is a glorious example of the sheer beauty of >> Scheme. I had similar, but you get the award for elegant compactness. Such a >> wonderful language. In the snippet I slightly changed it. Now it's really worth of "Such a wonderful language" ;) Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
2016-05-06 2:46 GMT+02:00 Andrew Bernard: > Hi David and Harm, > > Thank you both for your outstanding work on this topic. David’s final cut > works perfectly for my needs, and your code Thomas is also highly > illuminating. > > I feel sure others will use this. A good candidate for an LSR snippet? > > Thomas, your my-nmbrs procedure is a glorious example of the sheer beauty of > Scheme. I had similar, but you get the award for elegant compactness. Such a > wonderful language. > > Andrew > > > > ___ > 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: Multiple place number skip ranges
Hi David and Harm, Thank you both for your outstanding work on this topic. David’s final cut works perfectly for my needs, and your code Thomas is also highly illuminating. I feel sure others will use this. A good candidate for an LSR snippet? Thomas, your my-nmbrs procedure is a glorious example of the sheer beauty of Scheme. I had similar, but you get the award for elegant compactness. Such a wonderful language. Andrew ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
Correction for cases when you have more pages than you specified ranges for: On Thu, May 5, 2016 at 9:18 AM, David Nalesnikwrote: > \version "2.19.30" > > > #(define (my-nmbrs rngs) >(append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) rngs)) > > #(define-markup-command (use-page-number-ranges layout props arg) >(number-list?) >(let ((page-number (chain-assoc-get 'page:page-number props -1))) > (interpret-markup layout props >(if (< page-number (length arg)) >(number->string (list-ref arg (1- page-number))) >(chain-assoc-get 'page:page-number-string props -1) #(define-markup-command (use-page-number-ranges layout props ls) (number-list?) (let ((page-number (chain-assoc-get 'page:page-number props -1)) (len (length ls))) (interpret-markup layout props (number->string (if (< page-number len) (list-ref ls (1- page-number)) (+ page-number (- (last ls) len))) > > \paper { > print-first-page-number = ##t > print-page-number = ##t > oddHeaderMarkup = \markup > \fill-line { > " " > \on-the-fly #not-first-page \fromproperty #'header:instrument > \on-the-fly #print-page-number-check-first \use-page-number-ranges > #(my-nmbrs '((1) (3 5) (7 10))) > } > evenHeaderMarkup = \markup > \fill-line { > \on-the-fly #print-page-number-check-first \use-page-number-ranges > #(my-nmbrs '((1) (3 5) (7 10))) > \on-the-fly #not-first-page \fromproperty #'header:instrument > " " > } > } > > \score { > \new Staff { > \repeat unfold 15 { > s1 > \pageBreak > } > } > } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
On Thu, May 5, 2016 at 10:22 AM, Thomas Morleywrote: > 2016-05-05 16:48 GMT+02:00 David Nalesnik : >> On Thu, May 5, 2016 at 9:30 AM, Thomas Morley >> wrote: >> >>> Bolied down to whats _really_ needed. Far better! >> >> Well, if you say so! There's a bit of stuff in your code that I need >> to come to grips with. For a while now I haven't been able to open >> VirtualBox and get to LilyDev on my Win10 machine, > > A problem with LilyDev or too busy with none-lilypond tasks? Oh, no, I don't blame LilyDev! When I attempt to open Oracle VM VirtualBox to get to LilyDev, I get a spinner, nothing. I probably have to update VirtualBox, but I don't want to do it before I am able to save a copy of all the work I have. I feel a little stupid, but I can't find the files on my system... And, yes, too many other responsibilities have kept me from figuring this out. > >> I haven't kept up >> with new developments (I'm guessing propert-recursive-markup is new?) > > Nope. > It's in fromproperty of 2.16.2 already. > I simply c/p-ed it and did not research what it actually does. Ah, OK! Thanks, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
Hi Harm, On 5/05/2016, 11:53 PM, "Thomas Morley"wrote: >Right now I don't remember such code. Just to refresh my memory, >please provide a link. I don’t have the link but these are the code fragments I collected. By the way, the subject line for this topic was meant to read ‘multiple page number skip ranges’ - but I suppose it’s clear what I meant by now. Andrew — snip % procedures for altering page numbering. % author: David Nalesnik 2013 #(define-markup-command (skip-page-number-range layout props arg) (number-list?) (let ((page-number (chain-assoc-get 'page:page-number props -1))) (interpret-markup layout props (if (>= page-number (car arg)) (number->string (+ page-number (1+ (- (cadr arg) (car arg) (chain-assoc-get 'page:page-number-string props -1) % author: Curt McDowell 2013 % define a list of page numbers to skip % #(define page-number-skip-list '(3 4 7 14)) #(define (pages-less skip-list page offset) (if (null? skip-list) offset (pages-less (cdr skip-list) page (+ offset (if (<= (car skip-list) (+ page offset)) 1 0) #(define-markup-command (page-number-compute layout props) () (let ((page-number (chain-assoc-get 'page:page-number props 0))) (interpret-markup layout props (format "~a" (+ page-number (pages-less page-number-skip-list page-number 0)) — snip ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
2016-05-05 16:48 GMT+02:00 David Nalesnik: > On Thu, May 5, 2016 at 9:30 AM, Thomas Morley > wrote: > >> Bolied down to whats _really_ needed. Far better! > > Well, if you say so! There's a bit of stuff in your code that I need > to come to grips with. For a while now I haven't been able to open > VirtualBox and get to LilyDev on my Win10 machine, A problem with LilyDev or too busy with none-lilypond tasks? > I haven't kept up > with new developments (I'm guessing propert-recursive-markup is new?) Nope. It's in fromproperty of 2.16.2 already. I simply c/p-ed it and did not research what it actually does. Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
On Thu, May 5, 2016 at 9:30 AM, Thomas Morleywrote: > Bolied down to whats _really_ needed. Far better! Well, if you say so! There's a bit of stuff in your code that I need to come to grips with. For a while now I haven't been able to open VirtualBox and get to LilyDev on my Win10 machine, I haven't kept up with new developments (I'm guessing propert-recursive-markup is new?) --David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
2016-05-05 16:18 GMT+02:00 David Nalesnik: > Hi, > > On Thu, May 5, 2016 at 8:53 AM, Thomas Morley > wrote: >> Hi Andrew, >> >> 2016-05-05 5:57 GMT+02:00 Andrew Bernard : >>> David Nalesnik and various others I think have written scheme to allow you >>> to skip a range of numbers when page numbering, or to give a direct list of >>> page numbers to be used. >> >> Right now I don't remember such code. Just to refresh my memory, >> please provide a link. >> >>> I want to be able to specify something like this >>> list to only have the specified ranges printed, all in one continous score >>> (yes, there is a use case for this!). >>> >>> ((1 24) (52 64) (70 80) (100 110)) >>> >>> Of course, alternatively you could have list of ranges to skip rather than >>> include. >> >> >> How about: >> >> \version "2.19.36" >> >> #(define-markup-command >> (page-range-fromproperty layout props page-ranges symbol) >> (list? symbol?) >> >> (define (my-nmbrs rngs) >> (append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) >> rngs)) >> >> (let ((m (chain-assoc-get symbol props)) >> (page-nmbr (chain-assoc-get 'page:page-number props -1))) >> (if (markup? m) >> ;; prevent infinite loops by clearing the interpreted property: >> (interpret-markup >> layout >> (cons >> (list (cons symbol `(,property-recursive-markup ,symbol))) >> props) >> (if (and (string? m) >>(number? (string->number m)) >>(= (string->number m) page-nmbr)) >> (format #f "~a" >> (let ((my-ranges (my-nmbrs page-ranges))) >> ;; if entries from `page-ranges' are done, fall back to >> ;; usual page-numbering >> (if (> (length my-ranges) (1- page-nmbr)) >> (list-ref my-ranges (1- page-nmbr)) >> page-nmbr))) >>m)) >> empty-stencil))) >> >> #(define ranges '((1 24) (52 64) (70 80) (100 110))) >> >> \paper { >> oddHeaderMarkup = \markup >> \fill-line { >> "" >> \on-the-fly #not-part-first-page \fromproperty #'header:instrument >> \on-the-fly #print-page-number-check-first >> \page-range-fromproperty #ranges #'page:page-number-string >> } >> >> %% evenHeaderMarkup would inherit the value of >> %% oddHeaderMarkup if it were not defined here >> evenHeaderMarkup = \markup >> \fill-line { >> \on-the-fly #print-page-number-check-first >> \page-range-fromproperty #ranges #'page:page-number-string >> \on-the-fly #not-part-first-page \fromproperty #'header:instrument >> "" >> } >> } >> >> >> \new Staff \repeat unfold 70 { c''1 \pageBreak } >> > > The reference is to > http://www.mail-archive.com/lilypond-user%40gnu.org/msg85967.html, > which I've adapted below to number the given ranges rather than what's > excluded. > > Harm, your mail just came through, so I borrowed your my-nmbrs :) :) > For what it's worth:: > > \version "2.19.30" > > > #(define (my-nmbrs rngs) >(append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) rngs)) Bolied down to whats _really_ needed. Far better! > #(define-markup-command (use-page-number-ranges layout props arg) >(number-list?) >(let ((page-number (chain-assoc-get 'page:page-number props -1))) > (interpret-markup layout props >(if (< page-number (length arg)) >(number->string (list-ref arg (1- page-number))) >(chain-assoc-get 'page:page-number-string props -1) > > \paper { > print-first-page-number = ##t > print-page-number = ##t > oddHeaderMarkup = \markup > \fill-line { > " " > \on-the-fly #not-first-page \fromproperty #'header:instrument > \on-the-fly #print-page-number-check-first \use-page-number-ranges > #(my-nmbrs '((1) (3 5) (7 10))) > } > evenHeaderMarkup = \markup > \fill-line { > \on-the-fly #print-page-number-check-first \use-page-number-ranges > #(my-nmbrs '((1) (3 5) (7 10))) > \on-the-fly #not-first-page \fromproperty #'header:instrument > " " > } > } > > \score { > \new Staff { > \repeat unfold 15 { > s1 > \pageBreak > } > } > } Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
Hi, On Thu, May 5, 2016 at 8:53 AM, Thomas Morleywrote: > Hi Andrew, > > 2016-05-05 5:57 GMT+02:00 Andrew Bernard : >> David Nalesnik and various others I think have written scheme to allow you >> to skip a range of numbers when page numbering, or to give a direct list of >> page numbers to be used. > > Right now I don't remember such code. Just to refresh my memory, > please provide a link. > >> I want to be able to specify something like this >> list to only have the specified ranges printed, all in one continous score >> (yes, there is a use case for this!). >> >> ((1 24) (52 64) (70 80) (100 110)) >> >> Of course, alternatively you could have list of ranges to skip rather than >> include. > > > How about: > > \version "2.19.36" > > #(define-markup-command > (page-range-fromproperty layout props page-ranges symbol) > (list? symbol?) > > (define (my-nmbrs rngs) > (append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) > rngs)) > > (let ((m (chain-assoc-get symbol props)) > (page-nmbr (chain-assoc-get 'page:page-number props -1))) > (if (markup? m) > ;; prevent infinite loops by clearing the interpreted property: > (interpret-markup > layout > (cons > (list (cons symbol `(,property-recursive-markup ,symbol))) > props) > (if (and (string? m) >(number? (string->number m)) >(= (string->number m) page-nmbr)) > (format #f "~a" > (let ((my-ranges (my-nmbrs page-ranges))) > ;; if entries from `page-ranges' are done, fall back to > ;; usual page-numbering > (if (> (length my-ranges) (1- page-nmbr)) > (list-ref my-ranges (1- page-nmbr)) > page-nmbr))) >m)) > empty-stencil))) > > #(define ranges '((1 24) (52 64) (70 80) (100 110))) > > \paper { > oddHeaderMarkup = \markup > \fill-line { > "" > \on-the-fly #not-part-first-page \fromproperty #'header:instrument > \on-the-fly #print-page-number-check-first > \page-range-fromproperty #ranges #'page:page-number-string > } > > %% evenHeaderMarkup would inherit the value of > %% oddHeaderMarkup if it were not defined here > evenHeaderMarkup = \markup > \fill-line { > \on-the-fly #print-page-number-check-first > \page-range-fromproperty #ranges #'page:page-number-string > \on-the-fly #not-part-first-page \fromproperty #'header:instrument > "" > } > } > > > \new Staff \repeat unfold 70 { c''1 \pageBreak } > The reference is to http://www.mail-archive.com/lilypond-user%40gnu.org/msg85967.html, which I've adapted below to number the given ranges rather than what's excluded. Harm, your mail just came through, so I borrowed your my-nmbrs :) For what it's worth:: \version "2.19.30" #(define (my-nmbrs rngs) (append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) rngs)) #(define-markup-command (use-page-number-ranges layout props arg) (number-list?) (let ((page-number (chain-assoc-get 'page:page-number props -1))) (interpret-markup layout props (if (< page-number (length arg)) (number->string (list-ref arg (1- page-number))) (chain-assoc-get 'page:page-number-string props -1) \paper { print-first-page-number = ##t print-page-number = ##t oddHeaderMarkup = \markup \fill-line { " " \on-the-fly #not-first-page \fromproperty #'header:instrument \on-the-fly #print-page-number-check-first \use-page-number-ranges #(my-nmbrs '((1) (3 5) (7 10))) } evenHeaderMarkup = \markup \fill-line { \on-the-fly #print-page-number-check-first \use-page-number-ranges #(my-nmbrs '((1) (3 5) (7 10))) \on-the-fly #not-first-page \fromproperty #'header:instrument " " } } \score { \new Staff { \repeat unfold 15 { s1 \pageBreak } } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
2016-05-05 15:53 GMT+02:00 Thomas Morley: > Hi Andrew, > > 2016-05-05 5:57 GMT+02:00 Andrew Bernard : >> David Nalesnik and various others I think have written scheme to allow you >> to skip a range of numbers when page numbering, or to give a direct list of >> page numbers to be used. > > Right now I don't remember such code. Just to refresh my memory, > please provide a link. > >> I want to be able to specify something like this >> list to only have the specified ranges printed, all in one continous score >> (yes, there is a use case for this!). >> >> ((1 24) (52 64) (70 80) (100 110)) >> >> Of course, alternatively you could have list of ranges to skip rather than >> include. > > > How about: > > \version "2.19.36" > > #(define-markup-command > (page-range-fromproperty layout props page-ranges symbol) > (list? symbol?) > > (define (my-nmbrs rngs) > (append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) > rngs)) > > (let ((m (chain-assoc-get symbol props)) > (page-nmbr (chain-assoc-get 'page:page-number props -1))) > (if (markup? m) > ;; prevent infinite loops by clearing the interpreted property: > (interpret-markup > layout > (cons > (list (cons symbol `(,property-recursive-markup ,symbol))) > props) > (if (and (string? m) >(number? (string->number m)) >(= (string->number m) page-nmbr)) > (format #f "~a" > (let ((my-ranges (my-nmbrs page-ranges))) > ;; if entries from `page-ranges' are done, fall back to > ;; usual page-numbering > (if (> (length my-ranges) (1- page-nmbr)) > (list-ref my-ranges (1- page-nmbr)) > page-nmbr))) >m)) > empty-stencil))) > > #(define ranges '((1 24) (52 64) (70 80) (100 110))) > > \paper { > oddHeaderMarkup = \markup > \fill-line { > "" > \on-the-fly #not-part-first-page \fromproperty #'header:instrument > \on-the-fly #print-page-number-check-first > \page-range-fromproperty #ranges #'page:page-number-string > } > > %% evenHeaderMarkup would inherit the value of > %% oddHeaderMarkup if it were not defined here > evenHeaderMarkup = \markup > \fill-line { > \on-the-fly #print-page-number-check-first > \page-range-fromproperty #ranges #'page:page-number-string > \on-the-fly #not-part-first-page \fromproperty #'header:instrument > "" > } > } > > > \new Staff \repeat unfold 70 { c''1 \pageBreak } > > > HTH, > Harm Limitation: doesn't work with: page-number-type = #'roman-upper Could probably be made working. You need that? Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
Hi Andrew, 2016-05-05 5:57 GMT+02:00 Andrew Bernard: > David Nalesnik and various others I think have written scheme to allow you > to skip a range of numbers when page numbering, or to give a direct list of > page numbers to be used. Right now I don't remember such code. Just to refresh my memory, please provide a link. > I want to be able to specify something like this > list to only have the specified ranges printed, all in one continous score > (yes, there is a use case for this!). > > ((1 24) (52 64) (70 80) (100 110)) > > Of course, alternatively you could have list of ranges to skip rather than > include. How about: \version "2.19.36" #(define-markup-command (page-range-fromproperty layout props page-ranges symbol) (list? symbol?) (define (my-nmbrs rngs) (append-map (lambda (e) (iota (- (last e) (- (car e) 1)) (car e) 1)) rngs)) (let ((m (chain-assoc-get symbol props)) (page-nmbr (chain-assoc-get 'page:page-number props -1))) (if (markup? m) ;; prevent infinite loops by clearing the interpreted property: (interpret-markup layout (cons (list (cons symbol `(,property-recursive-markup ,symbol))) props) (if (and (string? m) (number? (string->number m)) (= (string->number m) page-nmbr)) (format #f "~a" (let ((my-ranges (my-nmbrs page-ranges))) ;; if entries from `page-ranges' are done, fall back to ;; usual page-numbering (if (> (length my-ranges) (1- page-nmbr)) (list-ref my-ranges (1- page-nmbr)) page-nmbr))) m)) empty-stencil))) #(define ranges '((1 24) (52 64) (70 80) (100 110))) \paper { oddHeaderMarkup = \markup \fill-line { "" \on-the-fly #not-part-first-page \fromproperty #'header:instrument \on-the-fly #print-page-number-check-first \page-range-fromproperty #ranges #'page:page-number-string } %% evenHeaderMarkup would inherit the value of %% oddHeaderMarkup if it were not defined here evenHeaderMarkup = \markup \fill-line { \on-the-fly #print-page-number-check-first \page-range-fromproperty #ranges #'page:page-number-string \on-the-fly #not-part-first-page \fromproperty #'header:instrument "" } } \new Staff \repeat unfold 70 { c''1 \pageBreak } HTH, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple place number skip ranges
On Thu 05 May 2016 at 13:57:33 (+1000), Andrew Bernard wrote: > David Nalesnik and various others I think have written scheme to allow you to > skip a range of numbers when page numbering, or to give a direct list of page > numbers to be used. I want to be able to specify something like this list to > only have the specified ranges printed, all in one continous score (yes, > there is a use case for this!). > > ((1 24) (52 64) (70 80) (100 110)) > > Of course, alternatively you could have list of ranges to skip rather than > include. > > Has anybody written something like this? > > I case people are wondering, it’s for writing a score where the work is > incomplete, but the composer needs the page numbers of the completed sections > to correspond to the actual page numbers in his MS. I can’t use bookparts or > similar as the score sections start and stop midpage generally, not at > logical page breaks. Nope. I can only suggest a workaround. \pageBreak % skips to the next page... \markup { " " } \pageBreak % ...and that leaves a page blank (except the page number). Skip all the pages you haven't yet written using that construction. Run LP. Then $ pdftk output-file.pdf burst will give you a set of files called pg_0001.pdf, pg_0002.pdf etc. The empty pages will be fairly obvious from the file sizes even without opening them. Delete them manually or otherwise. Then $ pdftk pg_*.pdf cat output decimated-output.pdf will concatenate the remaining pages into a single file. AFAICT the pdftk version distributed with linux (Debian) does everything advertised for PDFtkPro on its webpage (though the encryption is explained wrongly on the man page). Cheers, David. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Multiple place number skip ranges
David Nalesnik and various others I think have written scheme to allow you to skip a range of numbers when page numbering, or to give a direct list of page numbers to be used. I want to be able to specify something like this list to only have the specified ranges printed, all in one continous score (yes, there is a use case for this!). ((1 24) (52 64) (70 80) (100 110)) Of course, alternatively you could have list of ranges to skip rather than include. Has anybody written something like this? I case people are wondering, it’s for writing a score where the work is incomplete, but the composer needs the page numbers of the completed sections to correspond to the actual page numbers in his MS. I can’t use bookparts or similar as the score sections start and stop midpage generally, not at logical page breaks. Andrew ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user