On Tue, 2025-10-14 at 19:43 +0200, Andreas Schneider wrote:
> Am 14.10.25 um 10:49 schrieb Richard Shann:
> > On Mon, 2025-10-13 at 19:12 +0200, Andreas Schneider wrote:
> > > Thank you very much, this creates basically what I need. Only a
> > > slight
> > > inconvenience is that I need to re-run the script every time I
> > > change
> > > a
> > > title.
> > I recall that having an attribute "dynamic" that was supposed to
> > trigger recalculations, but I'm not sure that went anywhere. There
> > are
> > a number of such things - Upbeat for example...
> > > That markup is inserted into titles upon edit is annoying.
> > So here is a fix for the toc:
> >
> > [...]
>
> Unfortunately, I get a script error:
You have omitted the first line of the script
(use-modules (ice-9 string-fun))
that module provides the function needed.
I notice that the Toc fits the width of the page - I would imagine you
would like it adjustable so that the title and page number aren't too
far apart. Do you know the needed syntax to achieve this?
Richard
>
> A script error for file/script (use-modules (ice-
> 9
> string-fun))
> (d-PushPosition)
> (while (d-PreviousMovement))
>
> (let ((tag "SimpleToc"))
> (d-DirectivePut-paper-postfix tag
> "tocItemMarkup =
> \\tocItemWithDotsMarkup")
> (d-DirectivePut-score-prefix tag
> "\\markuplist
> \\table-of-contents\n")
> (let loop ()
> (define title (d-DirectiveGet-header-
> data "MTitles"))
> (if title
> (begin
> (set! title (assq-ref
> (eval-string title) 'title))
> (if title
> (begin
> (set!
> title (string-replace-substring title
> "\\column{" ""))
> (set!
> title (string-replace-substring title
> "\\line{" ""))
> (set!
> title (string-replace-substring title
> "}" ""))
> (d-
> DirectivePut-movementcontrol-prefix tag
> (string-append "\\tocItem \\markup \"" title "\"\n")))
> (d-
> WarningDialog (_ "No title for this
> movement"))))
> (d-WarningDialog (_ "No
> (simple) titles for this
> movement")))
> (if (d-NextMovement)
> (loop))))
> (d-PopPosition)
> ; the throw arguments are
>
> (#f Unbound variable: ~S (string-replace-substring) #f)
>
> What does work is to advanced-edit the movement titles and delete the
> markup in postfix and scheme data.
>
> Andreas
>
>