[ << General input and output ] | [Top][Contents][Index][ ? ] | [ Spacing issues >> ] | ||
[ < Reference to page numbers ] | [ Up : Titles and headers ] | [ Working with input files > ] |
3.2.5 Table of contents
A table of contents is included using the \markuplist \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.
\markuplist \table-of-contents \pageBreak \tocItem \markup "First score" \score { { c'4 % ... \tocItem \markup "Some particular point in the first score" d'4 % ... } } \tocItem \markup "Second score" \score { { e'4 % ... } }
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 larger font size tocItemMarkup = \markup \large \fill-line { \fromproperty #'toc:text \fromproperty #'toc:page } }
Note how the toc element text and page number are referred to in
the tocItemMarkup
definition.
New commands and markups may also be defined to build more elaborated table of contents:
- first, define a new markup variable in the
\paper
block - then, define a music function which aims at adding a toc element using this markup paper variable.
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))
Dots can be added to fill the line between an item and its page number:
\header { tagline = ##f } \paper { tocItemMarkup = \tocItemWithDotsMarkup } \book { \markuplist \table-of-contents \tocItem \markup { Allegro } \tocItem \markup { Largo } \markup \null }
See also
Installed Files: ‘ly/toc-init.ly’.
Predefined commands
[ << General input and output ] | [Top][Contents][Index][ ? ] | [ Spacing issues >> ] | ||
[ < Reference to page numbers ] | [ Up : Titles and headers ] | [ Working with input files > ] |
Other languages: deutsch, español, français, italiano, 日本語.
About automatic language selection.