6

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}
Diego
  • 155
  • 2
  • 4
  • 11

1 Answers1

12

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}
Werner
  • 14,324
  • 7
  • 55
  • 77
  • thanks! I'm getting an error while using subcaption package, maybe due to the template that I'm using – Diego Sep 25 '18 at 20:01
  • @Diego: Most likely. You'll have to show your code in order to address that problem. – Werner Sep 25 '18 at 21:01