lilypond-user
[Top][All Lists]
Advanced

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

Re: problem to code page-numbers


From: David Kastrup
Subject: Re: problem to code page-numbers
Date: Sat, 15 Aug 2015 18:13:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> Finally I want to be able to set every bookparts first-page-numbers
> indepent and solve the request here:
> http://lists.gnu.org/archive/html/lilypond-user/2015-08/msg00237.html
>
> As far as I know, we have no mechnism for it implemented.

Looking around for information, I was rather startled by finding in the
_Usage_ manual the following stuff:

@subsubheading Exporting the ToC from LilyPond

This assumes that your score has multiple movements in the same lilypond
output file.

@smallexample
#(define (oly:create-toc-file layout pages)
  (let* ((label-table (ly:output-def-lookup layout 'label-page-table)))
    (if (not (null? label-table))
      (let* ((format-line (lambda (toc-item)
             (let* ((label (car toc-item))
                    (text  (caddr toc-item))
                    (label-page (and (list? label-table)
                                     (assoc label label-table)))
                    (page (and label-page (cdr label-page))))
               (format #f "~a, section, 1, @address@hidden, ~a" page text 
label))))
             (formatted-toc-items (map format-line (toc-items)))
             (whole-string (string-join formatted-toc-items ",\n"))
             (output-name (ly:parser-output-name))
             (outfilename (format "~a.toc" output-name))
             (outfile (open-output-file outfilename)))
        (if (output-port? outfile)
            (display whole-string outfile)
            (ly:warning (_ "Unable to open output file ~a for the TOC 
information") outfilename))
        (close-output-port outfile)))))

\paper @{
  #(define (page-post-process layout pages) (oly:create-toc-file layout pages))
@}
@end smallexample

Now I don't really have much of an overview here, but I suspect that
using similar hooks (like page-post-process) might work for your use
case.

-- 
David Kastrup



reply via email to

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