1

I am doing a Beamer presentation and I am trying to put two figures next to each other using minipage. The problem is that my presentation contains a right sidebar and when I set the minipage width to .5\textwidth the two figures seem to be centred around the centre of the page, ignoring the sidebar on the right. In a sense, I would like the textwidth to take in account the presence of the sidebar. Here is the piece of code I'm struggling with :

\usetheme{Madrid}
\useoutertheme[right]{sidebar}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}{Outline}
  \tableofcontents
\end{frame}

\section{Problem 1}

\begin{frame}{Problem 1}

\begin{figure}[H]
\centering
\begin{minipage}{.5\textwidth}
\centering
  \includegraphics[scale=.25,angle=-90]{image1}
\end{minipage}%
\begin{minipage}{.5\textwidth}
\centering
  \includegraphics[scale=.25,angle=-90]{image2}
\end{minipage}
\end{figure}
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Feb 23 at 13:28
2
  • Use width=\textwidth (or height=\textwidth if rotated by 90°) for the images and it works fine.
  • Use example-image to get a MWE.

Code:

\documentclass{beamer}

\usetheme{Madrid}
\useoutertheme[right]{sidebar}
\setbeamercovered{dynamic}

\begin{document}

\section{Problem 1}

\begin{frame}{Problem 1}
    \begin{figure}
        \centering
        \begin{minipage}{.5\textwidth}
            \centering
            \includegraphics[width=\textwidth]{example-image}
        \end{minipage}%
        \begin{minipage}{.5\textwidth}
            \centering
            \includegraphics[height=\textwidth,angle=-90]{example-image}
        \end{minipage}
    \end{figure}
\end{frame}

\end{document}

Result:

enter image description here

  • Thank you, it was actually really helpful! Now, how can I make the image bigger while keeping them centred? – Fagio Feb 23 at 13:55
  • Why do you want to make the images bigger? By setting them to \textwidth you get the maximum size (without overlapping each other or the borders). – dexteritas Feb 25 at 19:39
1

beamer has an environment for that: columns.

\documentclass{beamer}
\usetheme{Madrid}
\useoutertheme[right]{sidebar}
\setbeamercovered{dynamic}

\begin{document}


\section{Problem 1}

\begin{frame}[t]
\frametitle{Problem 1}

\begin{columns}[t]
\begin{column}{.45\textwidth}
\centering
  \includegraphics[scale=.25,angle=-90]{example-image-a}
\end{column}%
\begin{column}{.45\textwidth}
\centering
  \includegraphics[scale=.25,angle=-90]{example-image-b}
\end{column}
\end{columns}
\end{frame}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.