How to give an space between figures on subfigure latex ambient?

52k views Asked by At

I am using the command \begin{subfigure}...\end{subfigure} to insert three pictures side by side. But I would like to know how to give an space between then, since they are too close each other.

\begin{figure}
    \begin{subfigure}
       here's the first image
    \end{subfigure}
    \begin{subfigure}
       here's the second image
    \end{subfigure}
    \begin{subfigure}
       here's the third image
    \end{subfigure}
\end{figure}
1

There are 1 answers

2
Werner On

I suggest using subcaption and adding some \hspace between the images:

enter image description here

\documentclass{article}

\usepackage{subcaption,graphicx}

\begin{document}

\begin{figure}
  \centering
  \begin{subfigure}{.3\linewidth}
    \centering
    \includegraphics[width = \linewidth]{example-image-a}
    \caption{First image}
  \end{subfigure}%
  \hspace{1em}% Space between image A and B
  \begin{subfigure}{.3\linewidth}
    \centering
    \includegraphics[width = \linewidth]{example-image-b}
    \caption{Second image}
  \end{subfigure}%
  \hspace{2em}% Space between image B and C
  \begin{subfigure}{.3\linewidth}
    \centering
    \includegraphics[width = \linewidth]{example-image-c}
    \caption{Third image}
  \end{subfigure}
  \caption{A number of images}
\end{figure}

\end{document}