Hi David, may I ask you to have a look?
There's an optional argument failing with a single use-case and I've no clue why. Did I something wrong? (You may want to skip most of the mail and go to the REMARK) Thanks, Harm 2014-07-30 9:09 GMT+02:00 Pierre Perol-Schneider <[email protected]>: > Hi James, > > 2014-07-30 1:49 GMT+02:00 James Harkins <[email protected]>: > >> In some places, I have a \markup-style mark over the same barline, and at >> the same barline, I also want a rehearsal mark (produced by \mark \default). >> Unfortunately it seems only one \mark is allowed at any given moment. >> >> This is a type of markup-style marking I mean: >> This looks more like a MetronomeMark >> \mark \markup { \fontsize #-2 { \note #"4." #1 "=" \note #"2" #1 } } It should be possible to stack MetronomeMark and RehearsalMark in some manner. Something at the lines of: mus = \new Staff { \key d \major \override Score.MetronomeMark.break-align-symbols = #'(staff-bar key-signature clef) \override Score.MetronomeMark.self-alignment-X = #0 c''1 \tempo \markup { \fontsize #-2 { \note #"4." #1 "=" \note #"2" #1 } } \mark \default c''1 } \new StaffGroup << \mus \mus >> Though, the behaviour of both is not consistent in all cases. I have to admit that I did not dig deeper in it, but followed another approach, see below. >> >> ... where you wouldn't want the score to print the duration equivalence >> over every staff, just at the top. And of course rehearsal marks shouldn't >> go over every staff either. >> >> Is there any workaround? > > > A mini example would have been great here... > Maybe this snippet could help ? http://lsr.di.unimi.it/LSR/Item?id=202 There's also Neils multi-mark-engraver http://lists.gnu.org/archive/html/lilypond-user/2011-08/msg00157.html and http://lsr.di.unimi.it/LSR/Item?id=892 although this snippet can't deal with \mark \default > > > Somerhing like : > > \version "2.18.2" > > #(define (format-mark-box-letters-markup-style mark context) > (markup #:line > (#:center-column > (#:line > (#:fontsize -2 (#:note "4." 1) > #:fontsize -2 "=" > #:fontsize -2 (#:note "2" 1)) > #:bold #:box (#:markletter (- (ly:context-property context > 'rehearsalMark) 2)) > )))) > > markDefaultMarkupStyle = { > \set Score.markFormatter = #format-mark-box-letters-markup-style > \once\override Score.RehearsalMark.baseline-skip = #4 > \mark\default > } > > myMusic = \relative c'' { > \repeat unfold 4 a > \markDefaultMarkupStyle > \repeat unfold 4 a > } > > \new StaffGroup << > \myMusic > \myMusic > \myMusic >>> > > HTH, > Pierre This works ofcourse, though, it's not very flexible. Too much hardcoded. Even adding optional arguments does not convince me. The following function is able to combine a custom-markup and \mark \default in various ways: \version "2.18.0" % #(ly:set-option 'debug-skylines #t) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % definition of the new combined stencil %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% #(define (combine-markup-default-rehearsal-mark alist text) (lambda (grob) (let* ((default-stencil (ly:grob-property grob 'stencil)) (other-axis (lambda (a) (remainder (+ a 1) 2))) (markup-stencil (grob-interpret-markup grob text)) (axis (or (assoc-ref alist 'axis) Y)) (order (or (assoc-ref alist 'order) 1)) (align-direction (or (assoc-ref alist 'align-direction) CENTER)) (center-on-first-stencil (assoc-ref alist 'center-on-first-stencil)) (stil-lst (list markup-stencil default-stencil)) (stencil-list (if (= order 1) stil-lst (reverse stil-lst))) (new-stencil (ly:stencil-combine-at-edge (ly:stencil-aligned-to (car stencil-list) (other-axis axis) align-direction) axis RIGHT (ly:stencil-aligned-to (cadr stencil-list) (other-axis axis) align-direction) 1)) (first-stencil-length (interval-length (ly:stencil-extent (car stencil-list) X))) (new-stencil-length (interval-length (ly:stencil-extent new-stencil X)))) (if (and (eq? axis X) center-on-first-stencil) (ly:grob-set-property! grob 'self-alignment-X (/ (- new-stencil-length first-stencil-length) (* -1 new-stencil-length)))) (ly:grob-set-property! grob 'stencil new-stencil)))) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % definition of a music-function to use the new stencil %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% REMARK %% Something buggy with optional arguments? %% See other REMARK below #(define (alist? x) (and (list? x) (every pair? x))) addMarkupToDefaultRehearsalMark = #(define-music-function (parser location alist mrkp) (((lambda (x) (and (list? x) (every pair? x))) '()) markup?) ;((alist? '()) markup?) " Add a markup a @code{RehearsalMark} called with @code{\\default} If the optional @var{alist} is specified the following settings are possible: axis: stack the arguments horizontal or vertical possible values: X or Y, default is Y. order: in which order should the arguments be printed default is 1, will lead to print in entered order, every other value will reverse the order. align-direction: how should the arguments be aligned to each other useful values are: LEFT, RIGHT, CENTER, UP, DOWN other numerical are possibel, though default is CENTER. center-on-first-stencil: if axis is X, setting center-on-first-stencil #t will align the new RehearsalMark centered on the first argument. Example: \\addMarkupToDefaultRehearsalMark #`((axis . ,X) (order . -1) (align-direction . ,CENTER) (center-on-first-stencil . #t)) \\markup { \\musicglyph #"\"scripts.segno"\" } \\mark \\default " #{ \once \override Score.RehearsalMark #'before-line-breaking = #(combine-markup-default-rehearsal-mark alist mrkp) #}) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ----- TEST ---- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% tempoMarkup = \markup { \fontsize #-4 { \note #"4." #1 "=" \note #"2" #1 } } \relative c' { \set Score.markFormatter = #format-mark-box-alphabet \mark \default % A c'1 \addMarkupToDefaultRehearsalMark \tempoMarkup \mark \default % B b4-. \mf a2. \break \addMarkupToDefaultRehearsalMark #`((axis . ,X)) % or #'((axis . 0)) \tempoMarkup \mark \default % C a1 \addMarkupToDefaultRehearsalMark #'((order . -1)) \tempoMarkup \mark \default % D g \break \addMarkupToDefaultRehearsalMark #`((align-direction . ,LEFT)) % or #'((align-direction . -1)) \tempoMarkup \mark \default % E f1 \addMarkupToDefaultRehearsalMark #`((axis . ,X)) \tempoMarkup \mark \default % F e \addMarkupToDefaultRehearsalMark #`((axis . ,X) (center-on-first-stencil . #t)) \tempoMarkup \mark \default % G e \break %% REMARK: % This fails for unknown reason! %{ \addMarkupToDefaultRehearsalMark \markup { \musicglyph #"scripts.segno" } \mark \default %} % This works of course %%{ \addMarkupToDefaultRehearsalMark #'() \markup { \musicglyph #"scripts.segno" } \mark \default %} % This as well (!): %{ \addMarkupToDefaultRehearsalMark #(markup #:musicglyph "scripts.segno") \mark \default % H %} % Something buggy with optional argument? d1 \addMarkupToDefaultRehearsalMark #`((axis . ,X) (order . -1) (center-on-first-stencil . #t) ) \markup { \musicglyph #"scripts.segno" } \mark \default % I e } HTH, Harm _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
