# Tag Archives: figure

## The best way to place figures side-by-side in Latex

There are different way of placing figures side by side in Latex, subcaption, subfig, subfigure, or even minipage. This post will tell you which one is the best.

## subcaption

A useful extension is the subcaption package (the subfigure and subfig packages are deprecated and shouldn’t be used any more), which uses subfloats within a single float. This gives the author the ability to have subfigures within figures, or subtables within table floats. Subfloats have their own caption, and an optional global caption. An example will best illustrate the usage of this package:

\usepackage{subcaption}
...
\begin{figure}
\begin{subfigure}[b]{0.4\textwidth}
\includegraphics[width=\textwidth]{1.png}
\caption{Picture 1}
\label{fig:1}
\end{subfigure}
%
\begin{subfigure}[b]{0.4\textwidth}
\includegraphics[width=\textwidth]{2.png}
\caption{Picture 2}
\label{fig:2}
\end{subfigure}
\end{figure}


## minipage

The minipage can be used to place figures side-by-side too. But it is not a floating environment, thus has to be placed in a figure environment. Another disadvantage of minipage is that it does not align fi gures. Therefore, subcaption is still the best package you should use.

\begin{figure}
\begin{minipage}[b]{0.4\textwidth}
\includegraphics[width=\textwidth]{1.png}
\caption{Picture 1}
\label{fig:1}
\end{minipage}

\begin{minipage}[b]{0.4\textwidth}
includegraphics[width=textwidth]{2.png}
\caption{Picture 2}
\label{fig:2}
\end{minipage}
\end{figure}