How would one create multiple occurrences of vertical space on a page in such a way, that each of them had an individual minimum amount of space that would, for each occurrence, be stretched to fill only when all the other occurrences with smaller minimums had already been stretched to the minimum of the occurrence in question?

The idea is to stretch all vertical spaces on a page towards equal height (reaching it when possible), filling the page, while ensuring that the absolute requirement of individual minimum amount of space is fulfilled for each of the occurrences. If there is enough unused vertical space on the page, this would result in all the spaces becoming equal regardless of their different minimums.

Here is another, more procedural, way of explaining it. I have multiple vertical spaces on a page. Each of these spaces would have a minimum, which can be different from the others. After fulfilling these requirements for minimum space, if there is still unused space available on the page, I'd like to stretch the spaces. The stretching would happen by enlarging the smallest of the spaces until it (or they, if there are multiple equal spaces) becomes equal to the second smallest space, after which the stretching is repeated on the now smallest spaces. This is repeated as long as there is unused space on the page or until all the vertical spaces are of equal height, after which they are all stretched until there is no more unused space on the page.

The example below using \vspace with stretchable lengths does not work as desired. The actual space becomes the base value (5ex or 15ex) plus 1fill (which is the same for both instances of \vspace), thus resulting in mismatched lengths of vertical space regardless of the amount of space available on the page.

  Some stuff\par
  \vspace{5ex plus 1fill}
  More stuff\par
  \vspace{15ex plus 1fill}
  Even more stuff\par

Replacing the \vspace commands above with \addvspace{5ex}\addvspace{0pt plus 1fill} does not help.

  • 1
    I've deleted my comments, which are now outdated. However, your request is still contradictory.
    – egreg
    Oct 4, 2019 at 13:03
  • @egreg: I've done the same. I don't see the contradiction (unless you mean the now removed comments, where there was a misunderstanding on my part), but I do realise my expression is not very clear. Do you have any ideas on how to improve it?
    – larva
    Oct 4, 2019 at 20:33
  • Suppose that besides the 20ex of minimum vertical space you have to fill another 1ex. You can't have equal spaces; at most you can add 1ex to the first 5ex of space and leave the 15ex at the minimum. You can have equal spaces in both places only if you have to fill at least 10ex more.
    – egreg
    Oct 4, 2019 at 21:21
  • @egreg: Thanks for pointing that out. I (believe I) have now corrected the question to get rid of the contradiction.
    – larva
    Oct 5, 2019 at 8:59

1 Answer 1


Please see if this helps as taken from http://joshua.smcvt.edu/latex2e/_005caddvspace.html

\addvspace Synopsis:

\addvspace{vert-length} Add a vertical space of vert-length. However, if there are two or more \addvspace in a sequence then together they only add the space needed to make the natural length equal to the maximum of the vert-length’s in that sequence. This command is fragile (see \protect). The vert-length is a rubber length (see Lengths).

This example illustrates. The picture draws a scale. In a standard LaTeX article the length \baselineskip is 12pt. The two rules here are 22pt apart: the sum of the \baselineskip and the 10pt from the first \addvspace.

Now uncomment the second \addvspace. It does not make the gap 20pt longer; instead the gap is the sum of \baselineskip and 20pt. So \addvspace in a sense does the opposite of its name — it makes sure that multiple vertical spaces do not accumulate, but instead that only the largest one is used.

LaTeX uses this command to adjust the vertical space above or below an environment that starts a new paragraph. For instance, a theorem environment begins and ends with \addvspace so that two consecutive theorem’s are separated by one vertical space, not two.

A error ‘Something's wrong--perhaps a missing \item pointing to an \addvspace means that you were not in vertical mode when you hit this command. One way to change that is to precede \addvspace with a \par command (see \par), as in the above example.

    \par\addvspace{10pt}% \addvspace{20pt}%

Result with one \addvspace enabled enter image description here

Result with both \addvspace enabled

enter image description here

  • Thanks for your reply. Unfortunately \addvspace doesn't seem to be the answer. It doesn't work as desired when stretching to fill. When stating \addvspace{0ex plus 1fill}\addvspace{5ex}, the result is a space of 5ex plus a fill stretch, not a fill that "gobbles" or "contains" the 5ex space when spanning more than 5ex.
    – larva
    Nov 13, 2019 at 10:34
  • Do kindly explain the details of the output that you desire--that would help in finding a solution
    – js bibra
    Nov 13, 2019 at 13:51
  • I've tried to do that in the question itself. It is quite understandable to me, but perhaps I'm blinded by the fact that it is written by me. How can I clarify it for you (and others)?
    – larva
    Nov 14, 2019 at 10:32
  • I've edited the original question to add another way of explaining the problem. Is it more clear to you now?
    – larva
    Nov 14, 2019 at 10:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .