[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem to code page-numbers
From: |
Thomas Morley |
Subject: |
Re: problem to code page-numbers |
Date: |
Sun, 16 Aug 2015 16:34:46 +0200 |
2015-08-15 18:13 GMT+02:00 David Kastrup <address@hidden>:
> 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
I had difficulties to understand how and why this works.
There is nothing further in our docs or .scm-files.
I had to git grep for `page-post-process'
Meanwhile I've found
http://lilypond.1069038.n5.nabble.com/Writing-out-a-table-of-contents-to-a-file-td117759.html#a117764
which probably has lead to the entry in Usage-manual.
Up to now I can't see how it coud help, but I'll investgate further.
Thanks for the hint,
Harm
Re: problem to code page-numbers, Jan-Peter Voigt, 2015/08/14