@end ignore
+@item
+Particular points of a book may be marked with the @code{\label}
+command. Then, the page where these points are placed can be refered to
+using the @code{\page-ref} markup command.
+
@item
Page breaking and page turning commands (@code{\pageBreak},
@code{\noPageBreak}, etc) can be used at top-level, between scores and
@menu
* Creating titles::
* Custom titles::
+* Table of contents::
@end menu
}
@end verbatim
+@node Table of contents
+@subsection Table of contents
+A particular place of a score can be marked using the @code{\label}
+command, either at top-level or inside music. This label can then be
+refered to in a markup, to get the number of the page where the marked
+point is placed, using the @code{\page-ref} markup command.
+
+@verbatim
+\score {
+ {
+ c'1
+ \mark A \label #'markA
+ c'
+ }
+} \label #'firstScore
+
+\markup { The first score is on page \page-ref #'firstScore "0" "?" }
+\markup { Mark A is on page \page-ref #'markA "0" "?" }
+@end verbatim
+
+The @code{\page-ref} markup command takes three arguments:
+@enumerate
+@item the label, a scheme symbol, eg. #'firstScore
+@item a markup that will be used as a gauge to estimate the dimensions
+of the markup
+@item a markup that will be used if the label is not known
+@end enumerate
+
+The reason why a gauge is needed is that, at the time markups are
+interpreted, the page breaking has not yet occured, so the page numbers
+are not yet known. To work around this issue, the actual markup
+interpretation is delayed to a later time; however, the dimensions of
+the markup have to be known before, so a gauge is used to decide these
+dimensions. If the book has between 10 and 99 pages, it may be "00",
+ie. a two digit number.
+
+@code{\label} and @code{\page-ref} can be used to build a table of contents:
+
+@verbatim
+#(set-default-paper-size "a6")
+
+#(define-markup-command (toc-line layout props label text) (symbol? markup?)
+ (interpret-markup layout props
+ (markup #:fill-line (text #:page-ref label "8" "?"))))
+
+\markup \column {
+ \large \fill-line { \null "Table of contents" \null }
+ \hspace #1
+ \toc-line #'toc "Table of contents"
+ \toc-line #'scoreI "First Score"
+ \toc-line #'markA \line { \hspace #3 Mark A }
+ \toc-line #'scoreII "Second Score"
+} \label #'toc
+
+\pageBreak
+
+\score {
+ {
+ c'1 \break
+ \mark A \label #'markA
+ c'1
+ }
+ \header { piece = "First score" }
+} \label #'scoreI
+
+\pageBreak
+
+\score {
+ { d' }
+ \header { piece = "Second score" }
+} \label #'scoreII
+@end verbatim
+
+In this example, a @code{\toc-line} markup command is defined to build
+the table of content items. As this example has less than 10 pages, the
+gauge used by @code{\page-ref} has a single digit.
+
+@refcommands
+
+@funindex \label
+@code{\label}
+@funindex \page-ref
+@code{\page-ref}
@node MIDI output
@section MIDI output
-\version "2.11.24"
+\version "2.11.25"
\header {
texidoc = "Page labels may be placed inside music or at top-level,
for (vsize i = 0 ; i < label_events_.size () ; i ++)
{
- SCM label = label_events_[i]->get_property ("label");
+ SCM label = label_events_[i]->get_property ("page-label");
SCM labels = command_column_->get_property ("labels");
command_column_->set_property ("labels", scm_cons (label, labels));
}
/* properties */
"between-cols "
"bounded-by-me "
- "grace-spacing "
+ "grace-spacing "
+ "labels "
"line-break-system-details "
"line-break-penalty "
"line-break-permission "
(_i "Place a bookmarking label, either at top-level or inside music.")
(make-music 'EventChord
'page-marker #t
- 'label label
+ 'page-label label
'elements (list (make-music 'LabelEvent
- 'label label))))
+ 'page-label label))))
makeClusters =
#(define-music-function
correction amount for kneed beams. Set between @code{0} for no
correction and @code{1} for full correction.")
+ (labels ,list? "List of labels (symbols) placed on a column")
(label-dir ,ly:dir? "Side to which a label is attached.
@code{-1} for left, @code{1}@tie{}for right.")
(layer ,number? "The output layer (a value between 0 and@tie{}2:
(octavation ,integer? "This pitch was octavated by how many octaves? For chord inversions, this is negative.")
(origin ,ly:input-location? "where was this piece of music defined?")
(page-break-permission ,symbol? "When the music is at top-level, whether to allow, forbid or force a page break.")
+ (page-label ,symbol? "The label of a page marker")
(page-marker ,boolean? "If true, and the music expression is found at top-level, a page marker object is instanciated instead of a score.")
(page-turn-permission ,symbol? "When the music is at top-level, whether to allow, forbid or force a page turn.")
(part-combine-status ,symbol?
(cond ((music-property 'page-marker)
;; a page marker: set page break/turn permissions or label
(begin
- (let ((label (music-property 'label)))
+ (let ((label (music-property 'page-label)))
(if (symbol? label)
(score-handler (ly:make-page-label-marker label))))
(for-each (lambda (symbol)