Forum digitalis

1.6 Floating environment

In LaTeX, floating environments are elements such as figures, tables and minipages that automatically "float" to an optimal position in the document to keep the layout clean. They can be positioned (h, t, b, p; i.e. here, top, bottom, page), labelled (\caption) and numbered/labelled (\label) so that they appear in the list of figures or tables.

Figures

\begin{figure}[htbp] \centering \includegraphics[width=0.5\textwidth]{example-image} \caption{Example image} \label{fig:example-image} \end{figure}

Tables

\begin{table}[htbp] \centering \begin{tabular}{|c|c|} \hline A & B \\ \hline 1 & 2 \\ \hline \end{tabular} \caption{Example table} \label{tab:example-table} \end{table}

Minipages

\begin{minipage}[c]{0.45\textwidth} Left text block or image \end{minipage} \hfill \begin{minipage}[c]{0.45\textwidth} Right text block or image \end{minipage}