[Tex/LaTex] Table inside table

graphicstables

Inside of a Beamer presentation, I want to put a graph side-by-side with a data table. Outline of the code:

\begin{tabular*}{l r}
    \begin{center}\includegraphics{graph}\end{center}
    &
    \begin{tabular}{|p{1cm}|p{1cm}|p{1cm}|p{1cm}|}
        1 & 2 & 3 & 4\\\hline
        4 & 3 & 2 & 1\\\hline
    \end{tabular}\\
\end{tabular*}

This gives the error Something's wrong, maybe a missing \item. Earlier in the presentation I used a tabular* environment to put a graph side-by-side with some bullet points, and in another slide, I used a tabular environment to display data under a graph. Is there a better way to do this? Why doesn't LaTeX allow a tabular inside a tabular*?

Best Answer

You can use the columns environment instead. You can use one column to place the image and another one for the table:

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}

\begin{document}

\begin{frame}
\begin{columns}
\column{.5\textwidth}    
  \centering
  \includegraphics{graph}
\column{.5\textwidth}    
    \begin{tabular}{|p{1cm}|p{1cm}|p{1cm}|p{1cm}|}\hline
        1 & 2 & 3 & 4\\\hline
        4 & 3 & 2 & 1\\\hline
    \end{tabular}
\end{columns}
\end{frame}

\end{document}

The line \PassOptionsToPackage{demo}{graphicx} was only included to make my example compilable for everyone; do not include it in your actual code.

Related Question