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.
> That markup is inserted into titles upon edit is annoying. Actually,
> it 
> is added over and over so that it is present multiple times after 
> several edits if not deleted manually. What is the reason for this 
> strange behaviour?

Overly compact coding on my part I'm afraid. I managed to prevent the
insertion of \line {...} in the case where the title is just on one
line, but \column is still inserted.
I think the problem is worse than you think - even if you manually
delete the markup the Toc shows it. You have delete the simple titles
of the movement altogether and re-do them :(

Richard


> 
> Andreas
> 
> 
> Am 13.10.25 um 18:33 schrieb Richard Shann:
> > On Mon, 2025-10-13 at 10:50 +0100, Richard Shann wrote:
> > > On Mon, 2025-10-13 at 10:25 +0100, Richard Shann wrote:
> > > > On Sun, 2025-10-12 at 17:50 +0200, Andreas Schneider wrote:
> > > > > I would like to create a table of contents from the (simple)
> > > > > titles
> > > > > of
> > > > > all movements in a score. That is, I would like Denemo to
> > > > > generate
> > > > > Lilypond output similar to the one in attached file. How can
> > > > > I
> > > > > accomplish that?
> > > > 
> > > > Does this do what you want?
> > > 
> > > That version only did single word titles :( it needs quotes:
> > > 
> > > %8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
> > > (d-PushPosition)
> > > (while (d-PreviousMovement))
> > > (let ((tag "SimpleToc"))
> > >          (let loop ()
> > >                  (define title (d-DirectiveGet-header-data
> > > "MTitles"))
> > >                  (if title
> > >                          (begin
> > >                                  (set! title (assq-ref (eval-
> > > string
> > > title) 'title))
> > >                                  (if title
> > >                                          (begin
> > >                                                  (d-DirectivePut-
> > > score-prefix tag "\\markuplist \\table-of-contents\n")
> > >                                                  (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)
> > > %8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><
> > 
> > Unfortunately, although this works for movement titles that have
> > never
> > been edited, it falls down if they are edited because the editing
> > introduces markup into the titles - at the moment there is no way
> > around that (you have to delete the Movement Titles directive and
> > start
> > again).
> > 
> > Richard
> > 
> > 
> > > 
> > > Richard
> > > 
> > > > 
> > > > %8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8>
> > > > <
> > > > (d-PushPosition)
> > > > (while (d-PreviousMovement))
> > > > (let ((tag "SimpleToc"))
> > > >          (let loop ()
> > > >                  (define title (d-DirectiveGet-header-data
> > > > "MTitles"))
> > > >                  (if title
> > > >                          (begin
> > > >                                  (set! title (assq-ref (eval-
> > > > string
> > > > title) 'title))
> > > >                                  (if title
> > > >                                          (begin
> > > >                                                  (d-
> > > > DirectivePut-
> > > > score-prefix tag "\\markuplist \\table-of-contents\n")
> > > >                                                  (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)
> > > > 
> > > > %8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8><8>
> > > > <
> > > > 
> > > > Richard
> > > > 
> > > > 
> > > > > 
> > > > > Andreas
> > > > 
> > > > 
> > > 
> > 
> 

Reply via email to