lilypond-user
[Top][All Lists]
Advanced

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

Re: Make TOC entries available to LaTeX


From: Thomas Morley
Subject: Re: Make TOC entries available to LaTeX
Date: Thu, 26 Apr 2018 22:52:37 +0200

2018-04-25 23:13 GMT+02:00 Thomas Morley <address@hidden>:

>> 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



reply via email to

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