8.18 minipage

Synopses:

\begin{minipage}{width}
  contents
\end{minipage}

or

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

Put contents into a box that is width wide. This is like a small version of a page; it can contain its own footnotes, itemized lists, etc. (There are some restrictions, including that it cannot have floats.) This box will not be broken across pages. So minipage is similar to \parbox (see \parbox) but here you can have paragraphs.

This example will be 3 inches wide, and has two paragraphs.

\begin{minipage}{3in}
  Stephen Kleene was a founder of the Theory of Computation.

  He was a student of Church, wrote three influential texts,
  was President of the Association for Symbolic Logic,
  and won the National Medal of Science.
\end{minipage}

See below for a discussion of the paragraph indent inside a minipage.

The required argument width is a rigid length (see Lengths). It gives the width of the box into which contents are typeset.

There are three optional arguments, position, height, and inner-pos. You need not include all three. For example, get the default position and set the height with \begin{minipage}[c][2.54cm]{\columnwidth} contents \end{minipage}. (Get the natural height with an empty argument, [].)

The optional argument position governs how the minipage vertically aligns with the surrounding material.

c

(synonym m) Default. Positions the minipage so its vertical center lines up with the center of the adjacent text line.

t

Align the baseline of the top line in the minipage with the baseline of the surrounding text (plain TeX’s \vtop).

b

Align the baseline of the bottom line in the minipage with the baseline of the surrounding text (plain TeX’s \vbox).

To see the effects of these, contrast running this

---\begin{minipage}[c]{0.25in}
  first\\ second\\ third
\end{minipage}

with the results of changing c to b or t.

The optional argument height is a rigid length (see Lengths). It sets the height of the minipage. You can enter any value larger than, or equal to, or smaller than the minipage’s natural height and LaTeX will not give an error or warning. You can also set it to a height of zero or a negative value.

The final optional argument inner-pos controls the placement of contents inside the box. These are the possible values are (the default is the value of position).

t

Place contents at the top of the box.

c

Place it in the vertical center.

b

Place it at the box bottom.

s

Stretch contents out vertically; it must contain vertically stretchable space.

The inner-pos argument makes sense when the height option is set to a value larger than the minipage’s natural height. To see the effect of the options, run this example with the various choices in place of b.

Text before
\begin{center}
  ---\begin{minipage}[c][3in][b]{0.25\textwidth}
       first\\ second\\ third
  \end{minipage}              
\end{center}
Text after  

By default paragraphs are not indented in a minipage. Change that with a command such as \setlength{\parindent}{1pc} at the start of contents.

Footnotes in a minipage environment are handled in a way that is particularly useful for putting footnotes in figures or tables. A \footnote or \footnotetext command puts the footnote at the bottom of the minipage instead of at the bottom of the page, and it uses the \mpfootnote counter instead of the ordinary footnote counter (see Counters).

This puts the footnote at the bottom of the table, not the bottom of the page.

\begin{center}           % center the minipage on the line
\begin{minipage}{2.5in}
  \begin{center}         % center the table inside the minipage
    \begin{tabular}{ll}
      \textsc{Monarch}  &\textsc{Reign}             \\ \hline
      Elizabeth II      &63 years\footnote{to date} \\
      Victoria          &63 years                   \\
      George III        &59 years
    \end{tabular}
  \end{center}  
\end{minipage}
\end{center}

If you nest minipages then there is an oddness when using footnotes. Footnotes appear at the bottom of the text ended by the next \end{minipage} which may not be their logical place.

This puts a table containing data side by side with a map graphic. They are vertically centered.

% siunitx to have the S column specifier,
% which aligns numbers on their decimal point.
\usepackage{siunitx}
\newcommand*{\vcenteredhbox}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
  ...
\begin{center}
  \vcenteredhbox{\includegraphics[width=0.3\textwidth]{nyc.png}}
  \hspace{0.1\textwidth}
  \begin{minipage}{0.5\textwidth}
    \begin{tabular}{r|S}
      % \multicolumn to remove vertical bar between column headers
      \multicolumn{1}{r}{Borough} &
      % braces to prevent siunitx from misinterpreting the
      % period as a decimal separator
      {Pop. (million)}  \\ \hline
      The Bronx      &1.5  \\
      Brooklyn       &2.6  \\
      Manhattan      &1.6  \\
      Queens         &2.3  \\
      Staten Island  &0.5  
    \end{tabular}
  \end{minipage}              
\end{center}

Unofficial LaTeX2e reference manual