]> git.donarmstrong.com Git - lilypond.git/blob - input/regression/footnote-auto-numbering.ly
lilypond-manuals.css: edit color scheme and some spacing
[lilypond.git] / input / regression / footnote-auto-numbering.ly
1 \version "2.19.21"
2 \header {
3   texidoc = "This is an example of automatic footnote numbering
4 where the number is not reset on each page.  It uses the default
5 numbering function, which assigns numbers starting at 1 to successive
6 footnotes.
7 "
8 }
9
10 #(define (make-footnote-numbering-assertion-function n)
11   (lambda (x)
12     (if (not (= n x))
13       (ly:error (_ "Expecting number ~a, got ~a") n x))))
14
15 #(define (simultaneous-footnote-numbering-assertion-function x y)
16   (lambda (grob)
17     (let ((n (if (grob::has-interface (ly:grob-parent grob Y)
18                                       'beam-interface)
19                  x
20                  y)))
21       (lambda (x)
22         (if (not (= n x))
23           (ly:error (_ "Expecting number ~a, got ~a") n x))))))
24
25 \paper {
26   reset-footnotes-on-new-page = ##f
27 }
28
29 #(set-default-paper-size "a6")
30 \book {
31
32 \markup {
33   a \auto-footnote b c
34   \auto-footnote d e
35   \auto-footnote f g
36 }
37
38 \markup { h i }
39
40 \relative c' {
41   \once \override FootnoteItem.numbering-assertion-function =
42     #(lambda (grob) (make-footnote-numbering-assertion-function 3))
43   \footnote #'(1 . -1) \markup { j } NoteHead
44   a b c d
45 }
46
47 \pageBreak
48
49 \markup { k \auto-footnote l m }
50
51 \relative { a1 }
52
53 \relative {
54   d'4 e
55   \once \override FootnoteItem.numbering-assertion-function =
56     #(lambda (grob) (make-footnote-numbering-assertion-function 5))
57   < f \footnote #'(1 . -1) \markup { n } a c >
58   \once \override FootnoteSpanner.numbering-assertion-function =
59     #(simultaneous-footnote-numbering-assertion-function 6 7)
60   a8-\footnote #'(1 . 1) \markup { p } \<
61   -\footnote #'(1 . 1) \markup { o } [ b c d ] a4 b c |
62   d a b c |
63   d a b c |
64   d a b c\f |
65 }}