3

My understanding is that \addvspace defines "addition" as maxᵢ{vspaceᵢ} (fixed). What happens to the stretch and shrink? Here I'm adding a large inflexible vspace to a small super-stretchy vspace.

\addvspace{200px plus 2px minus 2px\relax}
\addvspace{10px plus 10px minus 10px\relax}

What is the resulting vspace, and what tools could I have used to figure it out?

2
  • I thik you meant max not min (or at least you should have meant max not min) May 3, 2022 at 18:34
  • Yep, fixed.---- May 3, 2022 at 20:50

1 Answer 1

4

The code (mostly in \@xaddvskip) tests the requested length with any immediately preceding length already added with \ifdim (which ignores stretch and shrink) and uses the larger of two. Any stretch or shrink component of the chosen length is used.

So the effective space from your pair is the same as just doing the first.

You could see this from the code

\def\@xaddvskip{%
  \ifdim\lastskip<\@tempskipb
    \vskip-\lastskip
    \vskip\@tempskipb
  \else
    \ifdim\@tempskipb<\z@
      \ifdim\lastskip<\z@
      \else
        \advance\@tempskipb\lastskip
        \vskip-\lastskip
        \vskip \@tempskipb
      \fi
    \fi
  \fi}

or by testing:

\documentclass{article}

\begin{document}

\showoutput
\hrule
\addvspace{200px plus 2px minus 2px\relax}
\addvspace{10px plus 10px minus 10px\relax}
\hrule
\end{document}

which shows

...\rule(0.4+0.0)x*
...\glue 200.75073 plus 2.0075 minus 2.0075
...\rule(0.4+0.0)x*

Note if you added them in the other order the effective length would be the same, but arranged differently:

...\rule(0.4+0.0)x*
...\glue 10.03754 plus 10.03754 minus 10.03754
...\glue -10.03754 plus -10.03754 minus -10.03754
...\glue 200.75073 plus 2.0075 minus 2.0075
...\rule(0.4+0.0)x*

You must log in to answer this question.

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