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.
\version "2.19.65"


\include "SongThree.ly"
\include "SongTwo.ly"
\include "SongOne.ly"


\book {
  
\bookpart {\markuplist \table-of-contents}
  \pageBreak
  
\bookpart { \scoreOne }
\bookpart { \scoreTwo }
\bookpart { \scoreThree }
}
\version "2.19.65"

scoreTwo =  \bookpart { \tocItem \markup "Song number two"
             \score { \relative c' {e1 e e e} }
             
             
}
             
\version "2.19.65"

scoreThree =  \bookpart { \tocItem \markup "Song number three"
             \score { \relative c'' {g1 g g g} }
             
             
}
             
\version "2.19.65"

scoreOne =  \bookpart { \tocItem \markup "Song number one"
             \score { \relative c' {c1 c c c} }
}

Attachment: master.pdf
Description: Adobe PDF document

Reply via email to