I need to place a couple of images side by side (horizontally) in a presentation I'm doing with beamer, so I looked around and inserted the following code (sugested by this post):
\documentclass{beamer}
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{frame}
\begin{figure}
\centering
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{image1}
\caption{A subfigure}
\end{minipage}
\begin{minipage}{.5\textwidth}
\centering
\includegraphics[width=.4\linewidth]{image2}
\caption{A subfigure}
\end{minipage}
\caption{A figure with two subfigures}
\end{figure}
\end{frame}
\end{document}
But the images appear one over the other (vertically). I tried both approaches suggested in the aforementioned post but I get the same result. What can I be doing wrong and how can I fix it?

\documentclass{...}and ending with\end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to help you. Help them help you: remove that one hurdle between you and a solution to your problem. And use\usepackage[demo]{graphicx}to illustrate the figure's problem, instead of usinggrafo.png. – adn Nov 29 '13 at 13:08\end{minipage}\begin{minipage}...in the middle – David Carlisle Nov 29 '13 at 13:15