lilypond-user
[Top][All Lists]
Advanced

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

Re: [SPAM] Re: Multiple place number skip ranges


From: David Nalesnik
Subject: Re: [SPAM] Re: Multiple place number skip ranges
Date: Sat, 7 May 2016 08:17:30 -0500

Hi Harm,

On Sat, May 7, 2016 at 5:52 AM, Thomas Morley <address@hidden> wrote:
> 2016-05-07 10:53 GMT+02:00 Peter Gentry <address@hidden>:
>
>> 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&id=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



reply via email to

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