Hi Krzysztof , 2017-04-15 20:11 GMT+02:00 kmg <krzysztof.kolor...@gmail.com>: > Hey, I'm working on re-typing some educational notes and I'm wondering if > maybe someone had this problem and also came up with some Scheme to deal > with this. > > http://i.imgur.com/T7z8Ty7.png - this is the source; > > http://i.imgur.com/IGocUKW.png - this is what I came up with (nevermind > wrong notes) > > So, I'm basically using #parch scheme which I luckily found on german > Lilypond forums (sadly seems to be down now)..
I'm pretty furious about that ... > scheme for it is the > following: > > parch = #(define-music-function (parser location gap) (number?) > #{ > \once \override Arpeggio.stencil = #(lambda (grob) > (ly:stencil-add > (ly:arpeggio::brew-chord-slur grob) > (ly:stencil-translate-axis > (ly:stencil-rotate (ly:arpeggio::brew-chord-slur grob) 180 0 0) > gap X))) > \once \override Arpeggio.X-extent = #(lambda (grob) > (ly:stencil-extent (ly:arpeggio::brew-chord-slur grob) X)) > \once \override Arpeggio.positions = #(lambda (grob) > (interval-widen (ly:arpeggio::calc-positions grob) 1.5)) > $(make-music 'EventChord 'elements (list (make-music 'ArpeggioEvent))) > #}) > > // usage: \parch #<distance of the right bracket> > > which I kinda made work by doing the chord on d# note with greater range, > but with the upper note hidden, so the parenthese is not too small. However, > if I make the chord with super low note, staff will stretch and it's not > working. > > I've been thinking, would there be an easy way to do this? I already use > handy Scheme for Box markup (http://lsr.di.unimi.it/LSR/Item?id=953). I > think it's superior in the sense that you can place it basically anywhere > and offset it like you want it. So there are no problems with having to do > some gimmicks to make it work. > > Thought that chords will be trickier, but it seems that using harmony scheme > from Repository and doing \center-column in \figuremode with markups does > the job nicely. > > I sometimes wonder if it should be that tricky (I mean, having to learn > Scheme to do some things).. but then, I wonder if such thing would be doable > at all in other notation programs. . > > Anyway, thanks for your input guys and.. Happy Easter! > > > Pozdrawiam, > Krzysztof Gutowski How about below (Hijacking GridPoint and GridLine)? Usage should be clear from doc-string/comments/example. If not, ask back. \version "2.19.56" parentheses = #(define-music-function (shorten-pair padding dir) ((pair? '(0 . 0)) number? ly:dir?) "@var{dir} sets the opening/closing direction of the parentheses. @var{padding} moves the parentheses in X-axis direction, recognized by the spacing-engine. See limitations below, though. The optional @var{shorten-pair} may be used to adjust the parentheses in Y-axis direction. The final parentheses will cover all Staffs of the current system. Limitation: Accidentals, dots, etc are not taken into account. To avoid collisions adjusting @var{padding} neds to be done manually." #{ \once \override Staff.GridPoint.X-offset = $padding \once\override Score.GridLine.shorten-pair = $shorten-pair \once \override Score.GridLine.stencil = #(lambda (grob) (let* ((stil (ly:grid-line-interface::print grob)) (stil-y-ext (ly:stencil-extent stil Y)) (thick (ly:grob-property grob 'thickness 0.1)) ;; hijacking shorten-pair (shorten-pair (ly:grob-property grob 'shorten-pair '(0 . 0))) ;; GridLine goes from the middle of top to bottom staff ;; Thus we extend it by 2 (the default staff-space) and add a ;; little extra over-shoot, i.e 0.5. ;; The new parentheses starts at '(- dir) in X-axis direction to ;; avoid collisions with preceding grobs ;; The values are tweakable via overrides for ;; Score.GridLine.shorten-pair. ;; TODO get staff-space from layout (start (cons (- dir) (- (car stil-y-ext) 2.5 (- (car shorten-pair))))) (stop (cons (- dir) (+ (cdr stil-y-ext) 2.5 (- (cdr shorten-pair))))) ;; see 'make-tie-stencil' from stencil.scm (height-limit 0.7) (ratio 0.33) ;; taken from bezier-bow.cc (F0_1 (lambda (x) (* (/ 2 PI) (atan (* PI x 0.5))))) (slur-height (lambda (w h_inf r_0) (F0_1 (* (/ (* w r_0) h_inf) h_inf)))) (width (abs (- (cdr start) (cdr stop)))) (angularity 0.5) (height (slur-height width height-limit ratio))) (make-bow-stencil start stop thick angularity height (- dir)))) #}) \layout { \context { \Staff \consists "Grid_point_engraver" %% adjust the value if needed gridInterval = #(ly:make-moment 1/64) } \context { \Score \consists "Grid_line_span_engraver" \override GridLine.stencil = ##f } } \new StaffGroup << \relative { \parentheses #-2.5 #LEFT cis''2 \parentheses #'(9 . 0) #-1.5 #LEFT d \parentheses #'(9 . 9) #-1.5 #LEFT c \parentheses #'(9 . 9) #2.5 #RIGHT d \parentheses #'(9 . 0) #2.5 #RIGHT c \parentheses #2.5 #RIGHT d } \relative { c'' d c d c d } \relative { c'' d c d c d } >> HTH and Happy Easter, Harm
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user