2

I'm trying to align my images in a tabular environment like so:

\documentclass[t]{beamer}                                                                                                                                 
\usepackage{multirow}

\begin{document}

\begin{frame}[c]{Aligning images with a tabular environment}

  \centering

  \begin{tabular}{|c | c |}
    \hline
    \includegraphics[width=2cm]{img/440px-DandelionFlower} &
    \multirow{2}{*}{\includegraphics[width=2cm]{img/440px-Blackwell_dens_leonis}}\\
    \includegraphics[width=2cm]{img/440px-TaraxacumOfficinaleSeed} & \\
    \hline
  \end{tabular}

\end{frame}

\end{document}

But as you can see in the output, one image seems shifted off from the table. How can I get the image to fit within its cell? Output

1
  • 1
    Try loading adjustbox with option [export] and use \includegraphics[width=2cm, valign=c]{...dens_leonis}.
    – Bernard
    Commented Dec 18, 2018 at 21:20

1 Answer 1

4

with help of theadjustbox and option [t] at multrow cell:

enter image description here

\documentclass[demo]{beamer}
\usepackage{multirow}
\usepackage[export]{adjustbox}

\begin{document}

\begin{frame}[c]{Aligning images with a tabular environment}
    \centering
\begin{tabular}{|c | c |}
    \hline
    \includegraphics[width=2cm,height=2cm,
                     valign=t, margin=0pt 3pt 0pt 3pt]{img/440px-DandelionFlower}
        &   \multirow[t]{2}{*}{\includegraphics[width=2cm,height=4.2cm,
                            valign=t, margin=0pt 3pt 0pt 3pt]{img/440px-Blackwell_dens_leonis}}\\
    \includegraphics[width=2cm,height=2cm,
                     valign=t, margin=0pt 3pt 0pt 3pt]{img/440px-TaraxacumOfficinaleSeed}
        &   \\
    \hline
\end{tabular}
\end{frame}

You must log in to answer this question.

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