Hi Urs,

the OLY way is the way to go, but for inspiration I share my little hack that was doing its job quite well on short notice.
Jan-Peter

Am 19.04.2018 um 23:23 schrieb Thomas Morley:
2018-04-19 16:19 GMT+02:00 Urs Liska <li...@openlilylib.org>:
Hi all,

I'm preparing an automated edition process using LuaLaTeX, Pandoc and
LilyPond.

After some experimentation I have come to the conclusion that I'll have to
insert the multi-movement score as a single PDF created by LilyPond (but
through lyluatex to make use of caching and the layout mechanics).

I first had used lyluatex's facility to include the score's system by system
and print all the titles with LaTeX, but this didn't work out - for the
first time I realized that lilypond-book-preamble.ly makes the vertical
staff-staff spacing as tight as possible, which often makes the page layout
pretty bad. Creating the movements separately is not an option either
because not all movements will start on a new page.

So now I have included a multi-movement score in the LaTeX document and
don't know how to add TOC entries (in LaTeX) for the movements. I can see
two possible ways, but don't know if they are really possible and if so how
to approach them:

Is it possible to insert something in the PDF output that LaTeX can pick up
as TOC entries?
(actually I doubt this is possible, but since it would be the easiest way I
thought I'd ask anyway)
Can I reliably retrieve the current page number of a given score's title
block?
With that information I could write them to a log file and read that later
in LaTeX.

TIA
Urs

PS: I don't know if it matters but the file is produced using
ly:book-process etc.


Doesn't
http://lilypond.org/doc/v2.19/Documentation/usage-big-page#sharing-the-table-of-contents
do what you want?

Cheers,
   Harm

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

\version "2.19.80"

#(define-markup-command (export-toc layout props file)(string?)
   (let* ((gauge-stencil (interpret-markup layout props ""))
          (x-ext (ly:stencil-extent gauge-stencil X))
          (y-ext (ly:stencil-extent gauge-stencil Y)))

     ; produce delayed stencil
     (ly:make-stencil
      `(delay-stencil-evaluation
        ,(delay (ly:stencil-expr ; this will be run, when all pages are calculated
                  (let ((table (ly:output-def-lookup layout 'label-page-table)))
                    (with-output-to-file file
                      (lambda ()
                        (display "Seite\tTitel\r\n--------------------------------------------\r\n")
                        (for-each (lambda (toc-item)
                                    (format #t "~A\t~A\r\n"
                                      (if (list? table) (assoc-get (car toc-item) table) "???")
                                      (markup->string (caddr toc-item))
                                      )) (toc-items))
                        ))
                    empty-stencil)
                  )))
      x-ext y-ext)
     ))
exportTocMarkup = #(define-scheme-function ()()
                     #{
                       \markup \export-toc #(format "~A.inhalt.txt" (ly:parser-output-name))
                     #})


\header {
  title = \markup { Hallo Welt! \exportTocMarkup }
}
\tocItem "Hallo Welt!"
\relative { c'' }
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to