lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Moving clef changes into the bar they affect


From: David Nalesnik
Subject: Re: Moving clef changes into the bar they affect
Date: Wed, 10 Sep 2014 06:34:00 -0500



On Wed, Sep 10, 2014 at 1:40 AM, Noeck <address@hidden> wrote:


Am 09.09.2014 um 04:45 schrieb James Worlton:
>

Another thing that might be interesting for you (but you probably know):
   \override Staff.Clef #'full-size-change = ##t
prints the clef in full size even for a change. I use this for theory
sheets.


I also remove key cancellations:
\set Staff.printKeyCancellation = ##f

FWIW, this is a layout section from a chord spelling exercise from about two years ago.  The RehearsalMark overrides are for positioning exercise numbers.  I used a Scheme function to center Roman numerals on measures, also included.  (There's probably a better way to do this, but such is what I used.)  The Roman numerals I created using the file here :http://www.mail-archive.com/address@hidden/msg69861/rN.ly)


  \layout {
    ragged-right = ##t
    #(layout-set-staff-size 23)
    \context { 
      \Score
      \override BreakAlignment #'break-align-orders =
#(make-vector 3 '(left-edge staff-bar
clef key-signature time-signature))
      \override RehearsalMark #'break-align-symbols = #'(clef)
      \override  RehearsalMark #'padding = #3
      \override SpacingSpanner #'shortest-duration-space = #7
      \remove "Bar_number_engraver"
    }
    \context {
      \Lyrics
      \override VerticalAxisGroup #'nonstaff-relatedstaff-spacing #'padding = #2.2
      \override LyricText #'extra-offset = #text-center-on-measure
      %\override LyricText #'self-alignment-X = #CENTER
      %\override LyricText #'X-offset = #1
    }
    \context {
      \Staff
      \override StaffSymbol #'staff-space = #(/ 23 20)
      \remove "Time_signature_engraver"
    }
  }

%% The scheme function

#(define (text-center-on-measure grob)
   (let* ((sys (ly:grob-system grob))
 (array (ly:grob-object sys 'all-elements))
 (default-coord (interval-center (ly:grob-extent grob sys X)))
 (grob-name (lambda (x) (assq-ref (ly:grob-property x 'meta) 'name)))
 (lst (filter (lambda (x) (or (eq? 'BarLine (grob-name x))
      (eq? 'LeftEdge (grob-name x))))
                       (ly:grob-array->list array)))
 (bar-coords (sort (map (lambda (x) (interval-center (ly:grob-extent x sys X))) lst) <))
 (lower '())
 (upper '()))
 
 (define (find-bounding-coords bar-coords default-coord)
   (if (null? (cdr bar-coords))
       '()
       (if (and (< (car bar-coords) default-coord)
                (> (cadr bar-coords) default-coord))
                (begin (set! lower (car bar-coords))
                       (set! upper (cadr bar-coords)))
        (find-bounding-coords (cdr bar-coords) default-coord))))
        
     (find-bounding-coords bar-coords default-coord)
     (cons (- (- default-coord (/ (+ upper lower) 2))) 0)))


Hope this proves useful,
David

reply via email to

[Prev in Thread] Current Thread [Next in Thread]