LaTeX minipage

LaTeX minipage

Ads

LaTeX minipage

The minipage is often used to put things next to each other, which can otherwise be hard put together. For example, two pictures side by side, two tables next to a text or a picture or vice versa. The idea behind the minipage command is that within an existing page "built in" an additional page. By this one has the opportunity to use this new page, for example, set two pictures side by side, then just set two minipages side by side. Here than in Figure 1 is set in the first and Figure 2 in the second minipage.

1.1 The command minipage

Wherein minipage is an environment that has a specific orientation, and a predetermined width.
\begin{minipage}[adjusting]{width of the minipage}
 Text ... \ \
 Images ... \ \
 Tables ... \ \
\end{minipage} 

1.1.1 Adjustment

When adjusting the choices is: c (for centers) t (for top) and b (for bottom). By default, c is used for centering. It is aligned by t and/or b at the highest (top line) and/or at the lowest line (bottom line).

1.1.2 Width

The width can be set as absolute or as relative value. That means one can indicate 0,2 to the 6cm or 60mm or 0,3\textwidth or \textwidth as value for the width can. Whereby one must note here that the widths of several minipages those do not lay next to each other than the width of the text are larger, since otherwise everything cannot be indicated.

1.1.3 Further options

Besides there are still further options, which however in practical application the minipage does not play a role like the height and the adjustment (again c, t and b) within the minipage.

Example of further options
\begin{minipage}[t][5cm][b]{0,5\textwidth}
This minipage now has a defined height of 5cm, and the content will now be aligned to the bottom of the minipage.

Hint

A mistake that is often made is, there is a blank line between the \end{minipage} and \begin{minipage} left. Then the pages are no longer together.

1.2 Examples minipage

Put three pictures side by side, where you should set the width of the image using width = \textwidth, if they are too wide.
\begin{minipage}[t]{0.3\textwidth}
\includegraphics[width=\textwidth]{pic1}
\end{minipage}
\begin{minipage}[t]{0.3\textwidth}
\includegraphics[width=\textwidth]{pic2}
\end{minipage}
\begin{minipage}[t]{0.3\textwidth}
\includegraphics[width=\textwidth]{pic3}
\end{minipage}
With minipage also text can be put next to an image, this also can be implemented by the usepackage sidecap.
\begin{minipage}{0.5\textwidth}
\includegraphics[width=\textwidth]{pic1}
\end{minipage}
\begin{minipage}{0.5\textwidth}
on pic 1 you find the word pic 1\\
on pic 1 you find the word pic 1\\
on pic 1 you find the word pic 1\\
on pic 1 you find the word pic 1\\
on pic 1 you find the word pic 1\ \vspace{2.5cm}\\
\end{minipage}
Two tables next to each other:
\begin{minipage}{0.2\textwidth}
\begin{tabular}{|c|c|c|}
\hline
 A & B & C \\
\hline
 1 & 2 & 3  \\
\hline 
 4 & 5 & 6 \\
\hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.2\textwidth}
\begin{tabular}{c|c|c}
 A & B & C \\
\hline
 1 & 2 & 3  \\
\hline 
 4 & 5 & 6 \\
\end{tabular}
\end{minipage}

Contact