Valentin,

You're quite right. Sorry about my previous response, I read it after a
long and frustrating night of typesetting with a deadline close at hand,
and was just frustrated that there was no ready-made solution that my
non-programmer mind could instantly grasp.

But I got a good night's sleep, 'manned-up,' and put your solution into
practice, which - of course - worked just fine. Thank you.

Brent.

On Sun, 25 Sept 2022 at 17:54, Valentin Petzel <valen...@petzel.at> wrote:

> Hi Brent,
>
> this is exactly what my suggestion does. There are of course multiple ways
> of achieving things. You could give the toc Items labels and then order
> them by these labels.
>
> But my suggestion simply delays interpretation of \tocItem to the point
> where you need it, by using a function (code is executed while calling the
> function) instead of a macro (code is executed while parsing).
>
> Cheers,
> Valentin
>
> 24.09.2022 18:52:12 Brent Annable <brentanna...@gmail.com>:
>
> Hey Valentin,
>
> Thanks so much for the reply, but I have to say I don't understand your
> suggestion at all. Isn't there a way for me to put in the tocItems so that
> when I move the scores in the master file, they all just reorder as they
> should?
>
> Brent.
>
> On Sat, 24 Sep 2022, 11:41 pm Valentin Petzel, <valen...@petzel.at>
> wrote:
>
>> Hi Brent,
>>
>> you could simply delay the execution of your code until the point where
>> you need it like this:
>>
>> bpI =
>> #(define-scheme-function (parser location) ()
>>         #{
>>                 \bookpart {
>>                         \tocItem "toc1" "a"
>>                         { c' }
>>                 }
>>         #})
>>
>> bpII =
>> #(define-scheme-function (parser location) ()
>>         #{
>>                 \bookpart {
>>                         \tocItem "toc2" "b"
>>                         { d' }
>>                 }
>>         #})
>>
>> \markuplist \table-of-contents
>>
>> $(bpII)
>> $(bpI)
>>
>> (Sorry for the mess, I'm writing from my phone.)
>>
>> Cheers,
>> Valentin
>>
>> 24.09.2022 13:36:04 Brent Annable <brentanna...@gmail.com>:
>>
>> Hi all,
>>
>> I'm creating a book of music using a master file where I call on
>> \bookpart variables from lots of different files, which are included in the
>> master file using the \include function. I have a list of included files in
>> a separate file, and the master just includes that one file.
>>
>> I want to create a table of contents at the beginning of the book, so I
>> need to add a \tocItem to each score. The only place I have found where
>> that works is inside the \bookpart variable in each individual file, before
>> the score. So in my master file, each score entry looks like this:
>>
>> \bookpart { \myBookPart }
>>
>> And the variables in the individual files look like this:
>>
>> myBookPart = \bookpart {  \tocItem \markup "Name of song"
>> {c1 c1 c1 c1}
>> }
>>
>> I'm currently putting all the separate scores into the master file, and I
>> plan to shuffle them around later to get the ordering right.
>>
>> I've noticed that when the table of contents is generated, the items are
>> always listed *in the order in which the files are \included*, not the
>> order in which the scores actually appear in the book. So even though the
>> page numbers are correct, the TOC lists the songs in the order in which I
>> include the files in the \include file. When I start shifting things around
>> later in the master, I really don't want to have to re-order the \include
>> list as well, that will be double the work.
>>
>> I've attached some files that replicate my problem. One thing I noticed
>> that the master wouldn't compile at all when the version number was set to
>> 2.22.1, it only worked when I set it to 2.19.65, the version number in all
>> the files I'm using. Does that mean I'm using incorrect syntax for the TOC?
>>
>> Otherwise, is there anywhere else I can put the \tocItem command so that
>> the items are automatically re-ordered when I switch them around in the
>> master file?
>>
>> Sorry for the voluminous email and thanks for any help,
>>
>> Brent.
>>
>>
>>

Reply via email to