lilypond-user
[Top][All Lists]
Advanced

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

Re: Center-align a score


From: David Nalesnik
Subject: Re: Center-align a score
Date: Thu, 27 Apr 2017 10:23:47 -0500

On Thu, Apr 27, 2017 at 8:43 AM, Kieren MacMillan
<address@hidden> wrote:
> David,
>
>>> A little trial-and-error is required if doing it manually, but there might 
>>> be a way to automate the process.
>> Here you go:
>
> You da man! This is *exactly* what I was envisioning. Nicely done.
>
> Now…   ;)
>
> Perhaps there’s a way your new-found [?] knowledge/skill in this area can 
> help with a long-time feature request I’ve had: an \offset-like way to nudge 
> systems — especially the explicit Y-offset property, but also the 
> alignment-distances if possible. Avoiding trial-and-error there would be a 
> huge savings.
>

Well, the horizontal is a much different beast than the vertical.
Horizontal is easy in LilyPond, vertical not at all so.

Directly contradicting what I just wrote, there is an issue with
vertical positioning in my little experiment.  Try this:

\version "2.19.59"

\paper {
  ragged-right = ##t
  indent = 0
}

\layout {
  \context {
    \Score
    \override NonMusicalPaperColumn.after-line-breaking =
    #(lambda (grob)
       (if (eqv? (ly:item-break-dir grob) 1) ; line beginning
           (let* ((sys (ly:grob-system grob))
                  (sys-width (ly:grob-extent sys sys X))
                  (layout (ly:grob-layout grob))
                  (line-full-width (ly:output-def-lookup layout 'line-width)))
             (ly:grob-set-nested-property! grob
'(line-break-system-details X-offset)
               (/ (- line-full-width (interval-length sys-width)) 2)))))
  }
}

music = {
  \repeat unfold 500 { c,4 }
}

\score { \music }

%%

Notice that with the override, systems are placed lower on the page
and the bottom margin is lost.

The problem occurs with the call to ly:grob-extent.  In my experience,
calling this function for the X-axis doesn't result in (visible) side
effects, but here they are.

-DN



reply via email to

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