\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'' }