2018-04-25 23:13 GMT+02:00 Thomas Morley <[email protected]>:
>> There's only one issue: The TOC will create wrong entries when LilyPond's
>> first page number is not 1. So there should actually be an offset in place.
>> How can I read the value of the first-page-number variable to set up this
>> offset?
>
> page-post-process has the layout-variable.
> (ly:output-def-lookup layout 'first-page-number) should do the trick.
Rethinking this ...
With the code above you'll catch the first-page-number of the
book_part_ not the entire book.
You need to find the topmost parent layout and look for first-page-number there:
%% slightly changed `book-first-page' from define-markup-comands
#(define-public (get-book-first-page layout)
"Return the @code{'first-page-number} of the entire book"
(define (ancestor layout)
"Return the topmost layout ancestor"
(let ((parent (ly:output-def-parent layout)))
(if (not (ly:output-def? parent))
layout
(ancestor parent))))
(ly:output-def-lookup (ancestor layout) 'first-page-number))
Cheers,
Harm
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user