}
@end lilypond
+@item
+New markup functions @code{\with-link} and @code{\page-link} that add
+hyperlinks to a given label or a given page number. This works in the PDF
+backend only. All entries to the table of contents now automatically add
+hyperlinks to the pages they are referring to.
+
@item
Compound time signatures are now supported by the @code{\compoundMeter} command,
which can be used instead of @code{\time}:
--- /dev/null
+\version "2.13.47"
+
+\header {
+
+ texidoc = "Links to labels and explicit page number (PDF backend only)."
+
+}
+
+#(set-default-paper-size "a6" 'landscape)
+
+\book {
+ \label #'front
+ \markup { \with-link #'second \concat { "Link to page " \page-ref #'second "0" "?" " with label #'second." } }
+ \markup { \page-link #3 "Explicit link to page 3" }
+ \markup { \with-link #'markB "Link to mark B" }
+
+ \pageBreak
+ \label #'second
+
+ \score {
+ { c'2
+ \mark \markup \with-link #'front { front: \concat { \page-ref #'front "0" "?" ) }}
+ c'
+
+ \pageBreak
+ \mark \markup \with-link #'front "B"
+ \label #'markB
+ d' d'
+ }
+ }
+}
\ No newline at end of file
\header {
texidoc = "A table of contents is included using
@code{\\markuplines \\table-of-contents}. The toc items are added with
-the @code{\\tocItem} command."
+the @code{\\tocItem} command. In the PDF backend, the toc items are linked
+to the corresponding pages."
}
#(set-default-paper-size "a6")
(text (caddr toc-item)))
(interpret-markup
layout
- (cons (list (cons 'toc:page
- (markup #:page-ref label "XXX" "?"))
- (cons 'toc:text text))
+ (cons (list (cons 'toc:page
+ (markup #:with-link label #:page-ref label "XXX" "?"))
+ (cons 'toc:text (markup #:with-link label text))
+ (cons 'toc:label label))
props)
(ly:output-def-lookup layout toc-markup))))
(toc-items)))))
(ly:stencil-add (ly:make-stencil url-expr xextent yextent) stil)))
+(define-markup-command (page-link layout props page-number arg)
+ (number? markup?)
+ #:category other
+ "
+@cindex referencing page numbers in text
+
+Add a link to the page @var{page-number} around @var{arg}. This only works in
+the PDF backend.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\page-link #2 { \\italic { This links to page 2... } }
+}
+@end lilypond"
+ (let* ((stil (interpret-markup layout props arg))
+ (xextent (ly:stencil-extent stil X))
+ (yextent (ly:stencil-extent stil Y))
+ (old-expr (ly:stencil-expr stil))
+ (link-expr (list 'page-link page-number `(quote ,xextent) `(quote ,yextent))))
+
+ (ly:stencil-add (ly:make-stencil link-expr xextent yextent) stil)))
+
+(define-markup-command (with-link layout props label arg)
+ (symbol? markup?)
+ #:category other
+ "
+@cindex referencing page labels in text
+
+Add a link to the page holding label @var{label} around @var{arg}. This
+only works in the PDF backend.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\with-link #\"label\" { \\italic { This links to the page containing the label... } }
+}
+@end lilypond"
+ (let* ((arg-stencil (interpret-markup layout props arg))
+ (x-ext (ly:stencil-extent arg-stencil X))
+ (y-ext (ly:stencil-extent arg-stencil Y)))
+ (ly:make-stencil
+ `(delay-stencil-evaluation
+ ,(delay (ly:stencil-expr
+ (let* ((table (ly:output-def-lookup layout 'label-page-table))
+ (page-number (if (list? table)
+ (assoc-get label table)
+ #f))
+ (link-expr (list 'page-link page-number
+ `(quote ,x-ext) `(quote ,y-ext))))
+ (ly:stencil-add (ly:make-stencil link-expr x-ext y-ext)
+arg-stencil)))))
+ x-ext
+ y-ext)))
+
+
(define-markup-command (beam layout props width slope thickness)
(number? number? number?)
#:category graphic