# Change lineskip to fill the available space

Is there a way to change lineskip such that the text fills up a certain space?

MWE

\documentclass{article}
\usepackage{blindtext}

\begin{document}
\begin{minipage}[c][\textheight]{\linewidth}
\blindtext
\end{minipage}
\end{document}


Where the first line is at the top of the page, and the last line is at the bottom, as if there were a \vfill after every line.

Ideally, any solution would be fairly robust and allow a wrapfigure like

Not so minimal working example

\documentclass{article}
\usepackage{blindtext}

\begin{document}
\noindent\begin{minipage}[c][\textheight]{\linewidth}
\blindtext
\begin{wrapfigure}{r}{2in}
\includegraphics[width=\linewidth]{picture.png}
\end{wrapfigure}
\blindtext
\end{minipage}
\end{document}

-

You should use the [s] (stretch) option for the minipage:

\documentclass{article}
\usepackage[pass,showframe]{geometry}
\usepackage{blindtext}

\begin{document}
\noindent\begin{minipage}[c][\textheight][s]{\linewidth}
\baselineskip=1\baselineskip plus 1fill % stretch as much as needed
\lineskip=0pt plus 1fill % just for safety

\blindtext
\end{minipage}
\end{document}


The geometry package is used just to show the frame.

-
+1 Hmm I wonder who implemented that s option:( –  David Carlisle Jan 9 '13 at 10:13
Where do we get details of all such mysterious options? –  Harish Kumar Jan 9 '13 at 14:07
@HarishKumar The LaTeX manual or "The LaTeX Companion", for instance. –  egreg Jan 9 '13 at 15:43
Thank you. I need some more GiB of memory inside my brain ;-) –  Harish Kumar Jan 9 '13 at 15:46
This answer is really nice! I was really hoping to include a wrapfig in my minipage, but wrapfig overcalculates the space needed (as if it calculates the number of lines needed before the \baselineskip changes and then expands with the new \basselineskip). Is there any way to get around this? –  Nathanael Farley Jan 9 '13 at 16:40

Ooh good question (+1) learn something new every day.

Normally you could set \baselineskip to a stretch space and it would stretch to fill the space, but it is defeated by the boxing and unboxing that minipage does behind the scenes.

Possibly the simplest thing is to use a primitive \vbox and shrinkable glue.

\documentclass{article}
\usepackage{blindtext}

\begin{document}

\noindent\vbox to \textheight{\baselineskip=\textheight minus \textheight
\blindtext
}
\end{document}
`

-