How do you place multiple figures side by side in LaTeX?

You can understand by looking at the title. What topic am I going to discuss in this tutorial? Yes, in this tutorial, I will teach you how to place two figures side by side.

But, before we jump directly to solutions, there are some concepts to clear up. This tutorial is based on the following three concepts:

1. Multicolumn Page Layout
2. Width Parameter – \textwidth
3. Width Parameter – \linewidth

1.Multicolumn Page Layout

A multi-column layout divides the document into sections, similar to newspaper columns. When placing images side by side, you create independent columns where each image fits neatly.

Understanding this concept helps you control spacing and alignment, ensuring a professional layout.

2.Width Parameter – \textwidth

Once the page is divided into columns, how do we decide the width of each column? Should they be equal or in a 30/70 split?

\textwidth defines the total text area width on a page. To distribute space, use percentages:

1. Equal columns: .5\textwidth each
2. Unequal columns: .3\textwidth and .7\textwidth

This allows precise control over the column sizes.

3.Width Parameter – \linewidth

Unlike \textwidth, which refers to the full text width, \linewidth adapts to its container. Inside a minipage, multi-column setup, or list, \linewidth represents the available space within that section.

For images, it helps in defining relative widths:

1. .5\linewidth for two equal images
2. .25\linewidth for four images

Using the subfigure Environment

The subfigure environment inside a figure allows multiple images with individual captions. Width is usually set as a percentage for a balanced layout.

\documentclass[11pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{graphicx,subcaption,lipsum}

\begin{document}

\begin{figure}[h]
  \begin{subfigure}{.5\textwidth}
  \centering
    \includegraphics[width=1\linewidth]{image.jpg}
    \caption{First subfigure}
  \end{subfigure}%
  \begin{subfigure}{.5\textwidth}
  \centering
    \includegraphics[width=1\linewidth]{image.jpg}
    \caption{Second subfigure}
  \end{subfigure}
  \caption{Main caption}
\end{figure}

\lipsum[1][1-8]

\begin{figure}[h]
  \begin{subfigure}{.5\textwidth}
  \centering
    \includegraphics[width=.9\linewidth]{image.jpg}
    \caption{First subfigure}
  \end{subfigure}%
  \begin{subfigure}{.5\textwidth}
  \centering
    \includegraphics[width=.9\linewidth]{image.jpg}
    \caption{Second subfigure}
  \end{subfigure}
  \caption{Main caption}
\end{figure}

\lipsum[3][1-8]

\begin{figure}[h]
\centering
  \begin{subfigure}{.3\textwidth}
    \includegraphics[width=.9\linewidth]{image.jpg}
    \caption{First subfigure}
  \end{subfigure}%
  \begin{subfigure}{.3\textwidth}
    \includegraphics[width=.9\linewidth]{image.jpg}
    \caption{Second subfigure}
  \end{subfigure}%
   \begin{subfigure}{.3\textwidth}
    \includegraphics[width=.9\linewidth]{image.jpg}
    \caption{Third subfigure}
  \end{subfigure}
\caption{Main caption}
\end{figure}

\end{document}

Output :

Each image has its own caption, making this method organized and clear.

Using \subfloat from the subfig Package

The \subfloat command provides flexibility by allowing multiple images within a single figure environment, each with an individual caption.

\documentclass[11pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{xcolor,graphicx,subfig,lipsum}
\begin{document}
\pagecolor{yellow!15}
\lipsum[1][1-9]

\begin{figure}[h]
 \centering
  \subfloat[First subfigure]{\includegraphics[width=.48\linewidth]{image.jpg}}
  \subfloat[Second subfigure]{\includegraphics[width=.48\linewidth]{image.jpg}}
  \caption{Without space}
\end{figure}

\lipsum[2][1-7]

\begin{figure}[h]
  \centering
  \subfloat[First subfigure]{\includegraphics[width=.49\linewidth]{image.jpg}}\hfill
  \subfloat[Second subfigure] {\includegraphics[width=.49\linewidth]{image.jpg}}
  \caption{Add space}
\end{figure}

\lipsum[2-3]

\begin{figure}[h]
  \centering
  \subfloat[First subfigure]{\includegraphics[width=.33\linewidth]{image.jpg}}\hfill
  \subfloat[Second subfigure] {\includegraphics[width=.33\linewidth]{image.jpg}} \hfill
 \subfloat[Third subfigure] {\includegraphics[width=.33\linewidth]{image.jpg}}
  \caption{Add space}
\end{figure}

\lipsum[4][1-8]

\end{document}

Output :

You can use \hfill or \quad to adjust spacing between images.

Using the minipage Environment

The minipage environment creates independent sections, making it easier to position images while maintaining precise control over alignment.

\documentclass[11pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{graphicx,xcolor,subcaption,lipsum}
\begin{document}
\pagecolor{green!7!white}

\lipsum[1][1-5]
\vspace{.5cm}

\begin{figure}
\centering
\begin{minipage}{.5\textwidth}
  \includegraphics[width=1\linewidth]{image.jpg}
  \caption{Caption for first figure.}
\end{minipage}%
\begin{minipage}{.5\textwidth}
  \includegraphics[width=1\linewidth]{image.jpg}
  \caption{Caption for second figure.}
\end{minipage}
\end{figure}

\vspace{.5cm}
\lipsum[2][1-5]
\vspace{.5cm}

% Use without float env

\noindent\begin{minipage}{.5\textwidth}
\centering
  \includegraphics[width=.9\linewidth]{image.jpg}
  \captionof{figure}{Caption for first fig}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
  \includegraphics[width=.9\linewidth]{image.jpg}
  \captionof{figure}{Caption for Second fig}
\end{minipage}

\vspace{.5cm}
\lipsum[2][1-5]
\vspace{.5cm}

\noindent\begin{minipage}{.4\textwidth}
\centering
  \includegraphics[width=.9\linewidth]{image.jpg}
\end{minipage}%
\begin{minipage}{.6\textwidth}
\centering
  \includegraphics[width=.9\linewidth]{image.jpg}
\end{minipage}

\end{document}

Output :

This method doesn’t require additional packages, making it a lightweight solution.

multicol package

The multicol is mainly used for text, but it can also structure images inside a multi-column layout. Since multicol doesn’t support floats, \captionof{figure} is used for captions.

\documentclass[11pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{graphicx,xcolor,lipsum,multicol,caption}
\begin{document}
\pagecolor{red!7!white}
\lipsum[1][1-7]

\begin{multicols}{2}
 \centering
   \includegraphics[width=.98\linewidth]{image.jpg}
   \captionof{figure}{Caption of Subfig }
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \captionof{figure}{Caption of Subfig}
\end{multicols}

\begin{multicols}{3}
 \centering
   \includegraphics[width=.98\linewidth]{image.jpg}
   \captionof{figure}{Subfig X}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \captionof{figure}{Subfig Y}
   \columnbreak
  \includegraphics[width=.98\linewidth]{image.jpg}
   \captionof{figure}{Subfig Z}
\end{multicols}

\begin{multicols}{4}
 \centering
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
\end{multicols}

\begin{multicols}{5}
\centering
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
\end{multicols}

\lipsum[3][1-7]

\begin{multicols}{6}
 \centering
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
   \columnbreak
   \includegraphics[width=.98\linewidth]{image.jpg}
\end{multicols}

\lipsum[5]
\end{document}

Output :

Using \includegraphics Directly

A simple way to place images side by side is by using \includegraphics. However, this method doesn’t allow individual captions.

To adjust spacing, use \quad, \hfill, or \hspace{}.

\documentclass[11pt]{article}
\usepackage{graphicx,xcolor,lipsum}
\usepackage[margin=1.5cm]{geometry}
\begin{document}
\pagecolor{red!5}

\lipsum[1][1-8]

\begin{figure}[h]
\centering
\includegraphics[width=.5\textwidth]{image.jpg}%
\includegraphics[width=.5\textwidth]{image.jpg}
\caption{Main Caption}
\end{figure}

\lipsum[2][1-8]

\begin{figure}[h]
\centering
\includegraphics[width=.4\textwidth]{image.jpg}\quad
\includegraphics[width=.4\textwidth]{image.jpg}
\caption{Main Caption}
\end{figure}

\lipsum[3][1-10]

\begin{figure}[h]
\centering
\includegraphics[width=.35\textwidth]{image.jpg}\hspace{1cm}
\includegraphics[width=.35\textwidth]{image.jpg}
\end{figure}

\lipsum[4][1-5]

\end{document}

Output :

Using tabular for Grid Layouts

If you need a structured grid of images, tabular works well.

\documentclass[11pt]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{graphicx,lipsum}
\begin{document}

\lipsum[1][1-7]

\begin{figure}[h]
\centering
\begin{tabular}{cc}
  \includegraphics[width=0.47\textwidth]{image.jpg} & \includegraphics[width=0.47\textwidth]{image.jpg} \\
  Caption for first image & Caption for second image \\
\end{tabular}
\caption{Main caption for both images}
\end{figure}

\lipsum[2][1-8]

\begin{figure}[h]
\centering
\begin{tabular}{cc}
  \includegraphics[width=0.4\textwidth]{image.jpg} & \includegraphics[width=0.4\textwidth]{image.jpg} \\
  Caption for first image & Caption for second image \\
\end{tabular}
\caption{Main caption for both images}
\end{figure}

\lipsum[3][1-8]

\begin{figure}[h]
\centering
\begin{tabular}{ccc}
  \includegraphics[width=0.3\textwidth]{image.jpg} & \includegraphics[width=0.3\textwidth]{image.jpg} &
  \includegraphics[width=0.3\textwidth]{image.jpg} \\
  Caption for first image & Caption for second image  & Caption for Thrird image\\
\end{tabular}
\caption{Main caption for all images}
\end{figure}

\end{document}

Output :

Conclusion

Placing figures side by side in a LaTeX document is achievable through various methods, each with its own advantages. The subfigure environment and subfloat command from subfig package offers structured and flexible approaches, respectively.

For more control, minipage environment, multicol package, and tabular environment provides options to integrate figures within different multi-column layouts.

Share tutorial

1 thought on “How do you place multiple figures side by side in LaTeX?”

  1. Hey, nice article! I still have one question tho. How to make two pictures that are different sizes align at the top of the pictures (not top of both of the captions, which always happens to me whenever im trying to fix it)? Im using minipage (and package float). Id really aprieciate your help, thanks!

Leave a Comment

Your email address will not be published. Required fields are marked *