# Automatic vertical spacing when *some* values are fixed

```Hi all,

```
recently (http://lists.gnu.org/archive/html/lilypond-user/2018-01/msg00576.html) I asked about how to use the vertical spacing variables to force the top system to an absolute position, which I could achieve with the basic-distance and minimal-distance of top-system-spacing and its stretchability set to 0.
```
```
However, this setting proves to have serious side-effects for vertical spacing in general as it seems to encourage LilyPond to squeeze much more music on a page. I will have a few questions related to this challenge, but I'll start with the most pressing (sorry for the pun) one with this email.
```
```
Attached you'll find a score with some quartet music in it. You can compile it with the vertical margins set through top-margin and bottom-margin or through the paper spacing variables.
```
```
With the paper variables (which is also the saved state in the attachment) LilyPond squeezes three systems on the page, severely compressing the music, while with the regular top-margin/bottom-margin settings only two systems are put on the page.
```(Behaviour is basically the same in 2.18 and 2.19.80.)

```
My suspicion is that when forcing *some* stretchability values to zero the other flexible variables wreak havoc.
```
```
Is there a way to force these absolute top and bottom values and still have acceptable (or even beautiful) overall vertical spacing?
```
```
For your reference: I need this because I want to strictly align the top and bottom system of a score to the type area of the surrounding text document (this is also where the strange values are from, they are calculated from the LaTeX document).
```
Any suggestions?

Thanks
Urs

```
```%%File header
\version "2.18.2"

\paper{
#(set-paper-size "a5")
print-page-number = ##f
print-first-page-number = ##t
first-page-number = 8
inner-margin = 35.091735839844\pt
left-margin = 35.091735839844\pt
%        top-margin = 27\pt
%        bottom-margin = 52\pt
% {
top-margin = 0\pt
bottom-margin = 0\pt
top-system-spacing =
#'((basic-distance . 11.958465576172)
(minimum-distance . 11.958465576172)
(stretchability . 0))
top-markup-spacing =
#'((basic-distance . 11.958465576172)
(minimum-distance . 11.958465576172)
(stretchability . 0))
last-bottom-spacing =
#'((basic-distance . 19.243121337891)
(minimum-distance . 19.243121337891)
(stretchability . 0))
%}
two-sided = ##t
line-width = 315.82562255859\pt

}

%  title=Beethoven
tagline = ##f
}

global = {
\key f \major
\numericTimeSignature
\time 3/4
\tempo "Allegro con brio"
}

scoreAViolinI = \relative f' {
\global
f4 \p ~ f8 ( g16 f ) e8-. f-. |
c4 r r |
f4  ~ f8 ( g16 f ) e8-. f-. |
d4 r r |

f'4 \< ~ f8 ( g16 f ) e8-. f-. |
g2 \> ( bes,4) |
a2 \! ( d8. bes16 ) |
a2( g4 ) |

f4 \f ~ f8 ( g16 f ) e8-. f-. |
c4 r r |
f4  ~ f8 ( g16 f ) e8-. f-. |
d4 r r |

f'4 \p ~ f8 ( g16 f ) e8-. f-. |
a2 ( \< g4 ) \> |
g4 \! ~ g8 ( a16 g ) fis8 -. g -. |
bes2 ( a4 ) |
a4 \! ~ a8 ( bes16 a ) g8 -. a -. |
c4. ( bes8 a g ) |

}

scoreAViolinII = \relative f' {
\global
% Music follows here.
f4 \p ~ f8 ( g16 f ) e8-. f-.
c4 r r |
f4 ~ f8 ( g16 f ) e8-. f-. |
d4 r r |
bes'2. ~ \< |
bes2 \> ( g4 ) |
f2 \! ( bes8. g16 ) |
f2 ( e4 ) |

f4 \f ~ f8 ( g16 f ) e8-. f-.
c4 r r |
f4 ~ f8 ( g16 f ) e8-. f-. |
d4 r r |
R2. |
e'2.\p % espressivo missing!|
R2. |
c2. |
R2. |
es4. ( d8 c bes ) |

}

scoreAViola = \relative f {
\global
f4 \p ~ f8 ( g16 f ) e8-. f-.
c4 r r |
f4 ~ f8 ( g16 f ) e8-. f-. |
d4 r r |
d'2. \< ( |
c2. \> ) ~  |
c4 \! ( d f, ) |
c'8 _( b c b c4 )

f,4 \f ~ f8 ( g16 f ) e8-. f-.
c4 r r |
f4 ~ f8 ( g16 f ) e8-. f-. |
d4 r r |
R2.
bes''2. \p |
R2. |
es2. |
R2. |
fis,4. ( g8 a bes ) |

}

scoreACello = \relative f {
\global
f4 \p ~ f8 ( g16 f ) e8-. f-.
c4 r r |
f4 ~ f8 ( g16 f ) e8-. f-. |
d4 r r
d2. \< ( |
e2. \> ) ( |
f4 ) \! ( d bes ) |
c2.

f4 \f ~ f8 ( g16 f ) e8-. f-.
c4 r r |
f4 ~ f8 ( g16 f ) e8-. f-. |
d4 r r |
R2.
cis'2. \p |
R2.
\break
fis2. |
\once \override MultiMeasureRest.Y-extent = #'(-5 . 1)
R2.
bes,4. bes8 bes bes  |

}

scoreAViolinIPart = \new Staff \with {
instrumentName = "Vl. I"
} \scoreAViolinI

scoreAViolinIIPart = \new Staff \with {
instrumentName = "Vl. II"
} \scoreAViolinII

scoreAViolaPart = \new Staff \with {
instrumentName = "Vla."
} { \clef alto \scoreAViola }

scoreACelloPart = \new Staff \with {
instrumentName = "Vc."
} { \clef bass \scoreACello }

\score {
\new StaffGroup <<
\scoreAViolinIPart
\scoreAViolinIIPart
\scoreAViolaPart
\scoreACelloPart
>>
\layout { }
}
```
```_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
```