lilypond-user
[Top][All Lists]
Advanced

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

Re: Fixed Vertical Spacing


From: Mats Bengtsson
Subject: Re: Fixed Vertical Spacing
Date: Tue, 20 Feb 2007 14:05:36 +0100
User-agent: Thunderbird 1.5.0.9 (X11/20061206)

You can indeed set the vertical height of a Lyrics context to zero:

\new Lyrics \with {
 \override VerticalAxisGroup #'Y-extent = #'(0 . 0)
 \override VerticalAxisGroup #'minimum-Y-extent = ##f }
 \lyricmode{ Here is some text }

  /Mats

Trevor Bača wrote:
On 2/19/07, Robert Memering <address@hidden> wrote:
Hi all,

is there a way to set the vertical distance
between staves of a system to a fixed value,
regardless of what happens (esp. Lyrics present/absent)?

I think this could be done by setting the
vertical extent of the Lyrics to zero,
but as far as I understand this is not possible.

Hi Robert,

The trick is the line-break-system-details property of the
NonMusicalPaperColumn grob. I've just put together a section of the
docs for this, but it's going to take another week or two for Graham
and I to correct all the typos and rebuild the docs.

In the meantime, here's an advance copy of the new section in the
docs, which I think will be 11.3.3 "Explicit vertical staff and system
positions" once the new docs build.

When you get to the alignment-offsets parameter, make sure to consider
your lyrics as a "staff", as far as that setting goes.


=== BEGIN ===

One way to understand the VerticalAxisGroup and \paper settings
explained in the previous two sections is as a collection of different
settings that primarily concern the amount of vertical padding
different staves and systems running down the page.

It is possible to approach vertical spacing in a different way using
NonMusicalPaperColumn line-break-system-details. Where
VerticalAxisGroup and \paper settings specify vertical padding,
NonMusicalPaperColumn line-break-system-details specifies exact
vertical positions on the page.

NonMusicalPaperColumn line-break-system-details accepts an associative
list of five different settings:

* X-offset
* Y-offset
* alignment-offsets
* alignment-extra-space
* fixed-alignment-extra-space

Grob overrides, including the overrides for NonMusicalPaperColumn
below, can occur in any of three different places in an input file:

* in the middle of note entry directly
* in a \context block
* in the \with block

When we override NonMusicalPaperColumn, we use the usual \override
command in \context blocks and in the \with block. On the other hand,
when we override NonMusicalPaperColumn in the middle of note entry,
use the special \overrideProperty command.

Here are some example NonMusicalPaperColumn overrides with the special
\overrideProperty command.

\overrideProperty NonMusicalPaperColumn
#'line-break-system-details #'((X-offset . 20))

\overrideProperty NonMusicalPaperColumn
#'line-break-system-details #'((Y-offset . 40))

\overrideProperty NonMusicalPaperColumn
#'line-break-system-details #'((X-offset . 20) (Y-offset . 40))

\override NonMusicalPaperColumn
#'line-break-system-details #'((alignment-offsets . (0 -15)))

\override NonMusicalPaperColumn
#'line-break-system-details #'((X-offset . 20) (Y-offset . 40)
(alignment-offsets . (0 -15)))

To understand how each of these different settings work, we'll start
by looking at an example that includes no overrides at all.

\new Score <<
\new Staff <<
   \new Voice {
      s1 * 6 \break
      s1 * 6 \break
      s1 * 6 \break
   }
   \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
>>
\new Staff {
   \repeat unfold 18 { d'4 d'4 d'4 d'4 }
}


This score isolates line- and page-breaking information in a dedicated
voice. This technique of creating a breaks voice will help keep layout
separate from music entry as our example becomes more complicated. See
[Using a breaks voice].

Explicit \breaks evenly divide the music into six measures per line.
Vertical spacing results from  Lily's defaults.

To set the vertical startpoint of each system explicitly, we can set
the Y-offset pair in the line-break-system-details attribute of the
NonMusicalPaperColumn grob:

\new Score <<
\new Staff <<
   \new Voice {
      \overrideProperty #"Score.NonMusicalPaperColumn"
      #'line-break-system-details #'((Y-offset . 0))
      s1 * 6 \break
      \overrideProperty #"Score.NonMusicalPaperColumn"
      #'line-break-system-details #'((Y-offset . 40))
      s1 * 6 \break
      \overrideProperty #"Score.NonMusicalPaperColumn"
      #'line-break-system-details #'((Y-offset . 80))
      s1 * 6 \break
   }
   \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
>>
\new Staff {
   \repeat unfold 18 { d'4 d'4 d'4 d'4 }
}


Note that line-break-system-details takes an associative list of
potentially many values, but that we set only one value here. Note,
too, that the Y-offset property here determines the exact vertical
position on the page at which each new system will render.

Now that we have set the vertical startpoint of each system
explicitly, we can also set the vertical startpoint of each staff
within each system manually. We do this using the alignment-offsets
subproperty of line-break-system-details.

\new Score <<
\new Staff <<
   \new Voice {
      \overrideProperty #"Score.NonMusicalPaperColumn"
      #'line-break-system-details #'((Y-offset . 20)
(alignment-offsets . (0 -15)))
      s1 * 6 \break
      \overrideProperty #"Score.NonMusicalPaperColumn"
      #'line-break-system-details #'((Y-offset . 60)
(alignment-offsets . (0 -15)))
      s1 * 6 \break
      \overrideProperty #"Score.NonMusicalPaperColumn"
      #'line-break-system-details #'((Y-offset . 100)
(alignment-offsets . (0 -15)))
      s1 * 6 \break
   }
   \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
>>
\new Staff {
   \repeat unfold 18 { d'4 d'4 d'4 d'4 }
}


Note that here we assign two different values to the
line-break-system-details attribute of the NonMusicalPaperColumn grob.
Though the line-break-system-details attribute alist accepts many
additional spacing parameters (including, for example, a corresponding
X-offset pair), we need only set the Y-offset and alignment-offsets
pairs to control the vertical startpoint of every system and every
staff.

Last, note that alignment-offsets specifies the vertical positioning
of staves but not of staff groups.

\new Score <<
\new Staff <<
  \new Voice {
     \overrideProperty #"Score.NonMusicalPaperColumn"
     #'line-break-system-details #'((Y-offset . 0)
(alignment-offsets . (0 -30 -40)))
     s1 * 6 \break
     \overrideProperty #"Score.NonMusicalPaperColumn"
     #'line-break-system-details #'((Y-offset . 60)
(alignment-offsets . (0 -10 -20)))
     s1 * 6 \break
     \overrideProperty #"Score.NonMusicalPaperColumn"
     #'line-break-system-details #'((Y-offset . 100)
(alignment-offsets . (0 -10, -40)))
     s1 * 6 \break
  }
  \new Voice { \repeat unfold 18 { c'4 c'4 c'4 c'4 } }
>>
\new StaffGroup <<
  \new Staff {
     \repeat unfold 18 { d'4 d'4 d'4 d'4 }
  }
  \new Staff {
     \repeat unfold 18 { e'4 e'4 e'4 e'4 }
  }
>>



Some points to consider:

* When using alignment-offsets, lyrics count as a staff.

* The units of the numbers passed to X-offset, Y-offset and
alignment-offsets are interpreted as multiples of the distance between
adjacent staff lines. Positive values move staves and lyrics up.
Negative values move staves and lyrics down.

* Because the NonMusicalPaperColumn line-break-system-details settings
given here allow the positioning of staves and systems anywhere on the
page, it is possible to violate paper or margin boundaries or even to
print staves or systems on top of one another. Reasonable values
passed to these different settings do, however, avoid this.

=== END ===


------------------------------------------------------------------------

_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user

--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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