0

I am trying to put two images side by side in the same beamer. I am trying different solutions and I am focusing on this answer How to align two images side by side and to scale them automatically to use whole slide? given by @Martin Thoma.

I am exactly doing the following


\documentclass{beamer}
\usepackage{graphicx}
\begin{document}
\begin{frame}{Comparison}
    \begin{figure}[ht]
        \begin{minipage}[b]{0.45\linewidth}
            \centering
            \includegraphics[width=1.65\textwidth]{example-image-a.png}
            \label{fig:a}
        \end{minipage}
        \hspace{0.5cm}
        \begin{minipage}[b]{0.45\linewidth}
            \centering
            \includegraphics[width=1.55\textwidth]{example-image-b.png}
            \label{fig:b}
        \end{minipage}
    \end{figure}
\end{frame}
\end{document}

However, the picture are still not very well appreciate (a bit small) and they are a bit on the right part of the beamer. I would like to increase a bit the size of the pictures. First, moving them a bit to the left (maybe also a bit upwards) and increase the size. Is it possible to do it?

OgeiD
  • 125
  • 1
    Erh, what exactly is width=1.55\textwidth suppose to do here? I would just use width=\linewidth, then it adjusts to the size of the minipage. – daleif Apr 21 '22 at 13:25
  • Plus, please complete your example and make it compilable. (\begin/end{document} is missing) – daleif Apr 21 '22 at 13:27
  • Thank you @daleif . Do you mean changing where I wrote \textwidth put instead \linewidth ? I did it and I changed a bit of the size but they are still in the right part of the beamer. Can you be more explicit? – OgeiD Apr 21 '22 at 13:40
  • @daleif I already edited my question with that changes. Thank you! – OgeiD Apr 21 '22 at 13:40
  • we still can not run the example, please use example-image-a and -b as in my answer as they are generally available – David Carlisle Apr 21 '22 at 14:52
  • Thank you @DavidCarlisle for pointing me out. I think I already did it. – OgeiD Apr 21 '22 at 15:25

1 Answers1

3

You do not need to load graphicx (beamer loads it already) and you don't need figure or minipage

enter image description here

\documentclass{beamer}

\begin{document} \begin{frame}{Comparison}

\includegraphics[width=.47\textwidth]{example-image-a.png}% \hfill \includegraphics[width=.47\textwidth]{example-image-b.png}%

\end{frame} \end{document}

If you want the image bigger than .5\textwidth you need to bled in to the margins

enter image description here

\documentclass{beamer}

\begin{document} \begin{frame}{Comparison}

\hspace{-.75cm}% \includegraphics[width=.53\textwidth]{example-image-a.png}% \hfill \includegraphics[width=.53\textwidth]{example-image-b.png}% \hspace{-.75cm}%

\end{frame} \end{document}

David Carlisle
  • 757,742
  • Thank you @David Carlisle. I tried that solution but the images appears really small and when I increase the width=. to something greater they just put one below to another and I would like to have them side by side – OgeiD Apr 21 '22 at 13:35
  • @OgeiD if you want them side by side you can't have them much bigger than .47 textwidth. If you want to bleed in to the margin you could make them a big bigger, see update – David Carlisle Apr 21 '22 at 13:46
  • Thank you for the uptade @David Carlisle. When I do that, they are still very small and when I increase a bit the textwidth they appears one below to another. I am not sure if it is a problem of the images but they seem ok when I open them. They are big. – OgeiD Apr 21 '22 at 13:50
  • @OgeiD do your images have a lot of white space? if you do \fbox{\includegraphics[width=...]{...}} is the box tight round the image? you might want to use an image editor to clip the image to the real size – David Carlisle Apr 21 '22 at 14:35
  • In principle, there is not a lot of white space but I should check that carefully – OgeiD Apr 21 '22 at 15:25
  • @OgeiD so now your example uses the same images as this answer I can not guess what issue you still have, you can not make the images any bigger and have them fit on a line, – David Carlisle Apr 21 '22 at 15:48