lilypond-user
[Top][All Lists]
Advanced

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

Re: Can system-system spacing be altered within a \score block?


From: Thomas Morley
Subject: Re: Can system-system spacing be altered within a \score block?
Date: Sat, 2 May 2020 15:01:25 +0200

Am Fr., 1. Mai 2020 um 05:33 Uhr schrieb Brent Annable <address@hidden>:
>
> Hi all,
>
> I'm currently putting a whole bunch of separate pieces together into one 
> document, and occasionally I want to manually adjust the distance between 
> systems in one piece without affecting the spacing in the others. Because of 
> the file structure I've chosen, I can't include any top-level instructions in 
> \paper blocks without affecting all the other pieces in the document. Is 
> there a way of including an instruction within a \score block (or below), or 
> some other way to help adjust between-system spacing?
>
> Regards,
>
> Brent.

Hi Brent,

please try the code below.
It's not tested beyond the given minimal, thus test it thoroughly
before you use it for serious work.

\version "2.20.0"

#(define (system-system-extra-offset-per-score number)
"Sets @code{'counter}, defaulting to zero, in @code{ly:grob-layout} using
@code{1+}.
Relying on the read @code{'counter}, @code{'line-break-system-details}'s
subproperty @code{'extra-offset} will be adjusted by the multiplication of
@code{'counter}, starting with zero, and @var{number}.

As a result the first system of a score is not affected, follow up system's
Y-positions will be adjusted to get a different spacing, adding calculated
multiples of @var{number} to the default."
;; See NR 4.4.2 Explicit staff and system positioning
;; for more info about 'line-break-system-details and the 'extra-offset there
  (lambda (grob)
    (if (positive? (ly:item-break-dir grob))
        (begin
          (ly:output-def-set-variable! (ly:grob-layout grob)
            'counter
            (1+ (ly:output-def-lookup (ly:grob-layout grob) 'counter 0)))

          (let ((val (ly:output-def-lookup (ly:grob-layout grob) 'counter 0)))
            (ly:grob-set-property! grob 'line-break-system-details
              `((extra-offset . (0 . ,(* (1- val) number))))))))))

scoreSystemSystemExtraOffset =
#(define-music-function (nmbr)(number?)
"Set @code{Score.NonMusicalPaperColumn.after-line-breaking} to the procedure
@code{system-system-extra-offset-per-score} taking @var{nmbr] as its argument."
#{
  \override Score.NonMusicalPaperColumn.after-line-breaking =
    #(system-system-extra-offset-per-score nmbr)
#})

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Examples
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

%1
\score {
  << R1 R >>
  \header { piece = \markup \rounded-box \fill-line { "Piece 1" } }
}

%2
\score {
  <<
    { \partial 4 r4 R1 \break R1 \break R1 }
    { \partial 4 r4 R1 \break R1 \break R1 }
  >>
  \header { piece = \markup \rounded-box \fill-line { "Piece 2" } }
  \layout {
    \scoreSystemSystemExtraOffset #-15
  }
}

\pageBreak

%3
\score {
  <<
    { R1 \break R1 }
    { R1 \break R1 }
  >>
  \header { piece = \markup \rounded-box \fill-line { "Piece 3" } }
  \layout {
      \scoreSystemSystemExtraOffset #6
  }
}


Cheers,
  Harm



reply via email to

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