views:

284

answers:

3

I'm making a LaTeX document and I'm getting success with \makebox, which puts text in an invisible box and will add extra horizontal whitespace to the end to make the whole thing fit within the size you specify.

Is there something like that for vertical space?

I have a few variable length paragraphs, images, etc. that I want to put in this vertical box. I want LaTeX to put in the right amount of vertical space (at the bottom) so that the whole thing is of the set size that I give it.

+2  A: 

A minipage environment has a height parameter:

\begin{minipage}[position][height][inner-pos]{width}
 text
\end{minipage}

I can't find a nice documentation page for this environment, sorry.

Geoff
+1  A: 

The following shows the general idea (untested):

\def\exampleheight{3in}
\def\examplecontents{\vrule height 1in width 1pt \par Some text}
\vbox to \exampleheight {\examplecontents \vfill}

This is Plain Tex, which works fine in Latex, and is well-documented in Eijkhout's TeX by Topic.

Charles Stewart
+2  A: 

The box command LaTeX offers for doing vertical adjustments is \raisebox:

\raisebox{distance}[extend-above][extend-below]{insert your text here...}

With the distance parameter, you can specify a offset to raise or lower the text, and extend-above and extend-below parameters can be used to add additional space. This command is for example great for positioning a small amount of text with a small font size in a line with a bigger font size.

Simple additional vertical spaces can also be created with the \vspace*{distance} command, which inserts an additional vertical space. (The starred version also adds the space on the beginning and end, the normal version only adds space between text blocks). You might put that on the end of your paragraph or at the end of your own command to add some spacer afterwards (or before).

But for longer text extracts, I would recommend to use the \minipage environment:

\begin{minipage}[position][height][inner-pos]{width}
    insert your long text here
\end{minipage}
tux21b