Previous: Reference to page numbers, Up: Titles and headers
A table of contents is included using the \markuplines \table-of-contents
command. The elements which should appear in the table of contents are
entered with the \tocItem command, which may be used either at
top-level, or inside a music expression.
\markuplines \table-of-contents
\pageBreak
\tocItem \markup "First score"
\score {
{
c' % ...
\tocItem \markup "Some particular point in the first score"
d' % ...
}
}
\tocItem \markup "Second score"
\score {
{
e' % ...
}
}
The markups which are used to format the table of contents are defined
in the \paper block. The default ones are tocTitleMarkup,
for formatting the title of the table, and tocItemMarkup, for
formatting the toc elements, composed of the element title and page
number. These variables may be changed by the user:
\paper {
%% Translate the toc title into French:
tocTitleMarkup = \markup \huge \column {
\fill-line { \null "Table des matières" \null }
\hspace #1
}
%% use larfer font size
tocItemMarkup = \markup \large \fill-line {
\fromproperty #'toc:text \fromproperty #'toc:page
}
}
Note how the toc element text and page number are refered to in
the tocItemMarkup definition.
New commands and markups may also be defined to build more elaborated table of contents:
\paper block
In the following example, a new style is defined for entering act names in the table of contents of an opera:
\paper {
tocActMarkup = \markup \large \column {
\hspace #1
\fill-line { \null \italic \fromproperty #'toc:text \null }
\hspace #1
}
}
tocAct =
#(define-music-function (parser location text) (markup?)
(add-toc-item! 'tocActMarkup text))
Init files: ly/toc-init.ly.
Previous: Reference to page numbers, Up: Titles and headers
This page is for LilyPond-2.11.28 (development-branch).
Report errors to http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs.
Your suggestions for the documentation are welcome.