How can I make a framed box such that, when spacing is added in the correct places, the box height is exactly 15 cm? Explicitly, how do I define a \newcommand
taking in three inputs {A}{B}{C}
and displaying a framed box with the value of x
computed from the sizes of A, B and C from below to make the box exactly 15cm:
A
\vspace{x}
B
\vspace{x}
C
As I'm trying to learn one thing at a time, a LaTeX answer is preferred, though feel free to post other solutions!
Best Answer
You could use
\vfill
for filling the space, stretching the content to the full height, such asI used the optional height argument for
\parbox
andt
for top alignment. Though top alignment is the default, id doesn't work without. The syntax of\parbox
with all optional arguments isThe parbox, which means the inner box, has the desired size. If you would like to have an "outer" height of 15 cm, you could calculate the inner height using the
calc
package.\vfill
is equivalent to\vspace{\fill}
and inserts space that can stretch as much as possible, so filling the parbox. Inserted twice they share the available space equally.