lilypond-user
[Top][All Lists]
Advanced

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

Re: Center-align a score


From: Thomas Morley
Subject: Re: Center-align a score
Date: Wed, 26 Apr 2017 23:01:46 +0200

2017-04-26 21:09 GMT+02:00 Simon Albrecht <address@hidden>:
> Am 26.04.2017 um 20:47 schrieb Hendrik Fuß:
>>
>> There are paper variables to achieve ragged-right and ragged-last layout.
>> Is there a way to achieve center-aligned music in a score?
>
>
> Not really. One way would be entering each line as a separate \score inside
> \markup \center-column {},

One could do:

\version "2.19.56"

#(define-markup-list-command (center-column-list-args layout props args)
  (markup-list?)
  #:properties ((baseline-skip))
  (let ((stils (interpret-markup-list layout props args))
        (line-width (ly:output-def-lookup layout 'line-width)))
  (space-lines baseline-skip
    (map
      (lambda (arg)
        (ly:stencil-translate-axis
          arg
          (/ (- line-width (interval-length (ly:stencil-extent arg X))) 2)
          X))
      stils))))

%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%

\header {
  title = "TITLE"
  subtitle = "SUBTITLE"
}

mus = {
  a'1 1 1 \break
  1 1 \break
  1 \break
  1 1 \break
  1 1 1 \break
}

sc =
\score {
    \new Staff \repeat unfold 6 \mus
    \layout { ragged-right = ##t indent = 0 }
  }

\markuplist \center-column-list-args \score-lines { \sc }

Cheers,
  Harm



reply via email to

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