2

I am new to Beamer and am trying to create a slide that has four figures, and I want to emphasize two figures with a red box.

This setup makes the four figures nicely, based on the accepted answer here:

\usepackage{caption}
\captionsetup{labelformat=empty,labelsep=none}

\begin{frame}
\frametitle{Slide Title}
\begin{columns}[t]
\column{.5\textwidth}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 1}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 2}
\column{.5\textwidth}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 3}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 4}
\end{columns}
\end{frame}

When I try to add the red boxes (per this question/answer, the figures shift around and off the page. How can I keep them in the same position as above and just have a thick red outline to emphasize the first two (left two) figures?

\usepackage{caption}
\captionsetup{labelformat=empty,labelsep=none}
\usepackage{fancybox}

\begin{columns}[t]
\fboxsep=1pt
\fboxrule=2pt
\def\bordercolor{red}
\def\backgroundcolor{white}
\cornersize{0.1}

\column{.5\textwidth}
    \fcolorbox{\bordercolor}{\backgroundcolor} {\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 1}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 2}
\column{.5\textwidth}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 3}
    \includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
        \captionof{figure}{Comment 4}
\end{columns}
\end{frame}

1 Answer 1

1

Set everything using a tabular with centred columns rather than the columns environment:

enter image description here

\documentclass{beamer}

\usepackage{fancybox}

\begin{document}

\begin{frame}
  \setlength{\fboxsep}{1pt}%
  \setlength{\fboxrule}{2pt}%
  \newcommand\bordercolor{red}%
  \newcommand\backgroundcolor{white}

  \begin{tabular}{ c c }
    \fcolorbox{\bordercolor}{\backgroundcolor}{%
      \includegraphics[width=.45\linewidth,height=3cm]{example-image-a}%
    } &
      \includegraphics[width=.45\linewidth,height=3cm]{example-image-b} \\
    Comment 1 &
      Comment 2 \\
    \fcolorbox{\bordercolor}{\backgroundcolor}{%
      \includegraphics[width=.45\linewidth,height=3cm]{example-image-c}%
    } &
      \includegraphics[width=.45\linewidth,height=3cm]{example-image-a} \\
    Comment 3 &
      Comment 4
  \end{tabular}
\end{frame}

\end{document}
1
  • thank you for the explanation and help!
    – a11
    Aug 20, 2021 at 23:14

You must log in to answer this question.

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