37

Hello I want add space between two images like this:

\begin{figure}
    \includegraphics[width=\textwidth]{test1.png}
    \vspace{2cm}
    \includegraphics[width=\textwidth]{test2.png}
    \caption{ActionButton}
    \label{ActionButton}
\end{figure}

but it's add space between test2.png and the caption...

How can I solve it?

4
  • 11
    The solution here is really simple: You need to be in vertical mode for \vspace to have any effect. As such, insert a blank line (or explicit \par) after test1.png.
    – Werner
    Commented Sep 9, 2014 at 23:58
  • I believe even \newline will do. Commented Sep 10, 2014 at 4:05
  • Yes! \par (or a blank line) and \vspace{2cm} after works! Why I shoud add \par? Why here I'm in horizontal mode and not in vertical mode?
    – perecastor
    Commented Sep 10, 2014 at 9:13
  • Compare your problem with my comment tex.stackexchange.com/questions/215590/…
    – wipet
    Commented Dec 9, 2014 at 7:18

3 Answers 3

29

I hope that this is the one you want

code

\documentclass{article}
\usepackage{graphicx}
\begin{document}


\begin{figure}
\begin{center}
    \includegraphics[width=0.35\textwidth]{albt.png}

    \vspace{1cm}

    \includegraphics[width=0.35\textwidth]{altman.png}
   \vspace{0.1cm}
    \caption{ActionButton}
    \label{ActionButton}
  \end{center}
\end{figure}


\end{document}

space

13

If the two images are next to each other use horizontal space and not vertical space

\hspace{2 cm}
6
  • 1
    This is better-suited as a comment.
    – Werner
    Commented Dec 31, 2017 at 4:41
  • 1
    @Werner he doesn't have enough rep for comment yet :) Commented Mar 13, 2018 at 15:11
  • @CiprianTomoiagă: That's always the case with a new user. They're also unregistered and most likely will not return to this account.
    – Werner
    Commented Mar 13, 2018 at 16:39
  • @Werner I think they do not return because of discouraging comments like yours. Commented May 18, 2021 at 17:37
  • @MrigankPawagi: Which comment do you consider discouraging? The user hung around for 1.5 year after my comments and hasn't been seen since late 2019.
    – Werner
    Commented May 18, 2021 at 18:08
11

You can also just add an \\ after the first includegraphics:

\begin{figure}
    \includegraphics[width=\textwidth]{test1.png}\\
    \vspace{2cm}
    \includegraphics[width=\textwidth]{test2.png}
    \caption{ActionButton}
    \label{ActionButton}
\end{figure}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .