Hello Bertrand,
I reworked this snippet a little bit to display asterisks instead of
numbers. This is the way we usually see those little footnotes in
published notes - but it still faces a similar problem:
If you have several staffs, the remarks are ordered first in system-
*then* in timing-order. The code is actually executed beyond parsing time.
So if you have
--snip--
\score { <<
\new Staff
\relative c' {
\repeat unfold 10 { c d e f }
\musicEndNote #"8music"
\repeat unfold 10 { c d e f }
\bar "|."
}
\new Staff
\relative c' {
\repeat unfold 9 { c d e f }
\musicEndNote #"7music"
\repeat unfold 11 { c d e f }
\bar "|."
} >>
}
--snip--
it will display in the endnotes
1) 8music
2) 7music
while having 7music "happen" a measure before 8music.
We have to find a way to get parsing order and timing order on board to
get it right.
Hopefully I can think of this next days, weeks, whatever ...
By the way, I don't know if Neil Puttocks patch regarding issue 1490 is
already in the master branch (I always merge ...) so endnotes in the
middle of the measure might get pruned.
http://code.google.com/p/lilypond/issues/detail?id=1490&colspec=ID%20Type%20Status%20Priority%20Stars%20Owner%20Patch%20Summary
Best regards, Jan-Peter
On 08.02.2011 23:40, Bertrand Bordage wrote:
Hello,
I'm currently trying to find some solutions to this issue :
http://code.google.com/p/lilypond/issues/detail?id=737
I started implementing a solution for endnotes (attached). It is based
on this snippet : http://lsr.dsi.unimi.it/LSR/Item?id=728
As you can see, there is a problem when classifying the endnotes.
Instead of having :
score endnote1
text endnote1
score endnote 2
text endnote2
we get :
score endnote1
score endnote 2
text endnote1
text endnote2
Maybe it's related to this :
http://lists.gnu.org/archive/html/bug-lilypond/2010-10/msg00144.html
All day long I tried to find a solution.
Thanks
Regards,
Bertrand Bordage
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.12.3"
% to be defined in a closure later (see toc-init.ly)
#(define-public (add-foot-item! dir text) #f)
#(define-public (foot-items) #f)
% define add item and get list functions
#(let ((foot-item-list (list)))
(set! add-foot-item!
(lambda (dir gauge short text)
(let ((label (gensym "foot")))
(set! foot-item-list
(cons (cons label text)
foot-item-list))
(make-music
'SequentialMusic
'elements
(list
(make-music 'EventChord
'page-marker #t
'page-label label
'elements (list
(make-music 'LabelEvent 'page-label label)
(make-music 'TextScriptEvent 'direction dir 'text (markup #:concat ( short #:super #:fosterisk label gauge)))))
)))))
(set! foot-items (lambda ()
(reverse foot-item-list))))
% conditionally add text markup, if we are on the right page
#(define (runfi pagelist cur-page table label text)
(let ((label-page (and (list? table) (assoc label table))))
(if (and label-page (= cur-page (cdr label-page)))
(markup pagelist #:fostermark label text)
pagelist
)
)
)
% define markup command to be used in footer- or header-markup
% delayed stencil-evaluation like in page-ref - so we know the pagenumber of the label and the current page
% needs 'gauge'-stencil --- is hardcoded right now
#(define-markup-command (footer-items layout props reserve)(number?)
"markup footer items"
(let* ((line-width (- (ly:output-def-lookup layout 'line-width) reserve))
(gauge-stencil (interpret-markup layout props (markup #:super "*" "X" #:draw-line (cons line-width 0) )))
(x-ext (ly:stencil-extent gauge-stencil X))
(y-ext (ly:stencil-extent gauge-stencil Y)))
(ly:make-stencil
`(delay-stencil-evaluation
,(delay (ly:stencil-expr
(let* ((table (ly:output-def-lookup layout 'label-page-table))
(cur-page 0)
(pagelist (markup)))
;;(display "run footeritems\n")
(set! cur-page (chain-assoc-get 'page:page-number props -1))
(map (lambda (fn)
(let ((label (car fn))
(text (cdr fn)))
(set! pagelist (runfi pagelist cur-page table label text))
)
) (foot-items))
(interpret-markup layout props (markup pagelist))
)
)
)) x-ext y-ext)))
#(define-public smulti (lambda (n r b)
(begin
(if (> n 0)(set! r (string-append r b)))
(set! n (- n 1))
(if (> n 0)(set! r (smulti n r b)))
r)))
#(define-markup-command (fosterisk layout props label gauge)(symbol? markup?)
"markup footer asterisk"
(let* ((gauge-stencil (interpret-markup layout props (markup gauge)))
(x-ext (ly:stencil-extent gauge-stencil X))
(y-ext (ly:stencil-extent gauge-stencil Y)))
(ly:make-stencil
`(delay-stencil-evaluation
,(delay (ly:stencil-expr
(let* ((table (ly:output-def-lookup layout 'label-page-table))
(cur-page (cdr (and (list? table) (assoc label table))))
(pagecount 0)
(fossi ""))
;;(display "run fosterisk\n")
(map (lambda (fn)
(let ((lab 'foot00)
(pag 0))
(set! lab (car fn))
(set! pag (and (list? table) (assoc lab table)))
(if (and pag (= (cdr pag) cur-page)) (set! pagecount (+ pagecount 1)))
(if (eq? label lab) (set! fossi (smulti pagecount "" "*")))
;;(display "loop fosterisk\n")
)
) (foot-items))
(interpret-markup layout props (markup fossi))
)
)
)) x-ext y-ext)))
#(define-markup-command (fostermark layout props label)(symbol?)
(let* ((table (ly:output-def-lookup layout 'label-page-table))
(cur-page (cdr (and (list? table) (assoc label table))))
(pagecount 0)
(fossi ""))
;;(display "run fostermark\n")
(map (lambda (fn)
(let ((lab 'foot00)
(pag 0))
(set! lab (car fn))
(set! pag (and (list? table) (assoc lab table)))
(if (and pag (= (cdr pag) cur-page)) (set! pagecount (+ pagecount 1)))
(if (eq? label lab) (set! fossi (smulti pagecount "" "*")))
;;(display "loop fostermark\n")
)
) (foot-items))
(interpret-markup layout props (markup fossi))
))
% the footnote function
% takes direction (UP/DOWN) and markup
% other layout properties can be set via [\once] \override TextScript #'... = ...
addfoot = #(define-music-function (parser location dir gauge text)(integer? string? markup?)
(begin (add-foot-item! dir (markup gauge) (markup #:null) text)
))
addfootD = #(define-music-function (parser location dir gauge short text)(integer? string? markup? markup?)
(begin (add-foot-item! dir (markup gauge) short text)
))
#(define (not-part-first-page layout props arg)
(if (= (chain-assoc-get 'page:page-number props -1)
(ly:output-def-lookup layout 'first-page-number))
empty-stencil
(interpret-markup layout props arg)))
\paper {
#(set-paper-size "a5" 'landscape)
oddHeaderMarkup = \markup \fill-line { \on-the-fly #not-part-first-page \concat { \fromproperty #'header:composer ", " \bold \fromproperty #'header:title } }
evenHeaderMarkup = \markup \fill-line { \on-the-fly #not-part-first-page \concat { \fromproperty #'header:composer ", " \bold \fromproperty #'header:title } }
oddFooterMarkup = \markup { \fill-line {
% fill in footer-items
\footer-items #(* (magstep mm) 6)
\fromproperty #'page:page-number-string
}
}
evenFooterMarkup = \markup { \fill-line {
\fromproperty #'page:page-number-string
% fill in footer-items
\footer-items #(* (magstep mm) 6)
}
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% some really boaring music with \addfoot
notenA = \relative c' {
\addfoot #UP #"**" \markup { "The C in the beginning is not confirmed!" }
\repeat unfold 24 { c d e f }
\once \override TextScript #'self-alignment-X = #-0.7
\addfootD #UP #"**" \markup { "go on" } \markup { "This is started very fast on G" }
{ g( f e d) }
\repeat unfold 23 { c d e f }
\bar "|."
}
\bookpart {
\header {
title = "title"
composer = "composer"
}
\score {
\new Staff \new Voice { \notenA }
\header {
piece = "first"
}
}
\score {
\relative c' {
\repeat unfold 10 { c d e f }
\addfoot #0 #"*" \markup { "Test3" }
\repeat unfold 10 { c d e f }
\bar "|."
}
\header {
piece = "second"
}
}
}
remark = {
\addfoot #UP #"**" \markup { \italic "another odd tone" }
}
\bookpart {
\header {
title = "Really boaring!!!!"
composer = "James the Chordbreaker"
}
\score {
\new StaffGroup <<
\new Staff \new Voice = "voc" {
\relative c' {
\repeat unfold 10 { c d e f }
% override TextScript properties to move the number
\once \override TextScript #'self-alignment-X = #RIGHT
\once \override TextScript #'X-offset = #2
\once \override TextScript #'extra-offset = #'(0 . -0.6)
\addfoot #DOWN #"**" \markup { \italic "mi = \"la\" in ancient ork" }
\repeat unfold 4 { c d e f }
\bar "|."
}
}
\new Lyrics \lyricsto "voc" \lyricmode {
\repeat unfold 10 { la la la la }
\repeat unfold 4 { mi mi mi mi }
}
\new Staff \new Voice {
\relative c' \repeat unfold 10 { e f g a }
\relative c' \repeat unfold 4 { \remark b' f g a }
%\relative c' \repeat unfold 6 { b' f g a }
}
>>
\header {
piece = "third"
}
}
}
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user