Previous: , Up: Spaces   [Contents][Index]


19.16 \addvspace

Synopsis:

\addvspace{vert-length}

Add a vertical space of vert-length. However, if there are two or more \addvspace’s 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.

\documentclass{article}
\usepackage{color}
\begin{document}
\setlength{\unitlength}{2pt}%
\noindent\begin{picture}(0,0)%
  \multiput(0,0)(0,-1){25}{{\color{blue}\line(1,0){1}}}
  \multiput(0,0)(0,-5){6}{{\color{red}\line(1,0){2}}}
\end{picture}%
\rule{0.25\linewidth}{0.1pt}% 
\par\addvspace{10pt}% \addvspace{20pt}%
\par\noindent\rule{0.25\linewidth}{0.1pt}%
\end{document}

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.


Unofficial LaTeX2e reference manual